@vitessce/ome-tiff 3.2.0 → 3.2.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.
- package/dist/{deflate-3aebf52d.js → deflate-6bc21747.js} +1 -1
- package/dist/{index-738cadd7.js → index-c89b6124.js} +118 -28
- package/dist/index.js +1 -1
- package/dist/{jpeg-48c29005.js → jpeg-2e272217.js} +1 -1
- package/dist/{lerc-1e116f30.js → lerc-3cd543dc.js} +1 -1
- package/dist/{lzw-17a535f6.js → lzw-dc830cdf.js} +1 -1
- package/dist/{packbits-249fe288.js → packbits-a6204131.js} +1 -1
- package/dist/{raw-2d1e8ae3.js → raw-a79aeb3f.js} +1 -1
- package/dist/{webimage-72e835aa.js → webimage-c95937a4.js} +1 -1
- package/package.json +8 -8
|
@@ -103472,16 +103472,16 @@ async function getDecoder(fileDirectory) {
|
|
|
103472
103472
|
const Decoder = await importFn();
|
|
103473
103473
|
return new Decoder(fileDirectory);
|
|
103474
103474
|
}
|
|
103475
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
103476
|
-
addDecoder(5, () => import("./lzw-
|
|
103475
|
+
addDecoder([void 0, 1], () => import("./raw-a79aeb3f.js").then((m) => m.default));
|
|
103476
|
+
addDecoder(5, () => import("./lzw-dc830cdf.js").then((m) => m.default));
|
|
103477
103477
|
addDecoder(6, () => {
|
|
103478
103478
|
throw new Error("old style JPEG compression is not supported.");
|
|
103479
103479
|
});
|
|
103480
|
-
addDecoder(7, () => import("./jpeg-
|
|
103481
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
103482
|
-
addDecoder(32773, () => import("./packbits-
|
|
103483
|
-
addDecoder(34887, () => import("./lerc-
|
|
103484
|
-
addDecoder(50001, () => import("./webimage-
|
|
103480
|
+
addDecoder(7, () => import("./jpeg-2e272217.js").then((m) => m.default));
|
|
103481
|
+
addDecoder([8, 32946], () => import("./deflate-6bc21747.js").then((m) => m.default));
|
|
103482
|
+
addDecoder(32773, () => import("./packbits-a6204131.js").then((m) => m.default));
|
|
103483
|
+
addDecoder(34887, () => import("./lerc-3cd543dc.js").then((m) => m.default));
|
|
103484
|
+
addDecoder(50001, () => import("./webimage-c95937a4.js").then((m) => m.default));
|
|
103485
103485
|
function copyNewSize(array, width, height, samplesPerPixel = 1) {
|
|
103486
103486
|
return new (Object.getPrototypeOf(array)).constructor(width * height * samplesPerPixel);
|
|
103487
103487
|
}
|
|
@@ -115449,6 +115449,67 @@ function makeBoundingBox(viewState) {
|
|
|
115449
115449
|
viewport.unproject([0, viewport.height])
|
|
115450
115450
|
];
|
|
115451
115451
|
}
|
|
115452
|
+
const TARGETS = [1, 2, 3, 4, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1e3];
|
|
115453
|
+
const MIN_TARGET = TARGETS[0];
|
|
115454
|
+
const MAX_TARGET = TARGETS[TARGETS.length - 1];
|
|
115455
|
+
const SI_PREFIXES = [
|
|
115456
|
+
{ symbol: "Y", exponent: 24 },
|
|
115457
|
+
{ symbol: "Z", exponent: 21 },
|
|
115458
|
+
{ symbol: "E", exponent: 18 },
|
|
115459
|
+
{ symbol: "P", exponent: 15 },
|
|
115460
|
+
{ symbol: "T", exponent: 12 },
|
|
115461
|
+
{ symbol: "G", exponent: 9 },
|
|
115462
|
+
{ symbol: "M", exponent: 6 },
|
|
115463
|
+
{ symbol: "k", exponent: 3 },
|
|
115464
|
+
{ symbol: "h", exponent: 2 },
|
|
115465
|
+
{ symbol: "da", exponent: 1 },
|
|
115466
|
+
{ symbol: "", exponent: 0 },
|
|
115467
|
+
{ symbol: "d", exponent: -1 },
|
|
115468
|
+
{ symbol: "c", exponent: -2 },
|
|
115469
|
+
{ symbol: "m", exponent: -3 },
|
|
115470
|
+
{ symbol: "µ", exponent: -6 },
|
|
115471
|
+
{ symbol: "n", exponent: -9 },
|
|
115472
|
+
{ symbol: "p", exponent: -12 },
|
|
115473
|
+
{ symbol: "f", exponent: -15 },
|
|
115474
|
+
{ symbol: "a", exponent: -18 },
|
|
115475
|
+
{ symbol: "z", exponent: -21 },
|
|
115476
|
+
{ symbol: "y", exponent: -24 }
|
|
115477
|
+
];
|
|
115478
|
+
function sizeToMeters(size2, unit2) {
|
|
115479
|
+
if (!unit2 || unit2 === "m") {
|
|
115480
|
+
return size2;
|
|
115481
|
+
}
|
|
115482
|
+
if (unit2.length > 1) {
|
|
115483
|
+
let unitPrefix = unit2.substring(0, unit2.length - 1);
|
|
115484
|
+
if (unitPrefix === "u") {
|
|
115485
|
+
unitPrefix = "µ";
|
|
115486
|
+
}
|
|
115487
|
+
const unitObj = SI_PREFIXES.find((p) => p.symbol === unitPrefix);
|
|
115488
|
+
if (unitObj) {
|
|
115489
|
+
return size2 * 10 ** unitObj.exponent;
|
|
115490
|
+
}
|
|
115491
|
+
}
|
|
115492
|
+
throw new Error("Received unknown unit");
|
|
115493
|
+
}
|
|
115494
|
+
function snapValue(value) {
|
|
115495
|
+
let magnitude = 0;
|
|
115496
|
+
if (value < MIN_TARGET || value > MAX_TARGET) {
|
|
115497
|
+
magnitude = Math.floor(Math.log10(value));
|
|
115498
|
+
}
|
|
115499
|
+
let snappedUnit = SI_PREFIXES.find(
|
|
115500
|
+
(p) => p.exponent % 3 === 0 && p.exponent <= magnitude
|
|
115501
|
+
);
|
|
115502
|
+
let adjustedValue = value / 10 ** snappedUnit.exponent;
|
|
115503
|
+
if (adjustedValue > 500 && adjustedValue <= 1e3) {
|
|
115504
|
+
snappedUnit = SI_PREFIXES.find(
|
|
115505
|
+
(p) => p.exponent % 3 === 0 && p.exponent <= magnitude + 3
|
|
115506
|
+
);
|
|
115507
|
+
adjustedValue = value / 10 ** snappedUnit.exponent;
|
|
115508
|
+
}
|
|
115509
|
+
const targetNewUnits = TARGETS.find((t2) => t2 > adjustedValue);
|
|
115510
|
+
const targetOrigUnits = targetNewUnits * 10 ** snappedUnit.exponent;
|
|
115511
|
+
return [targetOrigUnits, targetNewUnits, snappedUnit.symbol];
|
|
115512
|
+
}
|
|
115452
115513
|
const fs$1$1 = `#define SHADER_NAME xr-layer-fragment-shader
|
|
115453
115514
|
|
|
115454
115515
|
precision highp float;
|
|
@@ -116216,26 +116277,27 @@ const OverviewLayer = class extends CompositeLayer {
|
|
|
116216
116277
|
OverviewLayer.layerName = "OverviewLayer";
|
|
116217
116278
|
OverviewLayer.defaultProps = defaultProps$3;
|
|
116218
116279
|
function getPosition(boundingBox, position, length2) {
|
|
116219
|
-
const
|
|
116280
|
+
const viewWidth = boundingBox[2][0] - boundingBox[0][0];
|
|
116281
|
+
const viewHeight = boundingBox[2][1] - boundingBox[0][1];
|
|
116220
116282
|
switch (position) {
|
|
116221
116283
|
case "bottom-right": {
|
|
116222
|
-
const yCoord = boundingBox[2][1] -
|
|
116223
|
-
const xLeftCoord = boundingBox[2][0] -
|
|
116284
|
+
const yCoord = boundingBox[2][1] - viewHeight * length2;
|
|
116285
|
+
const xLeftCoord = boundingBox[2][0] - viewWidth * length2;
|
|
116224
116286
|
return [yCoord, xLeftCoord];
|
|
116225
116287
|
}
|
|
116226
116288
|
case "top-right": {
|
|
116227
|
-
const yCoord =
|
|
116228
|
-
const xLeftCoord = boundingBox[2][0] -
|
|
116289
|
+
const yCoord = boundingBox[0][1] + viewHeight * length2;
|
|
116290
|
+
const xLeftCoord = boundingBox[2][0] - viewWidth * length2;
|
|
116229
116291
|
return [yCoord, xLeftCoord];
|
|
116230
116292
|
}
|
|
116231
116293
|
case "top-left": {
|
|
116232
|
-
const yCoord =
|
|
116233
|
-
const xLeftCoord =
|
|
116294
|
+
const yCoord = boundingBox[0][1] + viewHeight * length2;
|
|
116295
|
+
const xLeftCoord = boundingBox[0][0] + viewWidth * length2;
|
|
116234
116296
|
return [yCoord, xLeftCoord];
|
|
116235
116297
|
}
|
|
116236
116298
|
case "bottom-left": {
|
|
116237
|
-
const yCoord = boundingBox[2][1] -
|
|
116238
|
-
const xLeftCoord =
|
|
116299
|
+
const yCoord = boundingBox[2][1] - viewHeight * length2;
|
|
116300
|
+
const xLeftCoord = boundingBox[0][0] + viewWidth * length2;
|
|
116239
116301
|
return [yCoord, xLeftCoord];
|
|
116240
116302
|
}
|
|
116241
116303
|
default: {
|
|
@@ -116253,11 +116315,12 @@ const defaultProps$2 = {
|
|
|
116253
116315
|
unit: { type: "string", value: "", compare: true },
|
|
116254
116316
|
size: { type: "number", value: 1, compare: true },
|
|
116255
116317
|
position: { type: "string", value: "bottom-right", compare: true },
|
|
116256
|
-
length: { type: "number", value: 0.085, compare: true }
|
|
116318
|
+
length: { type: "number", value: 0.085, compare: true },
|
|
116319
|
+
snap: { type: "boolean", value: false, compare: true }
|
|
116257
116320
|
};
|
|
116258
116321
|
const ScaleBarLayer = class extends CompositeLayer {
|
|
116259
116322
|
renderLayers() {
|
|
116260
|
-
const { id, unit: unit2, size: size2, position, viewState, length: length2 } = this.props;
|
|
116323
|
+
const { id, unit: unit2, size: size2, position, viewState, length: length2, snap } = this.props;
|
|
116261
116324
|
const boundingBox = makeBoundingBox(viewState);
|
|
116262
116325
|
const { zoom } = viewState;
|
|
116263
116326
|
const viewLength = boundingBox[2][0] - boundingBox[0][0];
|
|
@@ -116266,15 +116329,27 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
116266
116329
|
2 ** (-zoom + 1.5),
|
|
116267
116330
|
(boundingBox[2][1] - boundingBox[0][1]) * 7e-3
|
|
116268
116331
|
);
|
|
116269
|
-
|
|
116332
|
+
let adjustedBarLength = barLength;
|
|
116333
|
+
let displayNumber = (barLength * size2).toPrecision(5);
|
|
116334
|
+
let displayUnit = unit2;
|
|
116335
|
+
if (snap) {
|
|
116336
|
+
const meterSize = sizeToMeters(size2, unit2);
|
|
116337
|
+
const numUnits = barLength * meterSize;
|
|
116338
|
+
const [snappedOrigUnits, snappedNewUnits, snappedUnitPrefix] = snapValue(numUnits);
|
|
116339
|
+
adjustedBarLength = snappedOrigUnits / meterSize;
|
|
116340
|
+
displayNumber = snappedNewUnits;
|
|
116341
|
+
displayUnit = `${snappedUnitPrefix}m`;
|
|
116342
|
+
}
|
|
116270
116343
|
const [yCoord, xLeftCoord] = getPosition(boundingBox, position, length2);
|
|
116344
|
+
const xRightCoord = xLeftCoord + barLength;
|
|
116345
|
+
const isLeft = position.endsWith("-left");
|
|
116271
116346
|
const lengthBar = new LineLayer({
|
|
116272
116347
|
id: `scale-bar-length-${id}`,
|
|
116273
116348
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
116274
116349
|
data: [
|
|
116275
116350
|
[
|
|
116276
|
-
[xLeftCoord, yCoord],
|
|
116277
|
-
[xLeftCoord +
|
|
116351
|
+
[isLeft ? xLeftCoord : xRightCoord - adjustedBarLength, yCoord],
|
|
116352
|
+
[isLeft ? xLeftCoord + adjustedBarLength : xRightCoord, yCoord]
|
|
116278
116353
|
]
|
|
116279
116354
|
],
|
|
116280
116355
|
getSourcePosition: (d) => d[0],
|
|
@@ -116287,8 +116362,14 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
116287
116362
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
116288
116363
|
data: [
|
|
116289
116364
|
[
|
|
116290
|
-
[
|
|
116291
|
-
|
|
116365
|
+
[
|
|
116366
|
+
isLeft ? xLeftCoord : xRightCoord - adjustedBarLength,
|
|
116367
|
+
yCoord - barHeight
|
|
116368
|
+
],
|
|
116369
|
+
[
|
|
116370
|
+
isLeft ? xLeftCoord : xRightCoord - adjustedBarLength,
|
|
116371
|
+
yCoord + barHeight
|
|
116372
|
+
]
|
|
116292
116373
|
]
|
|
116293
116374
|
],
|
|
116294
116375
|
getSourcePosition: (d) => d[0],
|
|
@@ -116301,8 +116382,14 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
116301
116382
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
116302
116383
|
data: [
|
|
116303
116384
|
[
|
|
116304
|
-
[
|
|
116305
|
-
|
|
116385
|
+
[
|
|
116386
|
+
isLeft ? xLeftCoord + adjustedBarLength : xRightCoord,
|
|
116387
|
+
yCoord - barHeight
|
|
116388
|
+
],
|
|
116389
|
+
[
|
|
116390
|
+
isLeft ? xLeftCoord + adjustedBarLength : xRightCoord,
|
|
116391
|
+
yCoord + barHeight
|
|
116392
|
+
]
|
|
116306
116393
|
]
|
|
116307
116394
|
],
|
|
116308
116395
|
getSourcePosition: (d) => d[0],
|
|
@@ -116315,8 +116402,11 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
116315
116402
|
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
116316
116403
|
data: [
|
|
116317
116404
|
{
|
|
116318
|
-
text:
|
|
116319
|
-
position: [
|
|
116405
|
+
text: `${displayNumber}${displayUnit}`,
|
|
116406
|
+
position: [
|
|
116407
|
+
isLeft ? xLeftCoord + barLength * 0.5 : xRightCoord - barLength * 0.5,
|
|
116408
|
+
yCoord + barHeight * 4
|
|
116409
|
+
]
|
|
116320
116410
|
}
|
|
116321
116411
|
],
|
|
116322
116412
|
getColor: [220, 220, 220, 255],
|
|
@@ -116325,7 +116415,7 @@ const ScaleBarLayer = class extends CompositeLayer {
|
|
|
116325
116415
|
sizeUnits: "meters",
|
|
116326
116416
|
sizeScale: 2 ** -zoom,
|
|
116327
116417
|
characterSet: [
|
|
116328
|
-
...
|
|
116418
|
+
...displayUnit.split(""),
|
|
116329
116419
|
...range$3(10).map((i2) => String(i2)),
|
|
116330
116420
|
".",
|
|
116331
116421
|
"e",
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as inflate_1 } from "./pako.esm-68f84e2a.js";
|
|
2
|
-
import { g as getDefaultExportFromCjs, B as BaseDecoder, L as LercParameters, a as LercAddCompression } from "./index-
|
|
2
|
+
import { g as getDefaultExportFromCjs, B as BaseDecoder, L as LercParameters, a as LercAddCompression } from "./index-c89b6124.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "@vitessce/vit-s";
|
|
5
5
|
var LercDecode = { exports: {} };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/ome-tiff",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"author": "Gehlenborg Lab",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"ajv": "^6.10.0",
|
|
20
20
|
"d3-array": "^2.4.0",
|
|
21
21
|
"lodash-es": "^4.17.21",
|
|
22
|
-
"@vitessce/constants-internal": "3.2.
|
|
23
|
-
"@vitessce/gl": "3.2.
|
|
24
|
-
"@vitessce/sets-utils": "3.2.
|
|
25
|
-
"@vitessce/spatial-utils": "3.2.
|
|
26
|
-
"@vitessce/image-utils": "3.2.
|
|
27
|
-
"@vitessce/utils": "3.2.
|
|
28
|
-
"@vitessce/vit-s": "3.2.
|
|
22
|
+
"@vitessce/constants-internal": "3.2.2",
|
|
23
|
+
"@vitessce/gl": "3.2.2",
|
|
24
|
+
"@vitessce/sets-utils": "3.2.2",
|
|
25
|
+
"@vitessce/spatial-utils": "3.2.2",
|
|
26
|
+
"@vitessce/image-utils": "3.2.2",
|
|
27
|
+
"@vitessce/utils": "3.2.2",
|
|
28
|
+
"@vitessce/vit-s": "3.2.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"ajv": "^6.10.0"
|