@vitessce/image-utils 3.5.0 → 3.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-68f84e2a.js";
2
- import { B as BaseDecoder } from "./index-c873a642.js";
2
+ import { B as BaseDecoder } from "./index-f9f51d7d.js";
3
3
  import "react";
4
4
  class DeflateDecoder extends BaseDecoder {
5
5
  decodeBlock(buffer) {
@@ -119106,16 +119106,16 @@ function addDecoder(cases, importFn) {
119106
119106
  }
119107
119107
  cases.forEach((c) => registry$1.set(c, importFn));
119108
119108
  }
119109
- addDecoder([void 0, 1], () => import("./raw-8cba8b55.js").then((m) => m.default));
119110
- addDecoder(5, () => import("./lzw-59c916e5.js").then((m) => m.default));
119109
+ addDecoder([void 0, 1], () => import("./raw-f146a8e7.js").then((m) => m.default));
119110
+ addDecoder(5, () => import("./lzw-6e2a6d58.js").then((m) => m.default));
119111
119111
  addDecoder(6, () => {
119112
119112
  throw new Error("old style JPEG compression is not supported.");
119113
119113
  });
119114
- addDecoder(7, () => import("./jpeg-673bafe6.js").then((m) => m.default));
119115
- addDecoder([8, 32946], () => import("./deflate-c5604e0b.js").then((m) => m.default));
119116
- addDecoder(32773, () => import("./packbits-cb0db61c.js").then((m) => m.default));
119117
- addDecoder(34887, () => import("./lerc-85f3f289.js").then((m) => m.default));
119118
- addDecoder(50001, () => import("./webimage-fbae86a4.js").then((m) => m.default));
119114
+ addDecoder(7, () => import("./jpeg-3a14feff.js").then((m) => m.default));
119115
+ addDecoder([8, 32946], () => import("./deflate-07dc0cca.js").then((m) => m.default));
119116
+ addDecoder(32773, () => import("./packbits-f0813b05.js").then((m) => m.default));
119117
+ addDecoder(34887, () => import("./lerc-33357b1d.js").then((m) => m.default));
119118
+ addDecoder(50001, () => import("./webimage-509735bc.js").then((m) => m.default));
119119
119119
  function decodeRowAcc(row, stride) {
119120
119120
  let length2 = row.length - stride;
119121
119121
  let offset = 0;
@@ -133510,6 +133510,17 @@ class ImageWrapper {
133510
133510
  }
133511
133511
  return [];
133512
133512
  }
133513
+ getChannelIndex(channelSpecifier) {
133514
+ if (typeof channelSpecifier === "number") {
133515
+ return channelSpecifier;
133516
+ }
133517
+ const channelNames = this.getChannelNames();
133518
+ const channelIndex = channelNames.indexOf(channelSpecifier);
133519
+ if (channelIndex === -1) {
133520
+ console.error(`Channel ${channelSpecifier} not found in image.`);
133521
+ }
133522
+ return channelIndex;
133523
+ }
133513
133524
  // TODO: support passing a custom color palette array.
133514
133525
  getChannelObjects() {
133515
133526
  if ("image-label" in this.vivLoader.metadata) {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { I } from "./index-c873a642.js";
1
+ import { I } from "./index-f9f51d7d.js";
2
2
  import "react";
3
3
  export {
4
4
  I as ImageWrapper
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-c873a642.js";
1
+ import { B as BaseDecoder } from "./index-f9f51d7d.js";
2
2
  import "react";
3
3
  const dctZigZag = new Int32Array([
4
4
  0,
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-68f84e2a.js";
2
- import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-c873a642.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-f9f51d7d.js";
3
3
  import "react";
4
4
  const LercParameters = {
5
5
  Version: 0,
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-c873a642.js";
1
+ import { B as BaseDecoder } from "./index-f9f51d7d.js";
2
2
  import "react";
3
3
  const MIN_BITS = 9;
4
4
  const CLEAR_CODE = 256;
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-c873a642.js";
1
+ import { B as BaseDecoder } from "./index-f9f51d7d.js";
2
2
  import "react";
3
3
  class PackbitsDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-c873a642.js";
1
+ import { B as BaseDecoder } from "./index-f9f51d7d.js";
2
2
  import "react";
3
3
  class RawDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-c873a642.js";
1
+ import { B as BaseDecoder } from "./index-f9f51d7d.js";
2
2
  import "react";
3
3
  class WebImageDecoder extends BaseDecoder {
4
4
  constructor() {
@@ -16,6 +16,7 @@ export default class ImageWrapper implements AbstractImageWrapper {
16
16
  getName(): string;
17
17
  getNumChannels(): number;
18
18
  getChannelNames(): string[];
19
+ getChannelIndex(channelSpecifier: string | number): number;
19
20
  getChannelObjects(): ChannelObject[];
20
21
  getDtype(): string | undefined;
21
22
  hasZStack(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"ImageWrapper.d.ts","sourceRoot":"","sources":["../src/ImageWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,YAAY,EACb,MAAM,iBAAiB,CAAC;AAczB;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,YAAW,oBAAoB;IAC/D,SAAS,EAAE,aAAa,CAAC;IAEzB,OAAO,EAAE,YAAY,CAAC;gBAEV,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY;IAK3D,OAAO,IAAI,UAAU,GAAG,UAAU;IAUlC,eAAe,IAAI,OAAO;IAuB1B,OAAO,IAAI,iBAAiB;IAI5B,cAAc,IAAI,MAAM,EAAE;IAyD1B,iBAAiB,IAAI,MAAM;IAe3B,iBAAiB,IAAI,MAAM;IAe3B,OAAO,IAAI,MAAM;IAyBjB,cAAc,IAAI,MAAM;IAmCxB,eAAe,IAAI,MAAM,EAAE;IAkC3B,iBAAiB,IAAI,aAAa,EAAE;IA6DpC,QAAQ,IAAI,MAAM,GAAG,SAAS;IAS9B,SAAS,IAAI,OAAO;IAO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AAgB,EAAE;IAsB7C;;;;;OAKG;IACH,uBAAuB,IAAI,MAAM,GAAC,IAAI;IAetC,eAAe,IAAI,YAAY;IAc/B,aAAa,IAAI,OAAO;IAMxB,4BAA4B,IAAK,KAAK,GAAG,aAAa;CA+BvD"}
@@ -145,6 +145,19 @@ export default class ImageWrapper {
145
145
  }
146
146
  return [];
147
147
  }
148
+ getChannelIndex(channelSpecifier) {
149
+ if (typeof channelSpecifier === 'number') {
150
+ return channelSpecifier;
151
+ }
152
+ // If not a number,
153
+ // then assume the user passed a string corresponding to a channel name.
154
+ const channelNames = this.getChannelNames();
155
+ const channelIndex = channelNames.indexOf(channelSpecifier);
156
+ if (channelIndex === -1) {
157
+ console.error(`Channel ${channelSpecifier} not found in image.`);
158
+ }
159
+ return channelIndex;
160
+ }
148
161
  // TODO: support passing a custom color palette array.
149
162
  getChannelObjects() {
150
163
  // SpatialData cases (image-label and channels_metadata)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/image-utils",
3
- "version": "3.5.0",
3
+ "version": "3.5.2",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -17,9 +17,9 @@
17
17
  ],
18
18
  "dependencies": {
19
19
  "@hms-dbmi/viv": "~0.16.0",
20
- "@vitessce/types": "3.5.0",
21
- "@vitessce/spatial-utils": "3.5.0",
22
- "@vitessce/utils": "3.5.0"
20
+ "@vitessce/types": "3.5.2",
21
+ "@vitessce/spatial-utils": "3.5.2",
22
+ "@vitessce/utils": "3.5.2"
23
23
  },
24
24
  "devDependencies": {
25
25
  "vite": "^4.3.0",
@@ -251,6 +251,20 @@ export default class ImageWrapper implements AbstractImageWrapper {
251
251
  return [];
252
252
  }
253
253
 
254
+ getChannelIndex(channelSpecifier: string|number): number {
255
+ if (typeof channelSpecifier === 'number') {
256
+ return channelSpecifier;
257
+ }
258
+ // If not a number,
259
+ // then assume the user passed a string corresponding to a channel name.
260
+ const channelNames = this.getChannelNames();
261
+ const channelIndex = channelNames.indexOf(channelSpecifier);
262
+ if (channelIndex === -1) {
263
+ console.error(`Channel ${channelSpecifier} not found in image.`);
264
+ }
265
+ return channelIndex;
266
+ }
267
+
254
268
  // TODO: support passing a custom color palette array.
255
269
  getChannelObjects(): ChannelObject[] {
256
270
  // SpatialData cases (image-label and channels_metadata)