@vitessce/spatial-utils 3.4.9 → 3.4.11
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-2f4d1ec9.js → deflate-32efdab2.js} +1 -1
- package/dist/{index-8cb3967a.js → index-a7bb8a96.js} +173 -178
- package/dist/index.js +1 -1
- package/dist/{jpeg-81155bb0.js → jpeg-ddaf8c90.js} +1 -1
- package/dist/{lerc-69593269.js → lerc-436605d8.js} +1 -1
- package/dist/{lzw-b6a4c6a9.js → lzw-0caa4868.js} +1 -1
- package/dist/{packbits-6dcf7755.js → packbits-a5fbf85a.js} +1 -1
- package/dist/{raw-11a8e782.js → raw-9ca04826.js} +1 -1
- package/dist/{webimage-940b0f0b.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++) {
|
|
@@ -85485,24 +85485,16 @@ var getIntrinsic = function GetIntrinsic(name2, allowMissing) {
|
|
|
85485
85485
|
return value;
|
|
85486
85486
|
};
|
|
85487
85487
|
var callBind$3 = { exports: {} };
|
|
85488
|
-
var
|
|
85489
|
-
var
|
|
85490
|
-
|
|
85491
|
-
|
|
85492
|
-
|
|
85493
|
-
|
|
85494
|
-
|
|
85495
|
-
var $defineProperty2 = GetIntrinsic3("%Object.defineProperty%", true) || false;
|
|
85496
|
-
if ($defineProperty2) {
|
|
85497
|
-
try {
|
|
85498
|
-
$defineProperty2({}, "a", { value: 1 });
|
|
85499
|
-
} catch (e2) {
|
|
85500
|
-
$defineProperty2 = false;
|
|
85501
|
-
}
|
|
85488
|
+
var GetIntrinsic$4 = getIntrinsic;
|
|
85489
|
+
var $defineProperty$3 = GetIntrinsic$4("%Object.defineProperty%", true) || false;
|
|
85490
|
+
if ($defineProperty$3) {
|
|
85491
|
+
try {
|
|
85492
|
+
$defineProperty$3({}, "a", { value: 1 });
|
|
85493
|
+
} catch (e2) {
|
|
85494
|
+
$defineProperty$3 = false;
|
|
85502
85495
|
}
|
|
85503
|
-
esDefineProperty = $defineProperty2;
|
|
85504
|
-
return esDefineProperty;
|
|
85505
85496
|
}
|
|
85497
|
+
var esDefineProperty = $defineProperty$3;
|
|
85506
85498
|
var GetIntrinsic$3 = getIntrinsic;
|
|
85507
85499
|
var $gOPD$1 = GetIntrinsic$3("%Object.getOwnPropertyDescriptor%", true);
|
|
85508
85500
|
if ($gOPD$1) {
|
|
@@ -85513,7 +85505,7 @@ if ($gOPD$1) {
|
|
|
85513
85505
|
}
|
|
85514
85506
|
}
|
|
85515
85507
|
var gopd$1 = $gOPD$1;
|
|
85516
|
-
var $defineProperty$2 =
|
|
85508
|
+
var $defineProperty$2 = esDefineProperty;
|
|
85517
85509
|
var $SyntaxError = syntax;
|
|
85518
85510
|
var $TypeError$3 = type;
|
|
85519
85511
|
var gopd = gopd$1;
|
|
@@ -85554,7 +85546,7 @@ var defineDataProperty$1 = function defineDataProperty(obj, property, value) {
|
|
|
85554
85546
|
throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
|
|
85555
85547
|
}
|
|
85556
85548
|
};
|
|
85557
|
-
var $defineProperty$1 =
|
|
85549
|
+
var $defineProperty$1 = esDefineProperty;
|
|
85558
85550
|
var hasPropertyDescriptors$1 = function hasPropertyDescriptors() {
|
|
85559
85551
|
return !!$defineProperty$1;
|
|
85560
85552
|
};
|
|
@@ -85623,7 +85615,7 @@ var setFunctionLength = function setFunctionLength2(fn, length2) {
|
|
|
85623
85615
|
var $apply = GetIntrinsic3("%Function.prototype.apply%");
|
|
85624
85616
|
var $call = GetIntrinsic3("%Function.prototype.call%");
|
|
85625
85617
|
var $reflectApply = GetIntrinsic3("%Reflect.apply%", true) || bind4.call($call, $apply);
|
|
85626
|
-
var $defineProperty2 =
|
|
85618
|
+
var $defineProperty2 = esDefineProperty;
|
|
85627
85619
|
var $max = GetIntrinsic3("%Math.max%");
|
|
85628
85620
|
module2.exports = function callBind2(originalFunction) {
|
|
85629
85621
|
if (typeof originalFunction !== "function") {
|
|
@@ -119237,16 +119229,16 @@ function addDecoder(cases, importFn) {
|
|
|
119237
119229
|
}
|
|
119238
119230
|
cases.forEach((c) => registry$2.set(c, importFn));
|
|
119239
119231
|
}
|
|
119240
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
119241
|
-
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));
|
|
119242
119234
|
addDecoder(6, () => {
|
|
119243
119235
|
throw new Error("old style JPEG compression is not supported.");
|
|
119244
119236
|
});
|
|
119245
|
-
addDecoder(7, () => import("./jpeg-
|
|
119246
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
119247
|
-
addDecoder(32773, () => import("./packbits-
|
|
119248
|
-
addDecoder(34887, () => import("./lerc-
|
|
119249
|
-
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));
|
|
119250
119242
|
function decodeRowAcc(row, stride) {
|
|
119251
119243
|
let length2 = row.length - stride;
|
|
119252
119244
|
let offset = 0;
|
|
@@ -133991,7 +133983,7 @@ function normalizeCoordinateTransformations(coordinateTransformations, datasets)
|
|
|
133991
133983
|
var _a3;
|
|
133992
133984
|
let result = [];
|
|
133993
133985
|
if (Array.isArray(coordinateTransformations)) {
|
|
133994
|
-
result = coordinateTransformations.
|
|
133986
|
+
result = coordinateTransformations.flatMap((transform2) => {
|
|
133995
133987
|
if (transform2.input && transform2.output) {
|
|
133996
133988
|
const { type: type2 } = transform2;
|
|
133997
133989
|
if (type2 === "translation") {
|
|
@@ -134009,6 +134001,9 @@ function normalizeCoordinateTransformations(coordinateTransformations, datasets)
|
|
|
134009
134001
|
if (type2 === "identity") {
|
|
134010
134002
|
return { type: type2 };
|
|
134011
134003
|
}
|
|
134004
|
+
if (type2 === "sequence") {
|
|
134005
|
+
return normalizeCoordinateTransformations(transform2.transformations, datasets);
|
|
134006
|
+
}
|
|
134012
134007
|
console.warn(`Coordinate transformation type "${type2}" is not supported.`);
|
|
134013
134008
|
}
|
|
134014
134009
|
return transform2;
|
|
@@ -134143,7 +134138,6 @@ const _UnicodeStringArray = class {
|
|
|
134143
134138
|
constructor(chars, x2, byteOffset, length2) {
|
|
134144
134139
|
__privateAdd(this, _data, void 0);
|
|
134145
134140
|
__publicField(this, "chars");
|
|
134146
|
-
__privateAdd(this, _encode_buffer, void 0);
|
|
134147
134141
|
this.chars = chars;
|
|
134148
134142
|
if (typeof x2 === "number") {
|
|
134149
134143
|
__privateSet(this, _data, new Int32Array(x2 * chars));
|
|
@@ -134161,7 +134155,6 @@ const _UnicodeStringArray = class {
|
|
|
134161
134155
|
}
|
|
134162
134156
|
}()));
|
|
134163
134157
|
}
|
|
134164
|
-
__privateSet(this, _encode_buffer, new Int32Array(chars));
|
|
134165
134158
|
}
|
|
134166
134159
|
get BYTES_PER_ELEMENT() {
|
|
134167
134160
|
return __privateGet(this, _data).BYTES_PER_ELEMENT * this.chars;
|
|
@@ -134211,7 +134204,6 @@ const _UnicodeStringArray = class {
|
|
|
134211
134204
|
};
|
|
134212
134205
|
let UnicodeStringArray = _UnicodeStringArray;
|
|
134213
134206
|
_data = new WeakMap();
|
|
134214
|
-
_encode_buffer = new WeakMap();
|
|
134215
134207
|
function json_decode_object(bytes) {
|
|
134216
134208
|
const str = new TextDecoder().decode(bytes);
|
|
134217
134209
|
return JSON.parse(str);
|
|
@@ -134280,10 +134272,12 @@ function col_major_stride(shape) {
|
|
|
134280
134272
|
}
|
|
134281
134273
|
function create_chunk_key_encoder({ name: name2, configuration }) {
|
|
134282
134274
|
if (name2 === "default") {
|
|
134283
|
-
|
|
134275
|
+
const separator = (configuration == null ? void 0 : configuration.separator) ?? "/";
|
|
134276
|
+
return (chunk_coords) => ["c", ...chunk_coords].join(separator);
|
|
134284
134277
|
}
|
|
134285
134278
|
if (name2 === "v2") {
|
|
134286
|
-
|
|
134279
|
+
const separator = (configuration == null ? void 0 : configuration.separator) ?? ".";
|
|
134280
|
+
return (chunk_coords) => chunk_coords.join(separator) || "0";
|
|
134287
134281
|
}
|
|
134288
134282
|
throw new Error(`Unknown chunk key encoding: ${name2}`);
|
|
134289
134283
|
}
|
|
@@ -134303,17 +134297,17 @@ function coerce_dtype(dtype) {
|
|
|
134303
134297
|
}
|
|
134304
134298
|
let [, endian, rest] = match;
|
|
134305
134299
|
let data_type = {
|
|
134306
|
-
|
|
134307
|
-
|
|
134308
|
-
|
|
134309
|
-
|
|
134310
|
-
|
|
134311
|
-
|
|
134312
|
-
|
|
134313
|
-
|
|
134314
|
-
|
|
134315
|
-
|
|
134316
|
-
|
|
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"
|
|
134317
134311
|
}[rest] ?? (rest.startsWith("S") || rest.startsWith("U") ? `v2:${rest}` : void 0);
|
|
134318
134312
|
if (!data_type) {
|
|
134319
134313
|
throw new Error(`Unsupported or unknown dtype: ${dtype}`);
|
|
@@ -134390,93 +134384,11 @@ function is_sharding_codec(codec) {
|
|
|
134390
134384
|
return (codec == null ? void 0 : codec.name) === "sharding_indexed";
|
|
134391
134385
|
}
|
|
134392
134386
|
function ensure_correct_scalar(metadata) {
|
|
134393
|
-
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) {
|
|
134394
134388
|
return BigInt(metadata.fill_value);
|
|
134395
134389
|
}
|
|
134396
134390
|
return metadata.fill_value;
|
|
134397
134391
|
}
|
|
134398
|
-
function proxy(arr) {
|
|
134399
|
-
if (arr instanceof BoolArray || arr instanceof ByteStringArray || arr instanceof UnicodeStringArray) {
|
|
134400
|
-
return new Proxy(arr, {
|
|
134401
|
-
get(target, prop) {
|
|
134402
|
-
return target.get(Number(prop));
|
|
134403
|
-
},
|
|
134404
|
-
set(target, prop, value) {
|
|
134405
|
-
target.set(Number(prop), value);
|
|
134406
|
-
return true;
|
|
134407
|
-
}
|
|
134408
|
-
});
|
|
134409
|
-
}
|
|
134410
|
-
return arr;
|
|
134411
|
-
}
|
|
134412
|
-
function empty_like(chunk, order) {
|
|
134413
|
-
let data;
|
|
134414
|
-
if (chunk.data instanceof ByteStringArray || chunk.data instanceof UnicodeStringArray) {
|
|
134415
|
-
data = new chunk.constructor(
|
|
134416
|
-
// @ts-expect-error
|
|
134417
|
-
chunk.data.length,
|
|
134418
|
-
chunk.data.chars
|
|
134419
|
-
);
|
|
134420
|
-
} else {
|
|
134421
|
-
data = new chunk.constructor(chunk.data.length);
|
|
134422
|
-
}
|
|
134423
|
-
return {
|
|
134424
|
-
data,
|
|
134425
|
-
shape: chunk.shape,
|
|
134426
|
-
stride: get_strides(chunk.shape, order)
|
|
134427
|
-
};
|
|
134428
|
-
}
|
|
134429
|
-
function convert_array_order(src, target) {
|
|
134430
|
-
let out = empty_like(src, target);
|
|
134431
|
-
let n_dims = src.shape.length;
|
|
134432
|
-
let size2 = src.data.length;
|
|
134433
|
-
let index2 = Array(n_dims).fill(0);
|
|
134434
|
-
let src_data = proxy(src.data);
|
|
134435
|
-
let out_data = proxy(out.data);
|
|
134436
|
-
for (let src_idx = 0; src_idx < size2; src_idx++) {
|
|
134437
|
-
let out_idx = 0;
|
|
134438
|
-
for (let dim = 0; dim < n_dims; dim++) {
|
|
134439
|
-
out_idx += index2[dim] * out.stride[dim];
|
|
134440
|
-
}
|
|
134441
|
-
out_data[out_idx] = src_data[src_idx];
|
|
134442
|
-
index2[0] += 1;
|
|
134443
|
-
for (let dim = 0; dim < n_dims; dim++) {
|
|
134444
|
-
if (index2[dim] === src.shape[dim]) {
|
|
134445
|
-
if (dim + 1 === n_dims) {
|
|
134446
|
-
break;
|
|
134447
|
-
}
|
|
134448
|
-
index2[dim] = 0;
|
|
134449
|
-
index2[dim + 1] += 1;
|
|
134450
|
-
}
|
|
134451
|
-
}
|
|
134452
|
-
}
|
|
134453
|
-
return out;
|
|
134454
|
-
}
|
|
134455
|
-
function get_order(arr) {
|
|
134456
|
-
if (!arr.stride)
|
|
134457
|
-
return "C";
|
|
134458
|
-
let row_major_strides = get_strides(arr.shape, "C");
|
|
134459
|
-
return arr.stride.every((s2, i2) => s2 === row_major_strides[i2]) ? "C" : "F";
|
|
134460
|
-
}
|
|
134461
|
-
class TransposeCodec {
|
|
134462
|
-
constructor(configuration) {
|
|
134463
|
-
__publicField(this, "configuration");
|
|
134464
|
-
__publicField(this, "kind", "array_to_array");
|
|
134465
|
-
this.configuration = configuration;
|
|
134466
|
-
}
|
|
134467
|
-
static fromConfig(configuration) {
|
|
134468
|
-
return new TransposeCodec(configuration);
|
|
134469
|
-
}
|
|
134470
|
-
encode(arr) {
|
|
134471
|
-
if (get_order(arr) === this.configuration.order) {
|
|
134472
|
-
return arr;
|
|
134473
|
-
}
|
|
134474
|
-
return convert_array_order(arr, this.configuration.order);
|
|
134475
|
-
}
|
|
134476
|
-
decode(arr) {
|
|
134477
|
-
return arr;
|
|
134478
|
-
}
|
|
134479
|
-
}
|
|
134480
134392
|
const LITTLE_ENDIAN_OS = system_is_little_endian();
|
|
134481
134393
|
function system_is_little_endian() {
|
|
134482
134394
|
const a2 = new Uint32Array([305419896]);
|
|
@@ -134497,7 +134409,7 @@ const _BytesCodec = class {
|
|
|
134497
134409
|
__privateAdd(this, _BYTES_PER_ELEMENT, void 0);
|
|
134498
134410
|
__privateAdd(this, _shape, void 0);
|
|
134499
134411
|
__privateAdd(this, _endian, void 0);
|
|
134500
|
-
__privateSet(this, _endian, configuration.endian);
|
|
134412
|
+
__privateSet(this, _endian, configuration == null ? void 0 : configuration.endian);
|
|
134501
134413
|
__privateSet(this, _TypedArray, get_ctr(meta2.data_type));
|
|
134502
134414
|
__privateSet(this, _shape, meta2.shape);
|
|
134503
134415
|
__privateSet(this, _strides, get_strides(meta2.shape, get_array_order(meta2.codecs)));
|
|
@@ -134545,57 +134457,26 @@ class Crc32cCodec {
|
|
|
134545
134457
|
return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength - 4);
|
|
134546
134458
|
}
|
|
134547
134459
|
}
|
|
134548
|
-
const _VLenUTF8 = class {
|
|
134549
|
-
constructor(shape) {
|
|
134550
|
-
__publicField(this, "kind", "array_to_bytes");
|
|
134551
|
-
__privateAdd(this, _shape2, void 0);
|
|
134552
|
-
__privateAdd(this, _strides2, void 0);
|
|
134553
|
-
__privateSet(this, _shape2, shape);
|
|
134554
|
-
__privateSet(this, _strides2, get_strides(shape, "C"));
|
|
134555
|
-
}
|
|
134556
|
-
static fromConfig(_, meta2) {
|
|
134557
|
-
return new _VLenUTF8(meta2.shape);
|
|
134558
|
-
}
|
|
134559
|
-
encode(_chunk) {
|
|
134560
|
-
throw new Error("Method not implemented.");
|
|
134561
|
-
}
|
|
134562
|
-
decode(bytes) {
|
|
134563
|
-
let decoder = new TextDecoder();
|
|
134564
|
-
let view = new DataView(bytes.buffer);
|
|
134565
|
-
let data = Array(view.getUint32(0, true));
|
|
134566
|
-
let pos = 4;
|
|
134567
|
-
for (let i2 = 0; i2 < data.length; i2++) {
|
|
134568
|
-
let item_length = view.getUint32(pos, true);
|
|
134569
|
-
pos += 4;
|
|
134570
|
-
data[i2] = decoder.decode(bytes.buffer.slice(pos, pos + item_length));
|
|
134571
|
-
pos += item_length;
|
|
134572
|
-
}
|
|
134573
|
-
return { data, shape: __privateGet(this, _shape2), stride: __privateGet(this, _strides2) };
|
|
134574
|
-
}
|
|
134575
|
-
};
|
|
134576
|
-
let VLenUTF8 = _VLenUTF8;
|
|
134577
|
-
_shape2 = new WeakMap();
|
|
134578
|
-
_strides2 = new WeakMap();
|
|
134579
134460
|
function throw_on_nan_replacer(_key, value) {
|
|
134580
|
-
if (value
|
|
134461
|
+
if (Number.isNaN(value)) {
|
|
134581
134462
|
throw new Error("JsonCodec allow_nan is false but NaN was encountered during encoding.");
|
|
134582
134463
|
}
|
|
134583
|
-
if (value ===
|
|
134464
|
+
if (value === Number.POSITIVE_INFINITY) {
|
|
134584
134465
|
throw new Error("JsonCodec allow_nan is false but Infinity was encountered during encoding.");
|
|
134585
134466
|
}
|
|
134586
|
-
if (value ===
|
|
134467
|
+
if (value === Number.NEGATIVE_INFINITY) {
|
|
134587
134468
|
throw new Error("JsonCodec allow_nan is false but -Infinity was encountered during encoding.");
|
|
134588
134469
|
}
|
|
134589
134470
|
return value;
|
|
134590
134471
|
}
|
|
134591
134472
|
function sort_keys_replacer(_key, value) {
|
|
134592
|
-
return value instanceof Object && !(value
|
|
134473
|
+
return value instanceof Object && !Array.isArray(value) ? Object.keys(value).sort().reduce((sorted, key) => {
|
|
134593
134474
|
sorted[key] = value[key];
|
|
134594
134475
|
return sorted;
|
|
134595
134476
|
}, {}) : value;
|
|
134596
134477
|
}
|
|
134597
134478
|
const _JsonCodec = class {
|
|
134598
|
-
constructor(configuration) {
|
|
134479
|
+
constructor(configuration = {}) {
|
|
134599
134480
|
__publicField(this, "configuration");
|
|
134600
134481
|
__publicField(this, "kind", "array_to_bytes");
|
|
134601
134482
|
__privateAdd(this, _encoder_config, void 0);
|
|
@@ -134645,20 +134526,20 @@ const _JsonCodec = class {
|
|
|
134645
134526
|
items.push(buf.shape);
|
|
134646
134527
|
let replacer = void 0;
|
|
134647
134528
|
if (replacer_functions.length) {
|
|
134648
|
-
replacer =
|
|
134529
|
+
replacer = (key, value) => {
|
|
134649
134530
|
let new_value = value;
|
|
134650
|
-
|
|
134531
|
+
for (let sub_replacer of replacer_functions) {
|
|
134651
134532
|
new_value = sub_replacer(key, new_value);
|
|
134652
|
-
}
|
|
134533
|
+
}
|
|
134653
134534
|
return new_value;
|
|
134654
134535
|
};
|
|
134655
134536
|
}
|
|
134656
134537
|
let json_str = JSON.stringify(items, replacer, indent);
|
|
134657
134538
|
if (ensure_ascii) {
|
|
134658
|
-
json_str = json_str.replace(/[\u007F-\uFFFF]/g,
|
|
134659
|
-
const full_str =
|
|
134539
|
+
json_str = json_str.replace(/[\u007F-\uFFFF]/g, (chr) => {
|
|
134540
|
+
const full_str = `0000${chr.charCodeAt(0).toString(16)}`;
|
|
134660
134541
|
const sub_str = full_str.substring(full_str.length - 4);
|
|
134661
|
-
return
|
|
134542
|
+
return `\\u${sub_str}`;
|
|
134662
134543
|
});
|
|
134663
134544
|
}
|
|
134664
134545
|
return new TextEncoder().encode(json_str);
|
|
@@ -134673,16 +134554,130 @@ const _JsonCodec = class {
|
|
|
134673
134554
|
items.pop();
|
|
134674
134555
|
if (!shape) {
|
|
134675
134556
|
throw new Error("0D not implemented for JsonCodec.");
|
|
134676
|
-
} else {
|
|
134677
|
-
const stride = get_strides(shape, "C");
|
|
134678
|
-
const data = items;
|
|
134679
|
-
return { data, shape, stride };
|
|
134680
134557
|
}
|
|
134558
|
+
const stride = get_strides(shape, "C");
|
|
134559
|
+
const data = items;
|
|
134560
|
+
return { data, shape, stride };
|
|
134681
134561
|
}
|
|
134682
134562
|
};
|
|
134683
134563
|
let JsonCodec = _JsonCodec;
|
|
134684
134564
|
_encoder_config = new WeakMap();
|
|
134685
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();
|
|
134686
134681
|
function create_default_registry() {
|
|
134687
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);
|
|
134688
134683
|
}
|
|
@@ -134997,8 +134992,8 @@ async function _open_v3(location) {
|
|
|
134997
134992
|
});
|
|
134998
134993
|
}
|
|
134999
134994
|
let meta_doc = json_decode_object(meta2);
|
|
135000
|
-
if (meta_doc.node_type === "array"
|
|
135001
|
-
meta_doc.fill_value =
|
|
134995
|
+
if (meta_doc.node_type === "array") {
|
|
134996
|
+
meta_doc.fill_value = ensure_correct_scalar(meta_doc);
|
|
135002
134997
|
}
|
|
135003
134998
|
return meta_doc.node_type === "array" ? new Array$1(store, location.path, meta_doc) : new Group(store, location.path, meta_doc);
|
|
135004
134999
|
}
|
|
@@ -135292,7 +135287,7 @@ function object_array_view(arr, offset = 0, size2) {
|
|
|
135292
135287
|
};
|
|
135293
135288
|
}
|
|
135294
135289
|
function compat_chunk(arr) {
|
|
135295
|
-
if (arr.data
|
|
135290
|
+
if (globalThis.Array.isArray(arr.data)) {
|
|
135296
135291
|
return {
|
|
135297
135292
|
// @ts-expect-error
|
|
135298
135293
|
data: object_array_view(arr.data),
|
|
@@ -135313,7 +135308,7 @@ function get_typed_array_constructor(arr) {
|
|
|
135313
135308
|
return arr.constructor;
|
|
135314
135309
|
}
|
|
135315
135310
|
function compat_scalar(arr, value) {
|
|
135316
|
-
if (arr.data
|
|
135311
|
+
if (globalThis.Array.isArray(arr.data)) {
|
|
135317
135312
|
return object_array_view([value]);
|
|
135318
135313
|
}
|
|
135319
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.11",
|
|
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.11",
|
|
24
|
+
"@vitessce/utils": "3.4.11",
|
|
25
|
+
"@vitessce/zarr-utils": "3.4.11"
|
|
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.
|