@vitessce/image-utils 3.4.14 → 3.5.1

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-8b6c9313.js";
2
+ import { B as BaseDecoder } from "./index-f9f51d7d.js";
3
3
  import "react";
4
4
  class DeflateDecoder extends BaseDecoder {
5
5
  decodeBlock(buffer) {
@@ -84903,7 +84903,7 @@ keysShim.shim = function shimObjectKeys() {
84903
84903
  return Object.keys || keysShim;
84904
84904
  };
84905
84905
  var objectKeys$1 = keysShim;
84906
- var shams$2 = function hasSymbols() {
84906
+ var shams$1 = function hasSymbols() {
84907
84907
  if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") {
84908
84908
  return false;
84909
84909
  }
@@ -84948,9 +84948,9 @@ var shams$2 = function hasSymbols() {
84948
84948
  }
84949
84949
  return true;
84950
84950
  };
84951
- var hasSymbols$4 = shams$2;
84952
- var shams$1 = function hasToStringTagShams() {
84953
- return hasSymbols$4() && !!Symbol.toStringTag;
84951
+ var hasSymbols$3 = shams$1;
84952
+ var shams = function hasToStringTagShams() {
84953
+ return hasSymbols$3() && !!Symbol.toStringTag;
84954
84954
  };
84955
84955
  var esErrors = Error;
84956
84956
  var _eval = EvalError;
@@ -84960,8 +84960,8 @@ var syntax = SyntaxError;
84960
84960
  var type = TypeError;
84961
84961
  var uri = URIError;
84962
84962
  var origSymbol = typeof Symbol !== "undefined" && Symbol;
84963
- var hasSymbolSham = shams$2;
84964
- var hasSymbols$3 = function hasNativeSymbols() {
84963
+ var hasSymbolSham = shams$1;
84964
+ var hasSymbols$2 = function hasNativeSymbols() {
84965
84965
  if (typeof origSymbol !== "function") {
84966
84966
  return false;
84967
84967
  }
@@ -84977,11 +84977,12 @@ var hasSymbols$3 = function hasNativeSymbols() {
84977
84977
  return hasSymbolSham();
84978
84978
  };
84979
84979
  var test = {
84980
+ __proto__: null,
84980
84981
  foo: {}
84981
84982
  };
84982
84983
  var $Object$1 = Object;
84983
84984
  var hasProto$1 = function hasProto() {
84984
- return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object$1);
84985
+ return { __proto__: test }.foo === test.foo && !(test instanceof $Object$1);
84985
84986
  };
84986
84987
  var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
84987
84988
  var toStr$2 = Object.prototype.toString;
@@ -85096,7 +85097,7 @@ var ThrowTypeError = $gOPD$2 ? function() {
85096
85097
  }
85097
85098
  }
85098
85099
  }() : throwTypeError;
85099
- var hasSymbols$2 = hasSymbols$3();
85100
+ var hasSymbols$1 = hasSymbols$2();
85100
85101
  var hasProto2 = hasProto$1();
85101
85102
  var getProto$1 = Object.getPrototypeOf || (hasProto2 ? function(x2) {
85102
85103
  return x2.__proto__;
@@ -85108,7 +85109,7 @@ var INTRINSICS = {
85108
85109
  "%AggregateError%": typeof AggregateError === "undefined" ? undefined$1 : AggregateError,
85109
85110
  "%Array%": Array,
85110
85111
  "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined$1 : ArrayBuffer,
85111
- "%ArrayIteratorPrototype%": hasSymbols$2 && getProto$1 ? getProto$1([][Symbol.iterator]()) : undefined$1,
85112
+ "%ArrayIteratorPrototype%": hasSymbols$1 && getProto$1 ? getProto$1([][Symbol.iterator]()) : undefined$1,
85112
85113
  "%AsyncFromSyncIteratorPrototype%": undefined$1,
85113
85114
  "%AsyncFunction%": needsEval,
85114
85115
  "%AsyncGenerator%": needsEval,
@@ -85139,10 +85140,10 @@ var INTRINSICS = {
85139
85140
  "%Int32Array%": typeof Int32Array === "undefined" ? undefined$1 : Int32Array,
85140
85141
  "%isFinite%": isFinite,
85141
85142
  "%isNaN%": isNaN,
85142
- "%IteratorPrototype%": hasSymbols$2 && getProto$1 ? getProto$1(getProto$1([][Symbol.iterator]())) : undefined$1,
85143
+ "%IteratorPrototype%": hasSymbols$1 && getProto$1 ? getProto$1(getProto$1([][Symbol.iterator]())) : undefined$1,
85143
85144
  "%JSON%": typeof JSON === "object" ? JSON : undefined$1,
85144
85145
  "%Map%": typeof Map === "undefined" ? undefined$1 : Map,
85145
- "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols$2 || !getProto$1 ? undefined$1 : getProto$1((/* @__PURE__ */ new Map())[Symbol.iterator]()),
85146
+ "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols$1 || !getProto$1 ? undefined$1 : getProto$1((/* @__PURE__ */ new Map())[Symbol.iterator]()),
85146
85147
  "%Math%": Math,
85147
85148
  "%Number%": Number,
85148
85149
  "%Object%": Object,
@@ -85155,11 +85156,11 @@ var INTRINSICS = {
85155
85156
  "%Reflect%": typeof Reflect === "undefined" ? undefined$1 : Reflect,
85156
85157
  "%RegExp%": RegExp,
85157
85158
  "%Set%": typeof Set === "undefined" ? undefined$1 : Set,
85158
- "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols$2 || !getProto$1 ? undefined$1 : getProto$1((/* @__PURE__ */ new Set())[Symbol.iterator]()),
85159
+ "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols$1 || !getProto$1 ? undefined$1 : getProto$1((/* @__PURE__ */ new Set())[Symbol.iterator]()),
85159
85160
  "%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined$1 : SharedArrayBuffer,
85160
85161
  "%String%": String,
85161
- "%StringIteratorPrototype%": hasSymbols$2 && getProto$1 ? getProto$1(""[Symbol.iterator]()) : undefined$1,
85162
- "%Symbol%": hasSymbols$2 ? Symbol : undefined$1,
85162
+ "%StringIteratorPrototype%": hasSymbols$1 && getProto$1 ? getProto$1(""[Symbol.iterator]()) : undefined$1,
85163
+ "%Symbol%": hasSymbols$1 ? Symbol : undefined$1,
85163
85164
  "%SyntaxError%": $SyntaxError$1,
85164
85165
  "%ThrowTypeError%": ThrowTypeError,
85165
85166
  "%TypedArray%": TypedArray,
@@ -85528,7 +85529,7 @@ var callBound$2 = function callBoundIntrinsic(name2, allowMissing) {
85528
85529
  }
85529
85530
  return intrinsic;
85530
85531
  };
85531
- var hasToStringTag$2 = shams$1();
85532
+ var hasToStringTag$2 = shams();
85532
85533
  var callBound$1 = callBound$2;
85533
85534
  var $toString$1 = callBound$1("Object.prototype.toString");
85534
85535
  var isStandardArguments = function isArguments2(value) {
@@ -85573,7 +85574,7 @@ hasPropertyDescriptors2.hasArrayLengthDefineBug = function hasArrayLengthDefineB
85573
85574
  };
85574
85575
  var hasPropertyDescriptors_1 = hasPropertyDescriptors2;
85575
85576
  var keys2 = objectKeys$1;
85576
- var hasSymbols$1 = typeof Symbol === "function" && typeof Symbol("foo") === "symbol";
85577
+ var hasSymbols2 = typeof Symbol === "function" && typeof Symbol("foo") === "symbol";
85577
85578
  var toStr$1 = Object.prototype.toString;
85578
85579
  var concat = Array.prototype.concat;
85579
85580
  var defineDataProperty2 = defineDataProperty$1;
@@ -85600,7 +85601,7 @@ var defineProperty$1 = function(object2, name2, value, predicate) {
85600
85601
  var defineProperties = function(object2, map2) {
85601
85602
  var predicates = arguments.length > 2 ? arguments[2] : {};
85602
85603
  var props = keys2(map2);
85603
- if (hasSymbols$1) {
85604
+ if (hasSymbols2) {
85604
85605
  props = concat.call(props, Object.getOwnPropertySymbols(map2));
85605
85606
  }
85606
85607
  for (var i2 = 0; i2 < props.length; i2 += 1) {
@@ -85651,10 +85652,6 @@ define$2(polyfill$1, {
85651
85652
  shim: shim$2
85652
85653
  });
85653
85654
  var objectIs = polyfill$1;
85654
- var hasSymbols2 = shams$2;
85655
- var shams = function hasToStringTagShams2() {
85656
- return hasSymbols2() && !!Symbol.toStringTag;
85657
- };
85658
85655
  var callBound = callBound$2;
85659
85656
  var hasToStringTag$1 = shams();
85660
85657
  var has;
@@ -85861,7 +85858,7 @@ var tryDateObject = function tryDateGetDayCall(value) {
85861
85858
  };
85862
85859
  var toStr = Object.prototype.toString;
85863
85860
  var dateClass = "[object Date]";
85864
- var hasToStringTag = shams$1();
85861
+ var hasToStringTag = shams();
85865
85862
  var isDateObject = function isDateObject2(value) {
85866
85863
  if (typeof value !== "object" || value === null) {
85867
85864
  return false;
@@ -119109,16 +119106,16 @@ function addDecoder(cases, importFn) {
119109
119106
  }
119110
119107
  cases.forEach((c) => registry$1.set(c, importFn));
119111
119108
  }
119112
- addDecoder([void 0, 1], () => import("./raw-5b18a735.js").then((m) => m.default));
119113
- addDecoder(5, () => import("./lzw-045aa631.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));
119114
119111
  addDecoder(6, () => {
119115
119112
  throw new Error("old style JPEG compression is not supported.");
119116
119113
  });
119117
- addDecoder(7, () => import("./jpeg-7e62cefb.js").then((m) => m.default));
119118
- addDecoder([8, 32946], () => import("./deflate-2fdae568.js").then((m) => m.default));
119119
- addDecoder(32773, () => import("./packbits-fef84cff.js").then((m) => m.default));
119120
- addDecoder(34887, () => import("./lerc-a095f88f.js").then((m) => m.default));
119121
- addDecoder(50001, () => import("./webimage-bacac931.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));
119122
119119
  function decodeRowAcc(row, stride) {
119123
119120
  let length2 = row.length - stride;
119124
119121
  let offset = 0;
@@ -133513,6 +133510,17 @@ class ImageWrapper {
133513
133510
  }
133514
133511
  return [];
133515
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
+ }
133516
133524
  // TODO: support passing a custom color palette array.
133517
133525
  getChannelObjects() {
133518
133526
  if ("image-label" in this.vivLoader.metadata) {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { I } from "./index-8b6c9313.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-8b6c9313.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-8b6c9313.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-8b6c9313.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-8b6c9313.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-8b6c9313.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-8b6c9313.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;IAOpB,SAAS,IAAI,OAAO;IAOpB,OAAO,IAAI,MAAM;IAMjB,OAAO,IAAI,MAAM;IAMjB,iBAAiB,IAAI,OAAO;IAU5B,uBAAuB,IAAI,gBAAgB,EAAE;IAsB7C;;;;;OAKG;IACH,uBAAuB,IAAI,MAAM,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,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,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitessce/image-utils",
3
- "version": "3.4.14",
4
- "author": "Gehlenborg Lab",
3
+ "version": "3.5.1",
4
+ "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
7
7
  "type": "git",
@@ -17,9 +17,9 @@
17
17
  ],
18
18
  "dependencies": {
19
19
  "@hms-dbmi/viv": "~0.16.0",
20
- "@vitessce/types": "3.4.14",
21
- "@vitessce/spatial-utils": "3.4.14",
22
- "@vitessce/utils": "3.4.14"
20
+ "@vitessce/types": "3.5.1",
21
+ "@vitessce/spatial-utils": "3.5.1",
22
+ "@vitessce/utils": "3.5.1"
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)