@vitessce/image-utils 3.5.6 → 3.5.7

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-93bb5c05.js";
2
+ import { B as BaseDecoder } from "./index-e10282cc.js";
3
3
  import "react";
4
4
  class DeflateDecoder extends BaseDecoder {
5
5
  decodeBlock(buffer) {
@@ -8951,7 +8951,7 @@ function clone$6(obj) {
8951
8951
  Decimal2.floor = floor$1;
8952
8952
  Decimal2.hypot = hypot;
8953
8953
  Decimal2.ln = ln;
8954
- Decimal2.log = log$5;
8954
+ Decimal2.log = log$6;
8955
8955
  Decimal2.log10 = log10;
8956
8956
  Decimal2.log2 = log2$1;
8957
8957
  Decimal2.max = max$2;
@@ -9016,7 +9016,7 @@ function isDecimalInstance(obj) {
9016
9016
  function ln(x2) {
9017
9017
  return new this(x2).ln();
9018
9018
  }
9019
- function log$5(x2, y2) {
9019
+ function log$6(x2, y2) {
9020
9020
  return new this(x2).log(y2);
9021
9021
  }
9022
9022
  function log2$1(x2) {
@@ -19842,6 +19842,258 @@ var pluralizeExports = pluralize.exports;
19842
19842
  const plur = /* @__PURE__ */ getDefaultExportFromCjs(pluralizeExports);
19843
19843
  plur.addPluralRule("glomerulus", "glomeruli");
19844
19844
  plur.addPluralRule("interstitium", "interstitia");
19845
+ var loglevel = { exports: {} };
19846
+ (function(module2) {
19847
+ (function(root2, definition) {
19848
+ if (module2.exports) {
19849
+ module2.exports = definition();
19850
+ } else {
19851
+ root2.log = definition();
19852
+ }
19853
+ })(commonjsGlobal, function() {
19854
+ var noop2 = function() {
19855
+ };
19856
+ var undefinedType = "undefined";
19857
+ var isIE = typeof window !== undefinedType && typeof window.navigator !== undefinedType && /Trident\/|MSIE /.test(window.navigator.userAgent);
19858
+ var logMethods = [
19859
+ "trace",
19860
+ "debug",
19861
+ "info",
19862
+ "warn",
19863
+ "error"
19864
+ ];
19865
+ var _loggersByName = {};
19866
+ var defaultLogger = null;
19867
+ function bindMethod(obj, methodName) {
19868
+ var method = obj[methodName];
19869
+ if (typeof method.bind === "function") {
19870
+ return method.bind(obj);
19871
+ } else {
19872
+ try {
19873
+ return Function.prototype.bind.call(method, obj);
19874
+ } catch (e2) {
19875
+ return function() {
19876
+ return Function.prototype.apply.apply(method, [obj, arguments]);
19877
+ };
19878
+ }
19879
+ }
19880
+ }
19881
+ function traceForIE() {
19882
+ if (console.log) {
19883
+ if (console.log.apply) {
19884
+ console.log.apply(console, arguments);
19885
+ } else {
19886
+ Function.prototype.apply.apply(console.log, [console, arguments]);
19887
+ }
19888
+ }
19889
+ if (console.trace)
19890
+ console.trace();
19891
+ }
19892
+ function realMethod(methodName) {
19893
+ if (methodName === "debug") {
19894
+ methodName = "log";
19895
+ }
19896
+ if (typeof console === undefinedType) {
19897
+ return false;
19898
+ } else if (methodName === "trace" && isIE) {
19899
+ return traceForIE;
19900
+ } else if (console[methodName] !== void 0) {
19901
+ return bindMethod(console, methodName);
19902
+ } else if (console.log !== void 0) {
19903
+ return bindMethod(console, "log");
19904
+ } else {
19905
+ return noop2;
19906
+ }
19907
+ }
19908
+ function replaceLoggingMethods() {
19909
+ var level = this.getLevel();
19910
+ for (var i2 = 0; i2 < logMethods.length; i2++) {
19911
+ var methodName = logMethods[i2];
19912
+ this[methodName] = i2 < level ? noop2 : this.methodFactory(methodName, level, this.name);
19913
+ }
19914
+ this.log = this.debug;
19915
+ if (typeof console === undefinedType && level < this.levels.SILENT) {
19916
+ return "No console available for logging";
19917
+ }
19918
+ }
19919
+ function enableLoggingWhenConsoleArrives(methodName) {
19920
+ return function() {
19921
+ if (typeof console !== undefinedType) {
19922
+ replaceLoggingMethods.call(this);
19923
+ this[methodName].apply(this, arguments);
19924
+ }
19925
+ };
19926
+ }
19927
+ function defaultMethodFactory(methodName, _level, _loggerName) {
19928
+ return realMethod(methodName) || enableLoggingWhenConsoleArrives.apply(this, arguments);
19929
+ }
19930
+ function Logger(name2, factory2) {
19931
+ var self2 = this;
19932
+ var inheritedLevel;
19933
+ var defaultLevel;
19934
+ var userLevel;
19935
+ var storageKey = "loglevel";
19936
+ if (typeof name2 === "string") {
19937
+ storageKey += ":" + name2;
19938
+ } else if (typeof name2 === "symbol") {
19939
+ storageKey = void 0;
19940
+ }
19941
+ function persistLevelIfPossible(levelNum) {
19942
+ var levelName = (logMethods[levelNum] || "silent").toUpperCase();
19943
+ if (typeof window === undefinedType || !storageKey)
19944
+ return;
19945
+ try {
19946
+ window.localStorage[storageKey] = levelName;
19947
+ return;
19948
+ } catch (ignore) {
19949
+ }
19950
+ try {
19951
+ window.document.cookie = encodeURIComponent(storageKey) + "=" + levelName + ";";
19952
+ } catch (ignore) {
19953
+ }
19954
+ }
19955
+ function getPersistedLevel() {
19956
+ var storedLevel;
19957
+ if (typeof window === undefinedType || !storageKey)
19958
+ return;
19959
+ try {
19960
+ storedLevel = window.localStorage[storageKey];
19961
+ } catch (ignore) {
19962
+ }
19963
+ if (typeof storedLevel === undefinedType) {
19964
+ try {
19965
+ var cookie = window.document.cookie;
19966
+ var cookieName = encodeURIComponent(storageKey);
19967
+ var location = cookie.indexOf(cookieName + "=");
19968
+ if (location !== -1) {
19969
+ storedLevel = /^([^;]+)/.exec(
19970
+ cookie.slice(location + cookieName.length + 1)
19971
+ )[1];
19972
+ }
19973
+ } catch (ignore) {
19974
+ }
19975
+ }
19976
+ if (self2.levels[storedLevel] === void 0) {
19977
+ storedLevel = void 0;
19978
+ }
19979
+ return storedLevel;
19980
+ }
19981
+ function clearPersistedLevel() {
19982
+ if (typeof window === undefinedType || !storageKey)
19983
+ return;
19984
+ try {
19985
+ window.localStorage.removeItem(storageKey);
19986
+ } catch (ignore) {
19987
+ }
19988
+ try {
19989
+ window.document.cookie = encodeURIComponent(storageKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
19990
+ } catch (ignore) {
19991
+ }
19992
+ }
19993
+ function normalizeLevel(input) {
19994
+ var level = input;
19995
+ if (typeof level === "string" && self2.levels[level.toUpperCase()] !== void 0) {
19996
+ level = self2.levels[level.toUpperCase()];
19997
+ }
19998
+ if (typeof level === "number" && level >= 0 && level <= self2.levels.SILENT) {
19999
+ return level;
20000
+ } else {
20001
+ throw new TypeError("log.setLevel() called with invalid level: " + input);
20002
+ }
20003
+ }
20004
+ self2.name = name2;
20005
+ self2.levels = {
20006
+ "TRACE": 0,
20007
+ "DEBUG": 1,
20008
+ "INFO": 2,
20009
+ "WARN": 3,
20010
+ "ERROR": 4,
20011
+ "SILENT": 5
20012
+ };
20013
+ self2.methodFactory = factory2 || defaultMethodFactory;
20014
+ self2.getLevel = function() {
20015
+ if (userLevel != null) {
20016
+ return userLevel;
20017
+ } else if (defaultLevel != null) {
20018
+ return defaultLevel;
20019
+ } else {
20020
+ return inheritedLevel;
20021
+ }
20022
+ };
20023
+ self2.setLevel = function(level, persist) {
20024
+ userLevel = normalizeLevel(level);
20025
+ if (persist !== false) {
20026
+ persistLevelIfPossible(userLevel);
20027
+ }
20028
+ return replaceLoggingMethods.call(self2);
20029
+ };
20030
+ self2.setDefaultLevel = function(level) {
20031
+ defaultLevel = normalizeLevel(level);
20032
+ if (!getPersistedLevel()) {
20033
+ self2.setLevel(level, false);
20034
+ }
20035
+ };
20036
+ self2.resetLevel = function() {
20037
+ userLevel = null;
20038
+ clearPersistedLevel();
20039
+ replaceLoggingMethods.call(self2);
20040
+ };
20041
+ self2.enableAll = function(persist) {
20042
+ self2.setLevel(self2.levels.TRACE, persist);
20043
+ };
20044
+ self2.disableAll = function(persist) {
20045
+ self2.setLevel(self2.levels.SILENT, persist);
20046
+ };
20047
+ self2.rebuild = function() {
20048
+ if (defaultLogger !== self2) {
20049
+ inheritedLevel = normalizeLevel(defaultLogger.getLevel());
20050
+ }
20051
+ replaceLoggingMethods.call(self2);
20052
+ if (defaultLogger === self2) {
20053
+ for (var childName in _loggersByName) {
20054
+ _loggersByName[childName].rebuild();
20055
+ }
20056
+ }
20057
+ };
20058
+ inheritedLevel = normalizeLevel(
20059
+ defaultLogger ? defaultLogger.getLevel() : "WARN"
20060
+ );
20061
+ var initialLevel = getPersistedLevel();
20062
+ if (initialLevel != null) {
20063
+ userLevel = normalizeLevel(initialLevel);
20064
+ }
20065
+ replaceLoggingMethods.call(self2);
20066
+ }
20067
+ defaultLogger = new Logger();
20068
+ defaultLogger.getLogger = function getLogger(name2) {
20069
+ if (typeof name2 !== "symbol" && typeof name2 !== "string" || name2 === "") {
20070
+ throw new TypeError("You must supply a name when creating a logger.");
20071
+ }
20072
+ var logger = _loggersByName[name2];
20073
+ if (!logger) {
20074
+ logger = _loggersByName[name2] = new Logger(
20075
+ name2,
20076
+ defaultLogger.methodFactory
20077
+ );
20078
+ }
20079
+ return logger;
20080
+ };
20081
+ var _log = typeof window !== undefinedType ? window.log : void 0;
20082
+ defaultLogger.noConflict = function() {
20083
+ if (typeof window !== undefinedType && window.log === defaultLogger) {
20084
+ window.log = _log;
20085
+ }
20086
+ return defaultLogger;
20087
+ };
20088
+ defaultLogger.getLoggers = function getLoggers2() {
20089
+ return _loggersByName;
20090
+ };
20091
+ defaultLogger["default"] = defaultLogger;
20092
+ return defaultLogger;
20093
+ });
20094
+ })(loglevel);
20095
+ var loglevelExports = loglevel.exports;
20096
+ const log$5 = /* @__PURE__ */ getDefaultExportFromCjs(loglevelExports);
19845
20097
  const VIEWER_PALETTE = [
19846
20098
  [0, 0, 255],
19847
20099
  [0, 255, 0],
@@ -119106,16 +119358,16 @@ function addDecoder(cases, importFn) {
119106
119358
  }
119107
119359
  cases.forEach((c) => registry$1.set(c, importFn));
119108
119360
  }
119109
- addDecoder([void 0, 1], () => import("./raw-4787e9a9.js").then((m) => m.default));
119110
- addDecoder(5, () => import("./lzw-10a67c5f.js").then((m) => m.default));
119361
+ addDecoder([void 0, 1], () => import("./raw-85ca8774.js").then((m) => m.default));
119362
+ addDecoder(5, () => import("./lzw-ea1e5043.js").then((m) => m.default));
119111
119363
  addDecoder(6, () => {
119112
119364
  throw new Error("old style JPEG compression is not supported.");
119113
119365
  });
119114
- addDecoder(7, () => import("./jpeg-0ecb3084.js").then((m) => m.default));
119115
- addDecoder([8, 32946], () => import("./deflate-8571803b.js").then((m) => m.default));
119116
- addDecoder(32773, () => import("./packbits-e306803f.js").then((m) => m.default));
119117
- addDecoder(34887, () => import("./lerc-ba23f988.js").then((m) => m.default));
119118
- addDecoder(50001, () => import("./webimage-2e9db874.js").then((m) => m.default));
119366
+ addDecoder(7, () => import("./jpeg-f6c603b6.js").then((m) => m.default));
119367
+ addDecoder([8, 32946], () => import("./deflate-ff9d23eb.js").then((m) => m.default));
119368
+ addDecoder(32773, () => import("./packbits-77361957.js").then((m) => m.default));
119369
+ addDecoder(34887, () => import("./lerc-3b57111e.js").then((m) => m.default));
119370
+ addDecoder(50001, () => import("./webimage-78b941d9.js").then((m) => m.default));
119119
119371
  function decodeRowAcc(row, stride) {
119120
119372
  let length2 = row.length - stride;
119121
119373
  let offset = 0;
@@ -132812,10 +133064,10 @@ function multiSetsToTextureData(multiFeatureValues, multiMatrixObsIndex, setColo
132812
133064
  const valueTexHeight = Math.max(2, Math.ceil(totalValuesLength / texSize));
132813
133065
  const colorTexHeight = Math.max(2, Math.ceil(totalColorsLength / texSize));
132814
133066
  if (valueTexHeight > texSize) {
132815
- console.error("Error: length of concatenated quantitative feature values larger than maximum texture size");
133067
+ log$5.error("Error: length of concatenated quantitative feature values larger than maximum texture size");
132816
133068
  }
132817
133069
  if (colorTexHeight > texSize) {
132818
- console.error("Error: length of concatenated quantitative feature values larger than maximum texture size");
133070
+ log$5.error("Error: length of concatenated quantitative feature values larger than maximum texture size");
132819
133071
  }
132820
133072
  const totalData = new Uint8Array(texSize * valueTexHeight);
132821
133073
  const totalColors = new Uint8Array(texSize * colorTexHeight);
@@ -133501,7 +133753,7 @@ class ImageWrapper {
133501
133753
  const channelNames = this.getChannelNames();
133502
133754
  const channelIndex = channelNames.indexOf(channelSpecifier);
133503
133755
  if (channelIndex === -1) {
133504
- console.error(`Channel ${channelSpecifier} not found in image.`);
133756
+ log$5.error(`Channel ${channelSpecifier} not found in image.`);
133505
133757
  }
133506
133758
  return channelIndex;
133507
133759
  }
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { I } from "./index-93bb5c05.js";
1
+ import { I } from "./index-e10282cc.js";
2
2
  import "react";
3
3
  export {
4
4
  I as ImageWrapper
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-93bb5c05.js";
1
+ import { B as BaseDecoder } from "./index-e10282cc.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-93bb5c05.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-e10282cc.js";
3
3
  import "react";
4
4
  const LercParameters = {
5
5
  Version: 0,
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-93bb5c05.js";
1
+ import { B as BaseDecoder } from "./index-e10282cc.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-93bb5c05.js";
1
+ import { B as BaseDecoder } from "./index-e10282cc.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-93bb5c05.js";
1
+ import { B as BaseDecoder } from "./index-e10282cc.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-93bb5c05.js";
1
+ import { B as BaseDecoder } from "./index-e10282cc.js";
2
2
  import "react";
3
3
  class WebImageDecoder extends BaseDecoder {
4
4
  constructor() {
@@ -1,5 +1,6 @@
1
1
  import { coordinateTransformationsToMatrix, getNgffAxes, getNgffAxesForTiff, physicalSizeToMatrix, hexToRgb, getSourceFromLoader, canLoadResolution, getStatsForResolution, isInterleaved as isInterleavedUtil, } from '@vitessce/spatial-utils';
2
2
  import { VIEWER_PALETTE } from '@vitessce/utils';
3
+ import { log } from '@vitessce/globals';
3
4
  /**
4
5
  * A wrapper around the Viv loader, to provide a common interface for
5
6
  * all image file types.
@@ -154,7 +155,7 @@ export default class ImageWrapper {
154
155
  const channelNames = this.getChannelNames();
155
156
  const channelIndex = channelNames.indexOf(channelSpecifier);
156
157
  if (channelIndex === -1) {
157
- console.error(`Channel ${channelSpecifier} not found in image.`);
158
+ log.error(`Channel ${channelSpecifier} not found in image.`);
158
159
  }
159
160
  return channelIndex;
160
161
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/image-utils",
3
- "version": "3.5.6",
3
+ "version": "3.5.7",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -17,9 +17,10 @@
17
17
  ],
18
18
  "dependencies": {
19
19
  "@hms-dbmi/viv": "~0.16.0",
20
- "@vitessce/types": "3.5.6",
21
- "@vitessce/spatial-utils": "3.5.6",
22
- "@vitessce/utils": "3.5.6"
20
+ "@vitessce/types": "3.5.7",
21
+ "@vitessce/spatial-utils": "3.5.7",
22
+ "@vitessce/utils": "3.5.7",
23
+ "@vitessce/globals": "3.5.7"
23
24
  },
24
25
  "devDependencies": {
25
26
  "vite": "^4.3.0",
@@ -19,7 +19,7 @@ import {
19
19
  isInterleaved as isInterleavedUtil,
20
20
  } from '@vitessce/spatial-utils';
21
21
  import { VIEWER_PALETTE } from '@vitessce/utils';
22
-
22
+ import { log } from '@vitessce/globals';
23
23
  /**
24
24
  * A wrapper around the Viv loader, to provide a common interface for
25
25
  * all image file types.
@@ -260,7 +260,7 @@ export default class ImageWrapper implements AbstractImageWrapper {
260
260
  const channelNames = this.getChannelNames();
261
261
  const channelIndex = channelNames.indexOf(channelSpecifier);
262
262
  if (channelIndex === -1) {
263
- console.error(`Channel ${channelSpecifier} not found in image.`);
263
+ log.error(`Channel ${channelSpecifier} not found in image.`);
264
264
  }
265
265
  return channelIndex;
266
266
  }