@vitessce/spatial-utils 3.4.8 → 3.4.10
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-f1fb5f5f.js → deflate-32efdab2.js} +1 -1
- package/dist/{index-99145749.js → index-a7bb8a96.js} +162 -159
- package/dist/index.js +1 -1
- package/dist/{jpeg-43f7eb3d.js → jpeg-ddaf8c90.js} +1 -1
- package/dist/{lerc-f6703f92.js → lerc-436605d8.js} +1 -1
- package/dist/{lzw-3ea2d511.js → lzw-0caa4868.js} +1 -1
- package/dist/{packbits-bb194562.js → packbits-a5fbf85a.js} +1 -1
- package/dist/{raw-072bb393.js → raw-9ca04826.js} +1 -1
- package/dist/{webimage-50d4efbc.js → webimage-c0a22c4e.js} +1 -1
- package/dist-tsc/spatial.d.ts.map +1 -1
- package/dist-tsc/spatial.js +4 -1
- package/package.json +5 -5
- package/src/spatial.js +4 -1
|
@@ -22,7 +22,7 @@ var __privateSet = (obj, member, value, setter2) => {
|
|
|
22
22
|
setter2 ? setter2.call(obj, value) : member.set(obj, value);
|
|
23
23
|
return value;
|
|
24
24
|
};
|
|
25
|
-
var _bytes, _encoder, _data,
|
|
25
|
+
var _bytes, _encoder, _data, _strides, _TypedArray, _BYTES_PER_ELEMENT, _shape, _endian, _encoder_config, _decoder_config, _shape2, _strides2, _metadata, _metadata2, _a2, _b;
|
|
26
26
|
import "react";
|
|
27
27
|
function _mergeNamespaces(n3, m) {
|
|
28
28
|
for (var i2 = 0; i2 < m.length; i2++) {
|
|
@@ -119229,16 +119229,16 @@ function addDecoder(cases, importFn) {
|
|
|
119229
119229
|
}
|
|
119230
119230
|
cases.forEach((c) => registry$2.set(c, importFn));
|
|
119231
119231
|
}
|
|
119232
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
119233
|
-
addDecoder(5, () => import("./lzw-
|
|
119232
|
+
addDecoder([void 0, 1], () => import("./raw-9ca04826.js").then((m) => m.default));
|
|
119233
|
+
addDecoder(5, () => import("./lzw-0caa4868.js").then((m) => m.default));
|
|
119234
119234
|
addDecoder(6, () => {
|
|
119235
119235
|
throw new Error("old style JPEG compression is not supported.");
|
|
119236
119236
|
});
|
|
119237
|
-
addDecoder(7, () => import("./jpeg-
|
|
119238
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
119239
|
-
addDecoder(32773, () => import("./packbits-
|
|
119240
|
-
addDecoder(34887, () => import("./lerc-
|
|
119241
|
-
addDecoder(50001, () => import("./webimage-
|
|
119237
|
+
addDecoder(7, () => import("./jpeg-ddaf8c90.js").then((m) => m.default));
|
|
119238
|
+
addDecoder([8, 32946], () => import("./deflate-32efdab2.js").then((m) => m.default));
|
|
119239
|
+
addDecoder(32773, () => import("./packbits-a5fbf85a.js").then((m) => m.default));
|
|
119240
|
+
addDecoder(34887, () => import("./lerc-436605d8.js").then((m) => m.default));
|
|
119241
|
+
addDecoder(50001, () => import("./webimage-c0a22c4e.js").then((m) => m.default));
|
|
119242
119242
|
function decodeRowAcc(row, stride) {
|
|
119243
119243
|
let length2 = row.length - stride;
|
|
119244
119244
|
let offset = 0;
|
|
@@ -133983,7 +133983,7 @@ function normalizeCoordinateTransformations(coordinateTransformations, datasets)
|
|
|
133983
133983
|
var _a3;
|
|
133984
133984
|
let result = [];
|
|
133985
133985
|
if (Array.isArray(coordinateTransformations)) {
|
|
133986
|
-
result = coordinateTransformations.
|
|
133986
|
+
result = coordinateTransformations.flatMap((transform2) => {
|
|
133987
133987
|
if (transform2.input && transform2.output) {
|
|
133988
133988
|
const { type: type2 } = transform2;
|
|
133989
133989
|
if (type2 === "translation") {
|
|
@@ -134001,6 +134001,9 @@ function normalizeCoordinateTransformations(coordinateTransformations, datasets)
|
|
|
134001
134001
|
if (type2 === "identity") {
|
|
134002
134002
|
return { type: type2 };
|
|
134003
134003
|
}
|
|
134004
|
+
if (type2 === "sequence") {
|
|
134005
|
+
return normalizeCoordinateTransformations(transform2.transformations, datasets);
|
|
134006
|
+
}
|
|
134004
134007
|
console.warn(`Coordinate transformation type "${type2}" is not supported.`);
|
|
134005
134008
|
}
|
|
134006
134009
|
return transform2;
|
|
@@ -134135,7 +134138,6 @@ const _UnicodeStringArray = class {
|
|
|
134135
134138
|
constructor(chars, x2, byteOffset, length2) {
|
|
134136
134139
|
__privateAdd(this, _data, void 0);
|
|
134137
134140
|
__publicField(this, "chars");
|
|
134138
|
-
__privateAdd(this, _encode_buffer, void 0);
|
|
134139
134141
|
this.chars = chars;
|
|
134140
134142
|
if (typeof x2 === "number") {
|
|
134141
134143
|
__privateSet(this, _data, new Int32Array(x2 * chars));
|
|
@@ -134153,7 +134155,6 @@ const _UnicodeStringArray = class {
|
|
|
134153
134155
|
}
|
|
134154
134156
|
}()));
|
|
134155
134157
|
}
|
|
134156
|
-
__privateSet(this, _encode_buffer, new Int32Array(chars));
|
|
134157
134158
|
}
|
|
134158
134159
|
get BYTES_PER_ELEMENT() {
|
|
134159
134160
|
return __privateGet(this, _data).BYTES_PER_ELEMENT * this.chars;
|
|
@@ -134203,7 +134204,6 @@ const _UnicodeStringArray = class {
|
|
|
134203
134204
|
};
|
|
134204
134205
|
let UnicodeStringArray = _UnicodeStringArray;
|
|
134205
134206
|
_data = new WeakMap();
|
|
134206
|
-
_encode_buffer = new WeakMap();
|
|
134207
134207
|
function json_decode_object(bytes) {
|
|
134208
134208
|
const str = new TextDecoder().decode(bytes);
|
|
134209
134209
|
return JSON.parse(str);
|
|
@@ -134272,10 +134272,12 @@ function col_major_stride(shape) {
|
|
|
134272
134272
|
}
|
|
134273
134273
|
function create_chunk_key_encoder({ name: name2, configuration }) {
|
|
134274
134274
|
if (name2 === "default") {
|
|
134275
|
-
|
|
134275
|
+
const separator = (configuration == null ? void 0 : configuration.separator) ?? "/";
|
|
134276
|
+
return (chunk_coords) => ["c", ...chunk_coords].join(separator);
|
|
134276
134277
|
}
|
|
134277
134278
|
if (name2 === "v2") {
|
|
134278
|
-
|
|
134279
|
+
const separator = (configuration == null ? void 0 : configuration.separator) ?? ".";
|
|
134280
|
+
return (chunk_coords) => chunk_coords.join(separator) || "0";
|
|
134279
134281
|
}
|
|
134280
134282
|
throw new Error(`Unknown chunk key encoding: ${name2}`);
|
|
134281
134283
|
}
|
|
@@ -134295,17 +134297,17 @@ function coerce_dtype(dtype) {
|
|
|
134295
134297
|
}
|
|
134296
134298
|
let [, endian, rest] = match;
|
|
134297
134299
|
let data_type = {
|
|
134298
|
-
|
|
134299
|
-
|
|
134300
|
-
|
|
134301
|
-
|
|
134302
|
-
|
|
134303
|
-
|
|
134304
|
-
|
|
134305
|
-
|
|
134306
|
-
|
|
134307
|
-
|
|
134308
|
-
|
|
134300
|
+
b1: "bool",
|
|
134301
|
+
i1: "int8",
|
|
134302
|
+
u1: "uint8",
|
|
134303
|
+
i2: "int16",
|
|
134304
|
+
u2: "uint16",
|
|
134305
|
+
i4: "int32",
|
|
134306
|
+
u4: "uint32",
|
|
134307
|
+
i8: "int64",
|
|
134308
|
+
u8: "uint64",
|
|
134309
|
+
f4: "float32",
|
|
134310
|
+
f8: "float64"
|
|
134309
134311
|
}[rest] ?? (rest.startsWith("S") || rest.startsWith("U") ? `v2:${rest}` : void 0);
|
|
134310
134312
|
if (!data_type) {
|
|
134311
134313
|
throw new Error(`Unsupported or unknown dtype: ${dtype}`);
|
|
@@ -134382,93 +134384,11 @@ function is_sharding_codec(codec) {
|
|
|
134382
134384
|
return (codec == null ? void 0 : codec.name) === "sharding_indexed";
|
|
134383
134385
|
}
|
|
134384
134386
|
function ensure_correct_scalar(metadata) {
|
|
134385
|
-
if ((metadata.data_type === "uint64" || metadata.data_type === "int64") && metadata.fill_value !=
|
|
134387
|
+
if ((metadata.data_type === "uint64" || metadata.data_type === "int64") && metadata.fill_value != null) {
|
|
134386
134388
|
return BigInt(metadata.fill_value);
|
|
134387
134389
|
}
|
|
134388
134390
|
return metadata.fill_value;
|
|
134389
134391
|
}
|
|
134390
|
-
function proxy(arr) {
|
|
134391
|
-
if (arr instanceof BoolArray || arr instanceof ByteStringArray || arr instanceof UnicodeStringArray) {
|
|
134392
|
-
return new Proxy(arr, {
|
|
134393
|
-
get(target, prop) {
|
|
134394
|
-
return target.get(Number(prop));
|
|
134395
|
-
},
|
|
134396
|
-
set(target, prop, value) {
|
|
134397
|
-
target.set(Number(prop), value);
|
|
134398
|
-
return true;
|
|
134399
|
-
}
|
|
134400
|
-
});
|
|
134401
|
-
}
|
|
134402
|
-
return arr;
|
|
134403
|
-
}
|
|
134404
|
-
function empty_like(chunk, order) {
|
|
134405
|
-
let data;
|
|
134406
|
-
if (chunk.data instanceof ByteStringArray || chunk.data instanceof UnicodeStringArray) {
|
|
134407
|
-
data = new chunk.constructor(
|
|
134408
|
-
// @ts-expect-error
|
|
134409
|
-
chunk.data.length,
|
|
134410
|
-
chunk.data.chars
|
|
134411
|
-
);
|
|
134412
|
-
} else {
|
|
134413
|
-
data = new chunk.constructor(chunk.data.length);
|
|
134414
|
-
}
|
|
134415
|
-
return {
|
|
134416
|
-
data,
|
|
134417
|
-
shape: chunk.shape,
|
|
134418
|
-
stride: get_strides(chunk.shape, order)
|
|
134419
|
-
};
|
|
134420
|
-
}
|
|
134421
|
-
function convert_array_order(src, target) {
|
|
134422
|
-
let out = empty_like(src, target);
|
|
134423
|
-
let n_dims = src.shape.length;
|
|
134424
|
-
let size2 = src.data.length;
|
|
134425
|
-
let index2 = Array(n_dims).fill(0);
|
|
134426
|
-
let src_data = proxy(src.data);
|
|
134427
|
-
let out_data = proxy(out.data);
|
|
134428
|
-
for (let src_idx = 0; src_idx < size2; src_idx++) {
|
|
134429
|
-
let out_idx = 0;
|
|
134430
|
-
for (let dim = 0; dim < n_dims; dim++) {
|
|
134431
|
-
out_idx += index2[dim] * out.stride[dim];
|
|
134432
|
-
}
|
|
134433
|
-
out_data[out_idx] = src_data[src_idx];
|
|
134434
|
-
index2[0] += 1;
|
|
134435
|
-
for (let dim = 0; dim < n_dims; dim++) {
|
|
134436
|
-
if (index2[dim] === src.shape[dim]) {
|
|
134437
|
-
if (dim + 1 === n_dims) {
|
|
134438
|
-
break;
|
|
134439
|
-
}
|
|
134440
|
-
index2[dim] = 0;
|
|
134441
|
-
index2[dim + 1] += 1;
|
|
134442
|
-
}
|
|
134443
|
-
}
|
|
134444
|
-
}
|
|
134445
|
-
return out;
|
|
134446
|
-
}
|
|
134447
|
-
function get_order(arr) {
|
|
134448
|
-
if (!arr.stride)
|
|
134449
|
-
return "C";
|
|
134450
|
-
let row_major_strides = get_strides(arr.shape, "C");
|
|
134451
|
-
return arr.stride.every((s2, i2) => s2 === row_major_strides[i2]) ? "C" : "F";
|
|
134452
|
-
}
|
|
134453
|
-
class TransposeCodec {
|
|
134454
|
-
constructor(configuration) {
|
|
134455
|
-
__publicField(this, "configuration");
|
|
134456
|
-
__publicField(this, "kind", "array_to_array");
|
|
134457
|
-
this.configuration = configuration;
|
|
134458
|
-
}
|
|
134459
|
-
static fromConfig(configuration) {
|
|
134460
|
-
return new TransposeCodec(configuration);
|
|
134461
|
-
}
|
|
134462
|
-
encode(arr) {
|
|
134463
|
-
if (get_order(arr) === this.configuration.order) {
|
|
134464
|
-
return arr;
|
|
134465
|
-
}
|
|
134466
|
-
return convert_array_order(arr, this.configuration.order);
|
|
134467
|
-
}
|
|
134468
|
-
decode(arr) {
|
|
134469
|
-
return arr;
|
|
134470
|
-
}
|
|
134471
|
-
}
|
|
134472
134392
|
const LITTLE_ENDIAN_OS = system_is_little_endian();
|
|
134473
134393
|
function system_is_little_endian() {
|
|
134474
134394
|
const a2 = new Uint32Array([305419896]);
|
|
@@ -134489,7 +134409,7 @@ const _BytesCodec = class {
|
|
|
134489
134409
|
__privateAdd(this, _BYTES_PER_ELEMENT, void 0);
|
|
134490
134410
|
__privateAdd(this, _shape, void 0);
|
|
134491
134411
|
__privateAdd(this, _endian, void 0);
|
|
134492
|
-
__privateSet(this, _endian, configuration.endian);
|
|
134412
|
+
__privateSet(this, _endian, configuration == null ? void 0 : configuration.endian);
|
|
134493
134413
|
__privateSet(this, _TypedArray, get_ctr(meta2.data_type));
|
|
134494
134414
|
__privateSet(this, _shape, meta2.shape);
|
|
134495
134415
|
__privateSet(this, _strides, get_strides(meta2.shape, get_array_order(meta2.codecs)));
|
|
@@ -134537,57 +134457,26 @@ class Crc32cCodec {
|
|
|
134537
134457
|
return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength - 4);
|
|
134538
134458
|
}
|
|
134539
134459
|
}
|
|
134540
|
-
const _VLenUTF8 = class {
|
|
134541
|
-
constructor(shape) {
|
|
134542
|
-
__publicField(this, "kind", "array_to_bytes");
|
|
134543
|
-
__privateAdd(this, _shape2, void 0);
|
|
134544
|
-
__privateAdd(this, _strides2, void 0);
|
|
134545
|
-
__privateSet(this, _shape2, shape);
|
|
134546
|
-
__privateSet(this, _strides2, get_strides(shape, "C"));
|
|
134547
|
-
}
|
|
134548
|
-
static fromConfig(_, meta2) {
|
|
134549
|
-
return new _VLenUTF8(meta2.shape);
|
|
134550
|
-
}
|
|
134551
|
-
encode(_chunk) {
|
|
134552
|
-
throw new Error("Method not implemented.");
|
|
134553
|
-
}
|
|
134554
|
-
decode(bytes) {
|
|
134555
|
-
let decoder = new TextDecoder();
|
|
134556
|
-
let view = new DataView(bytes.buffer);
|
|
134557
|
-
let data = Array(view.getUint32(0, true));
|
|
134558
|
-
let pos = 4;
|
|
134559
|
-
for (let i2 = 0; i2 < data.length; i2++) {
|
|
134560
|
-
let item_length = view.getUint32(pos, true);
|
|
134561
|
-
pos += 4;
|
|
134562
|
-
data[i2] = decoder.decode(bytes.buffer.slice(pos, pos + item_length));
|
|
134563
|
-
pos += item_length;
|
|
134564
|
-
}
|
|
134565
|
-
return { data, shape: __privateGet(this, _shape2), stride: __privateGet(this, _strides2) };
|
|
134566
|
-
}
|
|
134567
|
-
};
|
|
134568
|
-
let VLenUTF8 = _VLenUTF8;
|
|
134569
|
-
_shape2 = new WeakMap();
|
|
134570
|
-
_strides2 = new WeakMap();
|
|
134571
134460
|
function throw_on_nan_replacer(_key, value) {
|
|
134572
|
-
if (value
|
|
134461
|
+
if (Number.isNaN(value)) {
|
|
134573
134462
|
throw new Error("JsonCodec allow_nan is false but NaN was encountered during encoding.");
|
|
134574
134463
|
}
|
|
134575
|
-
if (value ===
|
|
134464
|
+
if (value === Number.POSITIVE_INFINITY) {
|
|
134576
134465
|
throw new Error("JsonCodec allow_nan is false but Infinity was encountered during encoding.");
|
|
134577
134466
|
}
|
|
134578
|
-
if (value ===
|
|
134467
|
+
if (value === Number.NEGATIVE_INFINITY) {
|
|
134579
134468
|
throw new Error("JsonCodec allow_nan is false but -Infinity was encountered during encoding.");
|
|
134580
134469
|
}
|
|
134581
134470
|
return value;
|
|
134582
134471
|
}
|
|
134583
134472
|
function sort_keys_replacer(_key, value) {
|
|
134584
|
-
return value instanceof Object && !(value
|
|
134473
|
+
return value instanceof Object && !Array.isArray(value) ? Object.keys(value).sort().reduce((sorted, key) => {
|
|
134585
134474
|
sorted[key] = value[key];
|
|
134586
134475
|
return sorted;
|
|
134587
134476
|
}, {}) : value;
|
|
134588
134477
|
}
|
|
134589
134478
|
const _JsonCodec = class {
|
|
134590
|
-
constructor(configuration) {
|
|
134479
|
+
constructor(configuration = {}) {
|
|
134591
134480
|
__publicField(this, "configuration");
|
|
134592
134481
|
__publicField(this, "kind", "array_to_bytes");
|
|
134593
134482
|
__privateAdd(this, _encoder_config, void 0);
|
|
@@ -134637,20 +134526,20 @@ const _JsonCodec = class {
|
|
|
134637
134526
|
items.push(buf.shape);
|
|
134638
134527
|
let replacer = void 0;
|
|
134639
134528
|
if (replacer_functions.length) {
|
|
134640
|
-
replacer =
|
|
134529
|
+
replacer = (key, value) => {
|
|
134641
134530
|
let new_value = value;
|
|
134642
|
-
|
|
134531
|
+
for (let sub_replacer of replacer_functions) {
|
|
134643
134532
|
new_value = sub_replacer(key, new_value);
|
|
134644
|
-
}
|
|
134533
|
+
}
|
|
134645
134534
|
return new_value;
|
|
134646
134535
|
};
|
|
134647
134536
|
}
|
|
134648
134537
|
let json_str = JSON.stringify(items, replacer, indent);
|
|
134649
134538
|
if (ensure_ascii) {
|
|
134650
|
-
json_str = json_str.replace(/[\u007F-\uFFFF]/g,
|
|
134651
|
-
const full_str =
|
|
134539
|
+
json_str = json_str.replace(/[\u007F-\uFFFF]/g, (chr) => {
|
|
134540
|
+
const full_str = `0000${chr.charCodeAt(0).toString(16)}`;
|
|
134652
134541
|
const sub_str = full_str.substring(full_str.length - 4);
|
|
134653
|
-
return
|
|
134542
|
+
return `\\u${sub_str}`;
|
|
134654
134543
|
});
|
|
134655
134544
|
}
|
|
134656
134545
|
return new TextEncoder().encode(json_str);
|
|
@@ -134665,16 +134554,130 @@ const _JsonCodec = class {
|
|
|
134665
134554
|
items.pop();
|
|
134666
134555
|
if (!shape) {
|
|
134667
134556
|
throw new Error("0D not implemented for JsonCodec.");
|
|
134668
|
-
} else {
|
|
134669
|
-
const stride = get_strides(shape, "C");
|
|
134670
|
-
const data = items;
|
|
134671
|
-
return { data, shape, stride };
|
|
134672
134557
|
}
|
|
134558
|
+
const stride = get_strides(shape, "C");
|
|
134559
|
+
const data = items;
|
|
134560
|
+
return { data, shape, stride };
|
|
134673
134561
|
}
|
|
134674
134562
|
};
|
|
134675
134563
|
let JsonCodec = _JsonCodec;
|
|
134676
134564
|
_encoder_config = new WeakMap();
|
|
134677
134565
|
_decoder_config = new WeakMap();
|
|
134566
|
+
function proxy(arr) {
|
|
134567
|
+
if (arr instanceof BoolArray || arr instanceof ByteStringArray || arr instanceof UnicodeStringArray) {
|
|
134568
|
+
const arrp = new Proxy(arr, {
|
|
134569
|
+
get(target, prop) {
|
|
134570
|
+
return target.get(Number(prop));
|
|
134571
|
+
},
|
|
134572
|
+
set(target, prop, value) {
|
|
134573
|
+
target.set(Number(prop), value);
|
|
134574
|
+
return true;
|
|
134575
|
+
}
|
|
134576
|
+
});
|
|
134577
|
+
return arrp;
|
|
134578
|
+
}
|
|
134579
|
+
return arr;
|
|
134580
|
+
}
|
|
134581
|
+
function empty_like(chunk, order) {
|
|
134582
|
+
let data;
|
|
134583
|
+
if (chunk.data instanceof ByteStringArray || chunk.data instanceof UnicodeStringArray) {
|
|
134584
|
+
data = new chunk.constructor(
|
|
134585
|
+
// @ts-expect-error
|
|
134586
|
+
chunk.data.length,
|
|
134587
|
+
chunk.data.chars
|
|
134588
|
+
);
|
|
134589
|
+
} else {
|
|
134590
|
+
data = new chunk.constructor(chunk.data.length);
|
|
134591
|
+
}
|
|
134592
|
+
return {
|
|
134593
|
+
data,
|
|
134594
|
+
shape: chunk.shape,
|
|
134595
|
+
stride: get_strides(chunk.shape, order)
|
|
134596
|
+
};
|
|
134597
|
+
}
|
|
134598
|
+
function convert_array_order(src, target) {
|
|
134599
|
+
let out = empty_like(src, target);
|
|
134600
|
+
let n_dims = src.shape.length;
|
|
134601
|
+
let size2 = src.data.length;
|
|
134602
|
+
let index2 = Array(n_dims).fill(0);
|
|
134603
|
+
let src_data = proxy(src.data);
|
|
134604
|
+
let out_data = proxy(out.data);
|
|
134605
|
+
for (let src_idx = 0; src_idx < size2; src_idx++) {
|
|
134606
|
+
let out_idx = 0;
|
|
134607
|
+
for (let dim = 0; dim < n_dims; dim++) {
|
|
134608
|
+
out_idx += index2[dim] * out.stride[dim];
|
|
134609
|
+
}
|
|
134610
|
+
out_data[out_idx] = src_data[src_idx];
|
|
134611
|
+
index2[0] += 1;
|
|
134612
|
+
for (let dim = 0; dim < n_dims; dim++) {
|
|
134613
|
+
if (index2[dim] === src.shape[dim]) {
|
|
134614
|
+
if (dim + 1 === n_dims) {
|
|
134615
|
+
break;
|
|
134616
|
+
}
|
|
134617
|
+
index2[dim] = 0;
|
|
134618
|
+
index2[dim + 1] += 1;
|
|
134619
|
+
}
|
|
134620
|
+
}
|
|
134621
|
+
}
|
|
134622
|
+
return out;
|
|
134623
|
+
}
|
|
134624
|
+
function get_order(arr) {
|
|
134625
|
+
if (!arr.stride)
|
|
134626
|
+
return "C";
|
|
134627
|
+
let row_major_strides = get_strides(arr.shape, "C");
|
|
134628
|
+
return arr.stride.every((s2, i2) => s2 === row_major_strides[i2]) ? "C" : "F";
|
|
134629
|
+
}
|
|
134630
|
+
class TransposeCodec {
|
|
134631
|
+
constructor(configuration) {
|
|
134632
|
+
__publicField(this, "configuration");
|
|
134633
|
+
__publicField(this, "kind", "array_to_array");
|
|
134634
|
+
this.configuration = configuration;
|
|
134635
|
+
}
|
|
134636
|
+
static fromConfig(configuration) {
|
|
134637
|
+
return new TransposeCodec(configuration);
|
|
134638
|
+
}
|
|
134639
|
+
encode(arr) {
|
|
134640
|
+
var _a3, _b2;
|
|
134641
|
+
if (get_order(arr) === ((_a3 = this.configuration) == null ? void 0 : _a3.order)) {
|
|
134642
|
+
return arr;
|
|
134643
|
+
}
|
|
134644
|
+
return convert_array_order(arr, ((_b2 = this.configuration) == null ? void 0 : _b2.order) ?? "C");
|
|
134645
|
+
}
|
|
134646
|
+
decode(arr) {
|
|
134647
|
+
return arr;
|
|
134648
|
+
}
|
|
134649
|
+
}
|
|
134650
|
+
const _VLenUTF8 = class {
|
|
134651
|
+
constructor(shape) {
|
|
134652
|
+
__publicField(this, "kind", "array_to_bytes");
|
|
134653
|
+
__privateAdd(this, _shape2, void 0);
|
|
134654
|
+
__privateAdd(this, _strides2, void 0);
|
|
134655
|
+
__privateSet(this, _shape2, shape);
|
|
134656
|
+
__privateSet(this, _strides2, get_strides(shape, "C"));
|
|
134657
|
+
}
|
|
134658
|
+
static fromConfig(_, meta2) {
|
|
134659
|
+
return new _VLenUTF8(meta2.shape);
|
|
134660
|
+
}
|
|
134661
|
+
encode(_chunk) {
|
|
134662
|
+
throw new Error("Method not implemented.");
|
|
134663
|
+
}
|
|
134664
|
+
decode(bytes) {
|
|
134665
|
+
let decoder = new TextDecoder();
|
|
134666
|
+
let view = new DataView(bytes.buffer);
|
|
134667
|
+
let data = Array(view.getUint32(0, true));
|
|
134668
|
+
let pos = 4;
|
|
134669
|
+
for (let i2 = 0; i2 < data.length; i2++) {
|
|
134670
|
+
let item_length = view.getUint32(pos, true);
|
|
134671
|
+
pos += 4;
|
|
134672
|
+
data[i2] = decoder.decode(bytes.buffer.slice(pos, pos + item_length));
|
|
134673
|
+
pos += item_length;
|
|
134674
|
+
}
|
|
134675
|
+
return { data, shape: __privateGet(this, _shape2), stride: __privateGet(this, _strides2) };
|
|
134676
|
+
}
|
|
134677
|
+
};
|
|
134678
|
+
let VLenUTF8 = _VLenUTF8;
|
|
134679
|
+
_shape2 = new WeakMap();
|
|
134680
|
+
_strides2 = new WeakMap();
|
|
134678
134681
|
function create_default_registry() {
|
|
134679
134682
|
return (/* @__PURE__ */ new Map()).set("blosc", () => import("./blosc-537fd004.js").then((m) => m.default)).set("gzip", () => import("./gzip-6a24f0fe.js").then((m) => m.default)).set("lz4", () => import("./lz4-bbd18009.js").then((m) => m.default)).set("zlib", () => import("./zlib-175cd38d.js").then((m) => m.default)).set("zstd", () => import("./zstd-ec5a40b8.js").then((m) => m.default)).set("transpose", () => TransposeCodec).set("bytes", () => BytesCodec).set("crc32c", () => Crc32cCodec).set("vlen-utf8", () => VLenUTF8).set("json2", () => JsonCodec);
|
|
134680
134683
|
}
|
|
@@ -134989,8 +134992,8 @@ async function _open_v3(location) {
|
|
|
134989
134992
|
});
|
|
134990
134993
|
}
|
|
134991
134994
|
let meta_doc = json_decode_object(meta2);
|
|
134992
|
-
if (meta_doc.node_type === "array"
|
|
134993
|
-
meta_doc.fill_value =
|
|
134995
|
+
if (meta_doc.node_type === "array") {
|
|
134996
|
+
meta_doc.fill_value = ensure_correct_scalar(meta_doc);
|
|
134994
134997
|
}
|
|
134995
134998
|
return meta_doc.node_type === "array" ? new Array$1(store, location.path, meta_doc) : new Group(store, location.path, meta_doc);
|
|
134996
134999
|
}
|
|
@@ -135284,7 +135287,7 @@ function object_array_view(arr, offset = 0, size2) {
|
|
|
135284
135287
|
};
|
|
135285
135288
|
}
|
|
135286
135289
|
function compat_chunk(arr) {
|
|
135287
|
-
if (arr.data
|
|
135290
|
+
if (globalThis.Array.isArray(arr.data)) {
|
|
135288
135291
|
return {
|
|
135289
135292
|
// @ts-expect-error
|
|
135290
135293
|
data: object_array_view(arr.data),
|
|
@@ -135305,7 +135308,7 @@ function get_typed_array_constructor(arr) {
|
|
|
135305
135308
|
return arr.constructor;
|
|
135306
135309
|
}
|
|
135307
135310
|
function compat_scalar(arr, value) {
|
|
135308
|
-
if (arr.data
|
|
135311
|
+
if (globalThis.Array.isArray(arr.data)) {
|
|
135309
135312
|
return object_array_view([value]);
|
|
135310
135313
|
}
|
|
135311
135314
|
let TypedArray2 = get_typed_array_constructor(arr.data);
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D, e, a, b, c, d, F, G, Z, C, r, n, E, A, y, l, m, z, x, h, q, v, o, i, f, j, k, u, t, p, s, w } from "./index-
|
|
1
|
+
import { D, e, a, b, c, d, F, G, Z, C, r, n, E, A, y, l, m, z, x, h, q, v, o, i, f, j, k, u, t, p, s, w } from "./index-a7bb8a96.js";
|
|
2
2
|
import "react";
|
|
3
3
|
export {
|
|
4
4
|
D as DEFAULT_CELLS_LAYER,
|
|
@@ -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-
|
|
2
|
+
import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-a7bb8a96.js";
|
|
3
3
|
import "react";
|
|
4
4
|
const LercParameters = {
|
|
5
5
|
Version: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spatial.d.ts","sourceRoot":"","sources":["../src/spatial.js"],"names":[],"mappings":"AAOA,wDAEC;AAiCD;;;;;;GAMG;AACH,4CAJW,MAAM,UACN,MAAM,YAAC,GACL,MAAM,CAMlB;AAoCD;;;;GAIG;AACH,8BAHW,MAAM,YACN,KAAK,GAAC,IAAI,WAiBpB;AAID,sHAkCC;AAiHD;;GAEG;AACH,qCAFW,KAAK,CAAE,MAAM,CAAC,WAKxB;AAED;;;;;;GAMG;AACH,gDALW,MAAM,eAEJ,MAAM,EAAE,CAuCpB;AAED;;;;;;;;;GASG;AACH,gEAJW,MAAM,EAAE,sBAER,CAAC,MAAM,EAAE,GAAC,IAAI,CAAC,+CAuEzB;AASD;;;IAuBC;AAED,uDAQC;AAED;;;;;;;;GAQG;AACH,6EANW,MAAM,EAAE,GAAC,SAAS,QAElB,MAAM,EAAE,GAAC,SAAS,GAEhB,OAAO,CA4CnB;AAED,6CAOC;AAED;;;;;;;;;GASG;AACH,8EANW,MAAM,EAAE,GAAC,SAAS,YAGlB,MAAM,EAAE,GACN,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"spatial.d.ts","sourceRoot":"","sources":["../src/spatial.js"],"names":[],"mappings":"AAOA,wDAEC;AAiCD;;;;;;GAMG;AACH,4CAJW,MAAM,UACN,MAAM,YAAC,GACL,MAAM,CAMlB;AAoCD;;;;GAIG;AACH,8BAHW,MAAM,YACN,KAAK,GAAC,IAAI,WAiBpB;AAID,sHAkCC;AAiHD;;GAEG;AACH,qCAFW,KAAK,CAAE,MAAM,CAAC,WAKxB;AAED;;;;;;GAMG;AACH,gDALW,MAAM,eAEJ,MAAM,EAAE,CAuCpB;AAED;;;;;;;;;GASG;AACH,gEAJW,MAAM,EAAE,sBAER,CAAC,MAAM,EAAE,GAAC,IAAI,CAAC,+CAuEzB;AASD;;;IAuBC;AAED,uDAQC;AAED;;;;;;;;GAQG;AACH,6EANW,MAAM,EAAE,GAAC,SAAS,QAElB,MAAM,EAAE,GAAC,SAAS,GAEhB,OAAO,CA4CnB;AAED,6CAOC;AAED;;;;;;;;;GASG;AACH,8EANW,MAAM,EAAE,GAAC,SAAS,YAGlB,MAAM,EAAE,GACN,MAAM,EAAE,CAoDpB;AAniBD,qCAAwC;AAExC,mDAAoD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBpD,mDAKE;AAeK;;;;;EAYN;AAEM,yEAkBN;wBAtFuB,SAAS;oBAGb,cAAc"}
|
package/dist-tsc/spatial.js
CHANGED
|
@@ -454,7 +454,7 @@ export function normalizeCoordinateTransformations(coordinateTransformations, da
|
|
|
454
454
|
// Reference: https://ngff.openmicroscopy.org/0.4/index.html#trafo-md
|
|
455
455
|
let result = [];
|
|
456
456
|
if (Array.isArray(coordinateTransformations)) {
|
|
457
|
-
result = coordinateTransformations.
|
|
457
|
+
result = coordinateTransformations.flatMap((transform) => {
|
|
458
458
|
if (transform.input && transform.output) {
|
|
459
459
|
// This is a new-style coordinate transformation.
|
|
460
460
|
// (As proposed in https://github.com/ome/ngff/pull/138)
|
|
@@ -474,6 +474,9 @@ export function normalizeCoordinateTransformations(coordinateTransformations, da
|
|
|
474
474
|
if (type === 'identity') {
|
|
475
475
|
return { type };
|
|
476
476
|
}
|
|
477
|
+
if (type === 'sequence') {
|
|
478
|
+
return normalizeCoordinateTransformations(transform.transformations, datasets);
|
|
479
|
+
}
|
|
477
480
|
console.warn(`Coordinate transformation type "${type}" is not supported.`);
|
|
478
481
|
}
|
|
479
482
|
// Assume it was already an old-style (NGFF v0.4) coordinate transformation.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/spatial-utils",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.10",
|
|
4
4
|
"author": "Gehlenborg Lab",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"lodash-es": "^4.17.21",
|
|
20
|
-
"zarrita": "0.4.0-next.
|
|
20
|
+
"zarrita": "0.4.0-next.16",
|
|
21
21
|
"math.gl": "^3.5.6",
|
|
22
22
|
"mathjs": "^9.2.0",
|
|
23
|
-
"@vitessce/gl": "3.4.
|
|
24
|
-
"@vitessce/utils": "3.4.
|
|
25
|
-
"@vitessce/zarr-utils": "3.4.
|
|
23
|
+
"@vitessce/gl": "3.4.10",
|
|
24
|
+
"@vitessce/utils": "3.4.10",
|
|
25
|
+
"@vitessce/zarr-utils": "3.4.10"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",
|
package/src/spatial.js
CHANGED
|
@@ -512,7 +512,7 @@ export function normalizeCoordinateTransformations(coordinateTransformations, da
|
|
|
512
512
|
let result = [];
|
|
513
513
|
|
|
514
514
|
if (Array.isArray(coordinateTransformations)) {
|
|
515
|
-
result = coordinateTransformations.
|
|
515
|
+
result = coordinateTransformations.flatMap((transform) => {
|
|
516
516
|
if (transform.input && transform.output) {
|
|
517
517
|
// This is a new-style coordinate transformation.
|
|
518
518
|
// (As proposed in https://github.com/ome/ngff/pull/138)
|
|
@@ -532,6 +532,9 @@ export function normalizeCoordinateTransformations(coordinateTransformations, da
|
|
|
532
532
|
if (type === 'identity') {
|
|
533
533
|
return { type };
|
|
534
534
|
}
|
|
535
|
+
if (type === 'sequence') {
|
|
536
|
+
return normalizeCoordinateTransformations(transform.transformations, datasets);
|
|
537
|
+
}
|
|
535
538
|
console.warn(`Coordinate transformation type "${type}" is not supported.`);
|
|
536
539
|
}
|
|
537
540
|
// Assume it was already an old-style (NGFF v0.4) coordinate transformation.
|