@vitessce/ome-tiff 4.1.0 → 4.1.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-SxljTded.js";
2
- import { B as BaseDecoder } from "./index-Ce6N3KSx.js";
2
+ import { B as BaseDecoder } from "./index-CxWrGpBK.js";
3
3
  class DeflateDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
5
5
  return inflate_1(new Uint8Array(buffer)).buffer;
@@ -103098,22 +103098,22 @@ async function getDecoder(fileDirectory) {
103098
103098
  const Decoder = await importFn();
103099
103099
  return new Decoder(fileDirectory);
103100
103100
  }
103101
- addDecoder([void 0, 1], () => import("./raw-CbPBCrOb.js").then((m) => m.default));
103102
- addDecoder(5, () => import("./lzw-C8NSAPvb.js").then((m) => m.default));
103101
+ addDecoder([void 0, 1], () => import("./raw-CFuXPBQ-.js").then((m) => m.default));
103102
+ addDecoder(5, () => import("./lzw-BlIEzezi.js").then((m) => m.default));
103103
103103
  addDecoder(6, () => {
103104
103104
  throw new Error("old style JPEG compression is not supported.");
103105
103105
  });
103106
- addDecoder(7, () => import("./jpeg-DQ-CazxZ.js").then((m) => m.default));
103107
- addDecoder([8, 32946], () => import("./deflate-CIM-SNpP.js").then((m) => m.default));
103108
- addDecoder(32773, () => import("./packbits-BZYNl97h.js").then((m) => m.default));
103106
+ addDecoder(7, () => import("./jpeg-YBDlVz38.js").then((m) => m.default));
103107
+ addDecoder([8, 32946], () => import("./deflate-C9HwIrcb.js").then((m) => m.default));
103108
+ addDecoder(32773, () => import("./packbits-Cr2rKApx.js").then((m) => m.default));
103109
103109
  addDecoder(
103110
103110
  34887,
103111
- () => import("./lerc-BT_hx9Kh.js").then(async (m) => {
103111
+ () => import("./lerc-C0p05xOO.js").then(async (m) => {
103112
103112
  await m.zstd.init();
103113
103113
  return m;
103114
103114
  }).then((m) => m.default)
103115
103115
  );
103116
- addDecoder(50001, () => import("./webimage-CsiyTZBP.js").then((m) => m.default));
103116
+ addDecoder(50001, () => import("./webimage-Bj4f2wJc.js").then((m) => m.default));
103117
103117
  function copyNewSize(array, width, height, samplesPerPixel = 1) {
103118
103118
  return new (Object.getPrototypeOf(array)).constructor(width * height * samplesPerPixel);
103119
103119
  }
@@ -140851,6 +140851,19 @@ const VIEWER_PALETTE = [
140851
140851
  [255, 128, 0],
140852
140852
  [255, 0, 0]
140853
140853
  ];
140854
+ const UNIT_TO_METERS = {
140855
+ m: 1,
140856
+ meter: 1,
140857
+ mm: 1e-3,
140858
+ millimeter: 1e-3,
140859
+ um: 1e-6,
140860
+ µm: 1e-6,
140861
+ μm: 1e-6,
140862
+ micrometer: 1e-6,
140863
+ micron: 1e-6,
140864
+ nm: 1e-9,
140865
+ nanometer: 1e-9
140866
+ };
140854
140867
  function filterSelection(loader, selection) {
140855
140868
  if (!selection) {
140856
140869
  return selection;
@@ -141642,6 +141655,17 @@ class ImageWrapper {
141642
141655
  const { labels, shape } = Array.isArray(loader.data) ? loader.data[0] : loader.data;
141643
141656
  return shape[labels.indexOf("z")];
141644
141657
  }
141658
+ /**
141659
+ * Clamp a z target to a valid plane index.
141660
+ * spatialTargetZ can hold a 3D camera target in scene units, which may
141661
+ * exceed the number of planes; geotiff throws on out-of-range indices.
141662
+ */
141663
+ getClampedZIndex(targetZ) {
141664
+ const numZ = this.getNumZ();
141665
+ if (!Number.isFinite(numZ) || !Number.isFinite(targetZ))
141666
+ return 0;
141667
+ return Math.min(Math.max(Math.floor(targetZ), 0), numZ - 1);
141668
+ }
141645
141669
  getNumT() {
141646
141670
  const loader = this.vivLoader;
141647
141671
  const { labels, shape } = Array.isArray(loader.data) ? loader.data[0] : loader.data;
@@ -141742,6 +141766,27 @@ class ImageWrapper {
141742
141766
  }
141743
141767
  return "BlackIsZero";
141744
141768
  }
141769
+ /**
141770
+ * Meters per 3D scene unit, i.e. the unit of getModelMatrix().
141771
+ * OME-TIFF: physicalSizeToMatrix divides by 1 um, so the scene is in µm
141772
+ * (only when physical sizes exist; otherwise pixels, unit unknown → null).
141773
+ * OME-Zarr: the model matrix is in the units of the NGFF axes.
141774
+ */
141775
+ getSceneMetersPerUnit() {
141776
+ const { metadata } = this.vivLoader;
141777
+ if (!metadata)
141778
+ return null;
141779
+ if ("Pixels" in metadata) {
141780
+ return this.hasPhysicalSize() ? 1e-6 : null;
141781
+ }
141782
+ if ("multiscales" in metadata) {
141783
+ const axes = metadata.multiscales?.[0]?.axes ?? [];
141784
+ const xAxis = axes.find((a2) => (typeof a2 === "string" ? a2 : a2?.name) === "x");
141785
+ const unit2 = typeof xAxis === "object" ? xAxis?.unit : null;
141786
+ return unit2 ? UNIT_TO_METERS[unit2.normalize("NFKC")] ?? null : null;
141787
+ }
141788
+ return null;
141789
+ }
141745
141790
  }
141746
141791
  class LoaderResult {
141747
141792
  /**
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c, b, O } from "./index-Ce6N3KSx.js";
1
+ import { c, b, O } from "./index-CxWrGpBK.js";
2
2
  export {
3
3
  c as OmeTiffAsObsSegmentationsLoader,
4
4
  b as OmeTiffLoader,
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-Ce6N3KSx.js";
1
+ import { B as BaseDecoder } from "./index-CxWrGpBK.js";
2
2
  const dctZigZag = new Int32Array([
3
3
  0,
4
4
  1,
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-SxljTded.js";
2
- import { g as getDefaultExportFromCjs, B as BaseDecoder, L as LercParameters, a as LercAddCompression } from "./index-Ce6N3KSx.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder, L as LercParameters, a as LercAddCompression } from "./index-CxWrGpBK.js";
3
3
  var LercDecode = { exports: {} };
4
4
  var hasRequiredLercDecode;
5
5
  function requireLercDecode() {
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-Ce6N3KSx.js";
1
+ import { B as BaseDecoder } from "./index-CxWrGpBK.js";
2
2
  const MIN_BITS = 9;
3
3
  const CLEAR_CODE = 256;
4
4
  const EOI_CODE = 257;
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-Ce6N3KSx.js";
1
+ import { B as BaseDecoder } from "./index-CxWrGpBK.js";
2
2
  class PackbitsDecoder extends BaseDecoder {
3
3
  decodeBlock(buffer) {
4
4
  const dataView = new DataView(buffer);
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-Ce6N3KSx.js";
1
+ import { B as BaseDecoder } from "./index-CxWrGpBK.js";
2
2
  class RawDecoder extends BaseDecoder {
3
3
  decodeBlock(buffer) {
4
4
  return buffer;
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-Ce6N3KSx.js";
1
+ import { B as BaseDecoder } from "./index-CxWrGpBK.js";
2
2
  class WebImageDecoder extends BaseDecoder {
3
3
  constructor() {
4
4
  super();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/ome-tiff",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -18,16 +18,16 @@
18
18
  "dependencies": {
19
19
  "d3-array": "^2.4.0",
20
20
  "lodash-es": "^4.17.21",
21
- "@vitessce/globals": "4.1.0",
22
- "@vitessce/abstract": "4.1.0",
23
- "@vitessce/constants-internal": "4.1.0",
24
- "@vitessce/error": "4.1.0",
25
- "@vitessce/config": "4.1.0",
26
- "@vitessce/gl": "4.1.0",
27
- "@vitessce/sets-utils": "4.1.0",
28
- "@vitessce/utils": "4.1.0",
29
- "@vitessce/image-utils": "4.1.0",
30
- "@vitessce/spatial-utils": "4.1.0"
21
+ "@vitessce/globals": "4.1.2",
22
+ "@vitessce/constants-internal": "4.1.2",
23
+ "@vitessce/error": "4.1.2",
24
+ "@vitessce/abstract": "4.1.2",
25
+ "@vitessce/config": "4.1.2",
26
+ "@vitessce/sets-utils": "4.1.2",
27
+ "@vitessce/gl": "4.1.2",
28
+ "@vitessce/spatial-utils": "4.1.2",
29
+ "@vitessce/image-utils": "4.1.2",
30
+ "@vitessce/utils": "4.1.2"
31
31
  },
32
32
  "scripts": {
33
33
  "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.mjs",