@vitessce/ome-tiff 3.3.2 → 3.3.3
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-40eec6b1.js → deflate-602821cf.js} +1 -1
- package/dist/{index-132d2403.js → index-0fbef9f9.js} +229 -51
- package/dist/index.js +1 -1
- package/dist/{jpeg-7fba9dd6.js → jpeg-8b4b4f99.js} +1 -1
- package/dist/{lerc-6801cc14.js → lerc-665b6f2c.js} +1 -1
- package/dist/{lzw-1ab3ee13.js → lzw-ca1fa799.js} +1 -1
- package/dist/{packbits-15dfe2f1.js → packbits-4a6ab1a9.js} +1 -1
- package/dist/{raw-28a6a5da.js → raw-c1bcfd23.js} +1 -1
- package/dist/{webimage-a5b735d8.js → webimage-566323bb.js} +1 -1
- package/dist-tsc/OmeTiffAsObsSegmentationsLoader.d.ts.map +1 -1
- package/dist-tsc/OmeTiffAsObsSegmentationsLoader.js +29 -1
- package/dist-tsc/OmeTiffLoader.d.ts.map +1 -1
- package/dist-tsc/OmeTiffLoader.js +24 -0
- package/package.json +9 -8
- package/src/OmeTiffAsObsSegmentationsLoader.js +34 -1
- package/src/OmeTiffLoader.js +26 -0
|
@@ -103521,16 +103521,16 @@ async function getDecoder(fileDirectory) {
|
|
|
103521
103521
|
const Decoder = await importFn();
|
|
103522
103522
|
return new Decoder(fileDirectory);
|
|
103523
103523
|
}
|
|
103524
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
103525
|
-
addDecoder(5, () => import("./lzw-
|
|
103524
|
+
addDecoder([void 0, 1], () => import("./raw-c1bcfd23.js").then((m) => m.default));
|
|
103525
|
+
addDecoder(5, () => import("./lzw-ca1fa799.js").then((m) => m.default));
|
|
103526
103526
|
addDecoder(6, () => {
|
|
103527
103527
|
throw new Error("old style JPEG compression is not supported.");
|
|
103528
103528
|
});
|
|
103529
|
-
addDecoder(7, () => import("./jpeg-
|
|
103530
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
103531
|
-
addDecoder(32773, () => import("./packbits-
|
|
103532
|
-
addDecoder(34887, () => import("./lerc-
|
|
103533
|
-
addDecoder(50001, () => import("./webimage-
|
|
103529
|
+
addDecoder(7, () => import("./jpeg-8b4b4f99.js").then((m) => m.default));
|
|
103530
|
+
addDecoder([8, 32946], () => import("./deflate-602821cf.js").then((m) => m.default));
|
|
103531
|
+
addDecoder(32773, () => import("./packbits-4a6ab1a9.js").then((m) => m.default));
|
|
103532
|
+
addDecoder(34887, () => import("./lerc-665b6f2c.js").then((m) => m.default));
|
|
103533
|
+
addDecoder(50001, () => import("./webimage-566323bb.js").then((m) => m.default));
|
|
103534
103534
|
function copyNewSize(array, width, height, samplesPerPixel = 1) {
|
|
103535
103535
|
return new (Object.getPrototypeOf(array)).constructor(width * height * samplesPerPixel);
|
|
103536
103536
|
}
|
|
@@ -126003,7 +126003,9 @@ const FileType$1 = {
|
|
|
126003
126003
|
OBS_SEGMENTATIONS_JSON: "obsSegmentations.json",
|
|
126004
126004
|
OBS_SETS_CSV: "obsSets.csv",
|
|
126005
126005
|
OBS_SETS_JSON: "obsSets.json",
|
|
126006
|
+
// OME-Zarr
|
|
126006
126007
|
IMAGE_OME_ZARR: "image.ome-zarr",
|
|
126008
|
+
OBS_SEGMENTATIONS_OME_ZARR: "obsSegmentations.ome-zarr",
|
|
126007
126009
|
// AnnData
|
|
126008
126010
|
OBS_FEATURE_MATRIX_ANNDATA_ZARR: "obsFeatureMatrix.anndata.zarr",
|
|
126009
126011
|
OBS_SETS_ANNDATA_ZARR: "obsSets.anndata.zarr",
|
|
@@ -126456,30 +126458,39 @@ const omeCoordinateTransformations = z.array(z.union([
|
|
|
126456
126458
|
scale: z.array(z.number())
|
|
126457
126459
|
})
|
|
126458
126460
|
]));
|
|
126459
|
-
z.object({
|
|
126461
|
+
const imageOmeTiffSchema = z.object({
|
|
126460
126462
|
offsetsUrl: z.string().optional(),
|
|
126461
126463
|
coordinateTransformations: omeCoordinateTransformations.optional()
|
|
126462
126464
|
});
|
|
126465
|
+
imageOmeTiffSchema.extend({
|
|
126466
|
+
obsTypesFromChannelNames: z.boolean().optional()
|
|
126467
|
+
});
|
|
126463
126468
|
const imageOmeZarrSchema = z.object({
|
|
126464
126469
|
coordinateTransformations: omeCoordinateTransformations.optional()
|
|
126465
126470
|
});
|
|
126466
126471
|
imageOmeZarrSchema.extend({
|
|
126472
|
+
obsTypesFromChannelNames: z.boolean().optional()
|
|
126473
|
+
});
|
|
126474
|
+
const imageSpatialdataSchema = imageOmeZarrSchema.extend({
|
|
126467
126475
|
path: z.string()
|
|
126468
126476
|
});
|
|
126469
|
-
z.object({
|
|
126477
|
+
const obsSegmentationsSpatialdataSchema = z.object({
|
|
126478
|
+
// TODO: should this also extend the imageOmeZarrSchema?
|
|
126479
|
+
// TODO: should this be renamed labelsSpatialdataSchema?
|
|
126480
|
+
// TODO: support obsTypesFromChannelNames?
|
|
126470
126481
|
path: z.string()
|
|
126471
126482
|
});
|
|
126472
126483
|
z.object({
|
|
126473
126484
|
path: z.string()
|
|
126474
126485
|
});
|
|
126475
|
-
z.object({
|
|
126486
|
+
const obsSpotsSpatialdataSchema = z.object({
|
|
126476
126487
|
path: z.string(),
|
|
126477
126488
|
tablePath: z.string().optional().describe("The path to a table which annotates the spots. If available but not specified, the spot identifiers may not be aligned with associated tabular data as expected.")
|
|
126478
126489
|
});
|
|
126479
|
-
annDataObsFeatureMatrix.extend({
|
|
126490
|
+
const obsFeatureMatrixSpatialdataSchema = annDataObsFeatureMatrix.extend({
|
|
126480
126491
|
region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional()
|
|
126481
126492
|
});
|
|
126482
|
-
z.object({
|
|
126493
|
+
const obsSetsSpatialdataSchema = z.object({
|
|
126483
126494
|
region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional(),
|
|
126484
126495
|
tablePath: z.string().optional().describe("The path to a table which contains the index for the set values."),
|
|
126485
126496
|
obsSets: annDataObsSets
|
|
@@ -126542,6 +126553,19 @@ z.object({
|
|
|
126542
126553
|
z.array(annDataConvenienceObsEmbeddingItem)
|
|
126543
126554
|
])
|
|
126544
126555
|
}).partial();
|
|
126556
|
+
z.object({
|
|
126557
|
+
// TODO: should `image` be a special schema
|
|
126558
|
+
// to allow specifying fileUid (like for embeddingType)?
|
|
126559
|
+
image: imageSpatialdataSchema,
|
|
126560
|
+
// TODO: should this be a special schema
|
|
126561
|
+
// to allow specifying fileUid (like for embeddingType)?
|
|
126562
|
+
labels: obsSegmentationsSpatialdataSchema,
|
|
126563
|
+
obsFeatureMatrix: obsFeatureMatrixSpatialdataSchema,
|
|
126564
|
+
obsSpots: obsSpotsSpatialdataSchema,
|
|
126565
|
+
// TODO: obsPoints
|
|
126566
|
+
// TODO: obsLocations
|
|
126567
|
+
obsSets: obsSetsSpatialdataSchema
|
|
126568
|
+
}).partial();
|
|
126545
126569
|
z.object({
|
|
126546
126570
|
obsLabelsTypes: z.array(z.string()).optional(),
|
|
126547
126571
|
embeddingTypes: z.array(z.string()).optional()
|
|
@@ -133327,22 +133351,40 @@ function extent(values2, valueof) {
|
|
|
133327
133351
|
}
|
|
133328
133352
|
return [min2, max2];
|
|
133329
133353
|
}
|
|
133354
|
+
function max$1(values2, valueof) {
|
|
133355
|
+
let max2;
|
|
133356
|
+
if (valueof === void 0) {
|
|
133357
|
+
for (const value of values2) {
|
|
133358
|
+
if (value != null && (max2 < value || max2 === void 0 && value >= value)) {
|
|
133359
|
+
max2 = value;
|
|
133360
|
+
}
|
|
133361
|
+
}
|
|
133362
|
+
} else {
|
|
133363
|
+
let index2 = -1;
|
|
133364
|
+
for (let value of values2) {
|
|
133365
|
+
if ((value = valueof(value, ++index2, values2)) != null && (max2 < value || max2 === void 0 && value >= value)) {
|
|
133366
|
+
max2 = value;
|
|
133367
|
+
}
|
|
133368
|
+
}
|
|
133369
|
+
}
|
|
133370
|
+
return max2;
|
|
133371
|
+
}
|
|
133330
133372
|
function normalize(arr) {
|
|
133331
133373
|
const [min2, max2] = extent(arr);
|
|
133332
133374
|
const ratio = 255 / (max2 - min2);
|
|
133333
133375
|
const data = new Uint8Array(arr.map((i2) => Math.floor((i2 - min2) * ratio)));
|
|
133334
133376
|
return data;
|
|
133335
133377
|
}
|
|
133336
|
-
function multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSetColorMode, texSize) {
|
|
133378
|
+
function multiSetsToTextureData(multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode, texSize) {
|
|
133337
133379
|
let totalValuesLength = 0;
|
|
133338
133380
|
let totalColorsLength = 0;
|
|
133339
133381
|
channelIsSetColorMode.forEach((isSetColorMode, channelIndex) => {
|
|
133340
|
-
var _a2, _b, _c, _d
|
|
133382
|
+
var _a2, _b, _c, _d;
|
|
133341
133383
|
if (isSetColorMode) {
|
|
133342
|
-
|
|
133343
|
-
|
|
133384
|
+
totalColorsLength += (((_b = (_a2 = setColorValues[channelIndex]) == null ? void 0 : _a2.setColors) == null ? void 0 : _b.length) || 0) * 3;
|
|
133385
|
+
totalValuesLength += ((_c = setColorValues[channelIndex]) == null ? void 0 : _c.obsIndex) ? max$1(setColorValues[channelIndex].obsIndex.map((d) => parseInt(d))) : 0;
|
|
133344
133386
|
} else {
|
|
133345
|
-
totalValuesLength += ((
|
|
133387
|
+
totalValuesLength += multiMatrixObsIndex[channelIndex] ? max$1(multiMatrixObsIndex[channelIndex].map((d) => parseInt(d))) : ((_d = multiFeatureValues[channelIndex]) == null ? void 0 : _d.length) || 0;
|
|
133346
133388
|
}
|
|
133347
133389
|
});
|
|
133348
133390
|
const valueTexHeight = Math.max(2, Math.ceil(totalValuesLength / texSize));
|
|
@@ -133360,12 +133402,20 @@ function multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSet
|
|
|
133360
133402
|
let indexOffset = 0;
|
|
133361
133403
|
let colorOffset = 0;
|
|
133362
133404
|
channelIsSetColorMode.forEach((isSetColorMode, channelIndex) => {
|
|
133405
|
+
const matrixObsIndex = multiMatrixObsIndex[channelIndex];
|
|
133406
|
+
const bitmaskValueIsIndex = matrixObsIndex === null;
|
|
133363
133407
|
if (isSetColorMode) {
|
|
133364
133408
|
const { setColorIndices, setColors, obsIndex } = setColorValues[channelIndex] || {};
|
|
133365
133409
|
if (setColorIndices && setColors && obsIndex) {
|
|
133366
133410
|
for (let i2 = 0; i2 < obsIndex.length; i2++) {
|
|
133367
|
-
|
|
133368
|
-
|
|
133411
|
+
let obsId = String(i2 + 1);
|
|
133412
|
+
let obsI = i2;
|
|
133413
|
+
if (!bitmaskValueIsIndex) {
|
|
133414
|
+
obsId = obsIndex[i2];
|
|
133415
|
+
obsI = parseInt(obsId) - 1;
|
|
133416
|
+
}
|
|
133417
|
+
const colorIndex = setColorIndices.get(obsId);
|
|
133418
|
+
totalData[indexOffset + obsI] = colorIndex === void 0 ? 0 : colorIndex + 1;
|
|
133369
133419
|
}
|
|
133370
133420
|
for (let i2 = 0; i2 < setColors.length; i2++) {
|
|
133371
133421
|
const { color: [r2, g2, b] } = setColors[i2];
|
|
@@ -133380,7 +133430,16 @@ function multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSet
|
|
|
133380
133430
|
colorOffset += (setColors == null ? void 0 : setColors.length) || 0;
|
|
133381
133431
|
} else {
|
|
133382
133432
|
const featureArr = multiFeatureValues[channelIndex];
|
|
133383
|
-
|
|
133433
|
+
const normalizedFeatureArr = normalize(featureArr);
|
|
133434
|
+
if (!bitmaskValueIsIndex && matrixObsIndex) {
|
|
133435
|
+
for (let i2 = 0; i2 < matrixObsIndex.length; i2++) {
|
|
133436
|
+
const obsId = matrixObsIndex[i2];
|
|
133437
|
+
const obsI = parseInt(obsId) - 1;
|
|
133438
|
+
totalData[indexOffset + obsI] = normalizedFeatureArr[i2];
|
|
133439
|
+
}
|
|
133440
|
+
} else {
|
|
133441
|
+
totalData.set(normalizedFeatureArr, indexOffset);
|
|
133442
|
+
}
|
|
133384
133443
|
indicesOffsets.push(indexOffset);
|
|
133385
133444
|
indexOffset += featureArr.length;
|
|
133386
133445
|
colorsOffsets.push(colorOffset);
|
|
@@ -133407,6 +133466,17 @@ function padWithDefault(arr, defaultValue2, padWidth) {
|
|
|
133407
133466
|
function getColor(arr) {
|
|
133408
133467
|
return arr ? arr.map((v) => v / 255) : [0, 0, 0];
|
|
133409
133468
|
}
|
|
133469
|
+
function isEqualShallow(prevArr, nextArr) {
|
|
133470
|
+
if (prevArr === nextArr) {
|
|
133471
|
+
return true;
|
|
133472
|
+
}
|
|
133473
|
+
if (Array.isArray(prevArr) && Array.isArray(nextArr)) {
|
|
133474
|
+
if (prevArr.length === nextArr.length) {
|
|
133475
|
+
return !prevArr.some((v, i2) => v !== nextArr[i2] && (!Array.isArray(v) && !Array.isArray(nextArr[i2]) || (v.length > 0 || nextArr[i2].length > 0)));
|
|
133476
|
+
}
|
|
133477
|
+
}
|
|
133478
|
+
return prevArr === nextArr;
|
|
133479
|
+
}
|
|
133410
133480
|
const defaultProps = {
|
|
133411
133481
|
channelStrokeWidths: { type: "array", value: null, compare: true },
|
|
133412
133482
|
channelsFilled: { type: "array", value: null, compare: true },
|
|
@@ -133416,6 +133486,7 @@ const defaultProps = {
|
|
|
133416
133486
|
colormap: { type: "string", value: GLSL_COLORMAP_DEFAULT, compare: true },
|
|
133417
133487
|
expressionData: { type: "object", value: null, compare: true },
|
|
133418
133488
|
multiFeatureValues: { type: "array", value: null, compare: true },
|
|
133489
|
+
multiMatrixObsIndex: { type: "array", value: null, compare: true },
|
|
133419
133490
|
setColorValues: { type: "array", value: null, compare: true },
|
|
133420
133491
|
channelFeatureValueColormaps: { type: "array", value: null, compare: true },
|
|
133421
133492
|
channelFeatureValueColormapRanges: { type: "array", value: null, compare: true },
|
|
@@ -133462,9 +133533,9 @@ class BitmaskLayer2 extends XRLayer {
|
|
|
133462
133533
|
}
|
|
133463
133534
|
updateState({ props: props2, oldProps, changeFlags }) {
|
|
133464
133535
|
super.updateState({ props: props2, oldProps, changeFlags });
|
|
133465
|
-
if (props2.multiFeatureValues
|
|
133466
|
-
const { multiFeatureValues, setColorValues, channelIsSetColorMode } = this.props;
|
|
133467
|
-
const [valueTex, colorTex, valueTexOffsets, colorTexOffsets, valueTexHeight, colorTexHeight] = this.multiSetsToTexture(multiFeatureValues, setColorValues, channelIsSetColorMode);
|
|
133536
|
+
if (!isEqualShallow(props2.multiFeatureValues, oldProps.multiFeatureValues) || !isEqualShallow(props2.multiMatrixObsIndex, oldProps.multiMatrixObsIndex) || !isEqualShallow(props2.setColorValues, oldProps.setColorValues) || !isEqualShallow(props2.channelIsSetColorMode, oldProps.channelIsSetColorMode)) {
|
|
133537
|
+
const { multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode } = this.props;
|
|
133538
|
+
const [valueTex, colorTex, valueTexOffsets, colorTexOffsets, valueTexHeight, colorTexHeight] = this.multiSetsToTexture(multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode);
|
|
133468
133539
|
this.setState({
|
|
133469
133540
|
valueTex,
|
|
133470
133541
|
colorTex,
|
|
@@ -133616,9 +133687,9 @@ class BitmaskLayer2 extends XRLayer {
|
|
|
133616
133687
|
type: GL$1.FLOAT
|
|
133617
133688
|
});
|
|
133618
133689
|
}
|
|
133619
|
-
multiSetsToTexture(multiFeatureValues, setColorValues, channelIsSetColorMode) {
|
|
133690
|
+
multiSetsToTexture(multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode) {
|
|
133620
133691
|
const isWebGL2On = isWebGL2$1(this.context.gl);
|
|
133621
|
-
const [totalData, valueTexHeight, indicesOffsets, totalColors, colorTexHeight, colorsOffsets] = multiSetsToTextureData(multiFeatureValues, setColorValues, channelIsSetColorMode, MULTI_FEATURE_TEX_SIZE);
|
|
133692
|
+
const [totalData, valueTexHeight, indicesOffsets, totalColors, colorTexHeight, colorsOffsets] = multiSetsToTextureData(multiFeatureValues, multiMatrixObsIndex, setColorValues, channelIsSetColorMode, MULTI_FEATURE_TEX_SIZE);
|
|
133622
133693
|
return [
|
|
133623
133694
|
// Color indices texture
|
|
133624
133695
|
new Texture2D(this.context.gl, {
|
|
@@ -149159,20 +149230,20 @@ class ImageWrapper {
|
|
|
149159
149230
|
return result;
|
|
149160
149231
|
}
|
|
149161
149232
|
getNumChannels() {
|
|
149162
|
-
if ("
|
|
149163
|
-
|
|
149164
|
-
return Channels.length;
|
|
149165
|
-
}
|
|
149166
|
-
if ("omero" in this.vivLoader.metadata) {
|
|
149167
|
-
const { omero: { channels: channels2 } } = this.vivLoader.metadata;
|
|
149168
|
-
return channels2.length;
|
|
149233
|
+
if ("image-label" in this.vivLoader.metadata) {
|
|
149234
|
+
return 1;
|
|
149169
149235
|
}
|
|
149170
149236
|
if ("channels_metadata" in this.vivLoader.metadata) {
|
|
149171
149237
|
const { channels_metadata: channelsMetadata } = this.vivLoader.metadata;
|
|
149172
149238
|
return (channelsMetadata == null ? void 0 : channelsMetadata.channels.length) || 0;
|
|
149173
149239
|
}
|
|
149174
|
-
if ("
|
|
149175
|
-
|
|
149240
|
+
if ("omero" in this.vivLoader.metadata) {
|
|
149241
|
+
const { omero: { channels: channels2 } } = this.vivLoader.metadata;
|
|
149242
|
+
return channels2.length;
|
|
149243
|
+
}
|
|
149244
|
+
if ("Pixels" in this.vivLoader.metadata) {
|
|
149245
|
+
const { Pixels: { Channels } } = this.vivLoader.metadata;
|
|
149246
|
+
return Channels.length;
|
|
149176
149247
|
}
|
|
149177
149248
|
return 0;
|
|
149178
149249
|
}
|
|
@@ -149181,9 +149252,8 @@ class ImageWrapper {
|
|
|
149181
149252
|
const { Pixels: { Channels } } = this.vivLoader.metadata;
|
|
149182
149253
|
return Channels.map((channel, i2) => channel.Name || `Channel ${i2}`);
|
|
149183
149254
|
}
|
|
149184
|
-
if ("
|
|
149185
|
-
|
|
149186
|
-
return channels2.map((channel, i2) => channel.label || `Channel ${i2}`);
|
|
149255
|
+
if ("image-label" in this.vivLoader.metadata) {
|
|
149256
|
+
return ["labels"];
|
|
149187
149257
|
}
|
|
149188
149258
|
if ("channels_metadata" in this.vivLoader.metadata) {
|
|
149189
149259
|
const { channels_metadata: channelsMetadata } = this.vivLoader.metadata;
|
|
@@ -149191,9 +149261,33 @@ class ImageWrapper {
|
|
|
149191
149261
|
return channelsMetadata.channels.map((channel) => `Channel ${channel.label}`);
|
|
149192
149262
|
}
|
|
149193
149263
|
}
|
|
149264
|
+
if ("omero" in this.vivLoader.metadata) {
|
|
149265
|
+
const { omero: { channels: channels2 } } = this.vivLoader.metadata;
|
|
149266
|
+
return channels2.map((channel, i2) => channel.label || `Channel ${i2}`);
|
|
149267
|
+
}
|
|
149194
149268
|
return [];
|
|
149195
149269
|
}
|
|
149270
|
+
// TODO: support passing a custom color palette array.
|
|
149196
149271
|
getChannelObjects() {
|
|
149272
|
+
if ("image-label" in this.vivLoader.metadata) {
|
|
149273
|
+
return [{
|
|
149274
|
+
name: "labels",
|
|
149275
|
+
defaultColor: [255, 255, 255],
|
|
149276
|
+
defaultWindow: [0, 255],
|
|
149277
|
+
autoDefaultColor: [0, 0, 0]
|
|
149278
|
+
}];
|
|
149279
|
+
}
|
|
149280
|
+
if ("channels_metadata" in this.vivLoader.metadata) {
|
|
149281
|
+
const { channels_metadata: channelsMetadata } = this.vivLoader.metadata;
|
|
149282
|
+
if (channelsMetadata && Array.isArray(channelsMetadata == null ? void 0 : channelsMetadata.channels)) {
|
|
149283
|
+
return channelsMetadata.channels.map((channel, i2) => ({
|
|
149284
|
+
name: `Channel ${channel.label}`,
|
|
149285
|
+
defaultColor: void 0,
|
|
149286
|
+
defaultWindow: void 0,
|
|
149287
|
+
autoDefaultColor: VIEWER_PALETTE[i2 % VIEWER_PALETTE.length]
|
|
149288
|
+
}));
|
|
149289
|
+
}
|
|
149290
|
+
}
|
|
149197
149291
|
if ("omero" in this.vivLoader.metadata) {
|
|
149198
149292
|
const { omero: { channels: channels2 } } = this.vivLoader.metadata;
|
|
149199
149293
|
return channels2.map((channel, i2) => ({
|
|
@@ -149212,17 +149306,6 @@ class ImageWrapper {
|
|
|
149212
149306
|
autoDefaultColor: VIEWER_PALETTE[i2 % VIEWER_PALETTE.length]
|
|
149213
149307
|
}));
|
|
149214
149308
|
}
|
|
149215
|
-
if ("channels_metadata" in this.vivLoader.metadata) {
|
|
149216
|
-
const { channels_metadata: channelsMetadata } = this.vivLoader.metadata;
|
|
149217
|
-
if (channelsMetadata && Array.isArray(channelsMetadata == null ? void 0 : channelsMetadata.channels)) {
|
|
149218
|
-
return channelsMetadata.channels.map((channel, i2) => ({
|
|
149219
|
-
name: `Channel ${channel.label}`,
|
|
149220
|
-
defaultColor: void 0,
|
|
149221
|
-
defaultWindow: void 0,
|
|
149222
|
-
autoDefaultColor: VIEWER_PALETTE[i2 % VIEWER_PALETTE.length]
|
|
149223
|
-
}));
|
|
149224
|
-
}
|
|
149225
|
-
}
|
|
149226
149309
|
return [];
|
|
149227
149310
|
}
|
|
149228
149311
|
getDtype() {
|
|
@@ -149311,6 +149394,46 @@ class ImageWrapper {
|
|
|
149311
149394
|
const { shape } = Array.isArray(loader.data) ? loader.data[0] : loader.data;
|
|
149312
149395
|
return isInterleaved(shape);
|
|
149313
149396
|
}
|
|
149397
|
+
getPhotometricInterpretation() {
|
|
149398
|
+
const loader = this.vivLoader;
|
|
149399
|
+
if ("Pixels" in loader.metadata) {
|
|
149400
|
+
const source = Array.isArray(loader.data) ? loader.data[0] : loader.data;
|
|
149401
|
+
if ("meta" in source) {
|
|
149402
|
+
const { meta: meta2 } = source;
|
|
149403
|
+
if (meta2 && "photometricInterpretation" in meta2) {
|
|
149404
|
+
const numericValue = meta2.photometricInterpretation;
|
|
149405
|
+
if (numericValue === 2) {
|
|
149406
|
+
return "RGB";
|
|
149407
|
+
}
|
|
149408
|
+
}
|
|
149409
|
+
}
|
|
149410
|
+
}
|
|
149411
|
+
if ("omero" in loader.metadata) {
|
|
149412
|
+
const { omero: { rdefs: { model } } } = loader.metadata;
|
|
149413
|
+
if (model === "color") {
|
|
149414
|
+
return "RGB";
|
|
149415
|
+
}
|
|
149416
|
+
}
|
|
149417
|
+
return "BlackIsZero";
|
|
149418
|
+
}
|
|
149419
|
+
}
|
|
149420
|
+
class CoordinationLevel {
|
|
149421
|
+
constructor(value) {
|
|
149422
|
+
this.value = value;
|
|
149423
|
+
this.cachedValue = null;
|
|
149424
|
+
}
|
|
149425
|
+
setCached(processedLevel) {
|
|
149426
|
+
this.cachedValue = processedLevel;
|
|
149427
|
+
}
|
|
149428
|
+
getCached() {
|
|
149429
|
+
return this.cachedValue;
|
|
149430
|
+
}
|
|
149431
|
+
isCached() {
|
|
149432
|
+
return this.cachedValue !== null;
|
|
149433
|
+
}
|
|
149434
|
+
}
|
|
149435
|
+
function CL(value) {
|
|
149436
|
+
return new CoordinationLevel(value);
|
|
149314
149437
|
}
|
|
149315
149438
|
class OmeTiffLoader extends AbstractTwoStepLoader {
|
|
149316
149439
|
async loadOffsets() {
|
|
@@ -149363,6 +149486,14 @@ class OmeTiffLoader extends AbstractTwoStepLoader {
|
|
|
149363
149486
|
const urls = [
|
|
149364
149487
|
{ url, name: image2.name }
|
|
149365
149488
|
];
|
|
149489
|
+
const channelObjects = imageWrapper.getChannelObjects();
|
|
149490
|
+
const channelCoordination = channelObjects.slice(0, 5).map((channelObj, i2) => ({
|
|
149491
|
+
spatialTargetC: i2,
|
|
149492
|
+
spatialChannelColor: (channelObj.defaultColor || channelObj.autoDefaultColor).slice(0, 3),
|
|
149493
|
+
spatialChannelVisible: true,
|
|
149494
|
+
spatialChannelOpacity: 1,
|
|
149495
|
+
spatialChannelWindow: channelObj.defaultWindow || null
|
|
149496
|
+
}));
|
|
149366
149497
|
const imagesWithLoaderCreators = [
|
|
149367
149498
|
{
|
|
149368
149499
|
...image2,
|
|
@@ -149378,9 +149509,25 @@ class OmeTiffLoader extends AbstractTwoStepLoader {
|
|
|
149378
149509
|
);
|
|
149379
149510
|
}
|
|
149380
149511
|
return this.autoImageCache.then((autoImages) => {
|
|
149512
|
+
var _a2;
|
|
149381
149513
|
const [autoImageLayers, imageLayerLoaders, imageLayerMeta] = autoImages;
|
|
149382
149514
|
const coordinationValues = {
|
|
149383
|
-
|
|
149515
|
+
// Old
|
|
149516
|
+
spatialImageLayer: autoImageLayers,
|
|
149517
|
+
// New
|
|
149518
|
+
spatialTargetZ: imageWrapper.getDefaultTargetZ(),
|
|
149519
|
+
spatialTargetT: imageWrapper.getDefaultTargetT(),
|
|
149520
|
+
imageLayer: CL([
|
|
149521
|
+
{
|
|
149522
|
+
fileUid: ((_a2 = this.coordinationValues) == null ? void 0 : _a2.fileUid) || null,
|
|
149523
|
+
spatialLayerOpacity: 1,
|
|
149524
|
+
spatialLayerVisible: true,
|
|
149525
|
+
photometricInterpretation: imageWrapper.getPhotometricInterpretation(),
|
|
149526
|
+
volumetricRenderingAlgorithm: "maximumIntensityProjection",
|
|
149527
|
+
spatialTargetResolution: null,
|
|
149528
|
+
imageChannel: CL(channelCoordination)
|
|
149529
|
+
}
|
|
149530
|
+
])
|
|
149384
149531
|
};
|
|
149385
149532
|
return new LoaderResult(
|
|
149386
149533
|
{
|
|
@@ -149403,7 +149550,10 @@ class OmeTiffLoader extends AbstractTwoStepLoader {
|
|
|
149403
149550
|
class OmeTiffAsObsSegmentationsLoader extends OmeTiffLoader {
|
|
149404
149551
|
async load() {
|
|
149405
149552
|
const { url, requestInit: requestInit2 } = this;
|
|
149406
|
-
const {
|
|
149553
|
+
const {
|
|
149554
|
+
coordinateTransformations: coordinateTransformationsFromOptions,
|
|
149555
|
+
obsTypesFromChannelNames
|
|
149556
|
+
} = this.options || {};
|
|
149407
149557
|
const offsets = await this.loadOffsets();
|
|
149408
149558
|
const loader = await loadOmeTiff(url, { offsets, headers: requestInit2 == null ? void 0 : requestInit2.headers });
|
|
149409
149559
|
const imageWrapper = new ImageWrapper(loader, this.options);
|
|
@@ -149438,6 +149588,21 @@ class OmeTiffAsObsSegmentationsLoader extends OmeTiffLoader {
|
|
|
149438
149588
|
}
|
|
149439
149589
|
};
|
|
149440
149590
|
const urls = [{ url, name: image2.name }];
|
|
149591
|
+
const channelObjects = imageWrapper.getChannelObjects();
|
|
149592
|
+
const channelCoordination = channelObjects.slice(0, 5).map((channelObj, i2) => ({
|
|
149593
|
+
spatialTargetC: i2,
|
|
149594
|
+
spatialChannelColor: (channelObj.defaultColor || channelObj.autoDefaultColor).slice(0, 3),
|
|
149595
|
+
spatialChannelVisible: true,
|
|
149596
|
+
spatialChannelOpacity: 1,
|
|
149597
|
+
spatialChannelWindow: channelObj.defaultWindow || null,
|
|
149598
|
+
// featureType: 'feature',
|
|
149599
|
+
// featureValueType: 'value',
|
|
149600
|
+
obsColorEncoding: "spatialChannelColor",
|
|
149601
|
+
spatialSegmentationFilled: true,
|
|
149602
|
+
spatialSegmentationStrokeWidth: 1,
|
|
149603
|
+
obsHighlight: null,
|
|
149604
|
+
...obsTypesFromChannelNames ? { obsType: channelObj.name } : {}
|
|
149605
|
+
}));
|
|
149441
149606
|
const imagesWithLoaderCreators = [
|
|
149442
149607
|
{
|
|
149443
149608
|
...image2,
|
|
@@ -149456,9 +149621,22 @@ class OmeTiffAsObsSegmentationsLoader extends OmeTiffLoader {
|
|
|
149456
149621
|
);
|
|
149457
149622
|
}
|
|
149458
149623
|
return this.autoImageCache.then((autoImages) => {
|
|
149624
|
+
var _a2;
|
|
149459
149625
|
const [autoImageLayers, imageLayerLoaders, imageLayerMeta] = autoImages;
|
|
149460
149626
|
const coordinationValues = {
|
|
149461
|
-
|
|
149627
|
+
// Old
|
|
149628
|
+
spatialSegmentationLayer: autoImageLayers,
|
|
149629
|
+
// New
|
|
149630
|
+
spatialTargetZ: imageWrapper.getDefaultTargetZ(),
|
|
149631
|
+
spatialTargetT: imageWrapper.getDefaultTargetT(),
|
|
149632
|
+
segmentationLayer: CL([
|
|
149633
|
+
{
|
|
149634
|
+
fileUid: ((_a2 = this.coordinationValues) == null ? void 0 : _a2.fileUid) || null,
|
|
149635
|
+
spatialLayerOpacity: 1,
|
|
149636
|
+
spatialLayerVisible: true,
|
|
149637
|
+
segmentationChannel: CL(channelCoordination)
|
|
149638
|
+
}
|
|
149639
|
+
])
|
|
149462
149640
|
};
|
|
149463
149641
|
return new LoaderResult(
|
|
149464
149642
|
{
|
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-0fbef9f9.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "@vitessce/vit-s";
|
|
5
5
|
var LercDecode = { exports: {} };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OmeTiffAsObsSegmentationsLoader.d.ts","sourceRoot":"","sources":["../src/OmeTiffAsObsSegmentationsLoader.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OmeTiffAsObsSegmentationsLoader.d.ts","sourceRoot":"","sources":["../src/OmeTiffAsObsSegmentationsLoader.js"],"names":[],"mappings":"AAaA;CA6HC"}
|
|
@@ -2,11 +2,12 @@ import { viv } from '@vitessce/gl';
|
|
|
2
2
|
import { LoaderResult } from '@vitessce/vit-s';
|
|
3
3
|
import { initializeRasterLayersAndChannels, coordinateTransformationsToMatrix, getNgffAxesForTiff, } from '@vitessce/spatial-utils';
|
|
4
4
|
import { ImageWrapper, } from '@vitessce/image-utils';
|
|
5
|
+
import { CoordinationLevel as CL } from '@vitessce/config';
|
|
5
6
|
import OmeTiffLoader from './OmeTiffLoader.js';
|
|
6
7
|
export default class OmeTiffAsObsSegmentationsLoader extends OmeTiffLoader {
|
|
7
8
|
async load() {
|
|
8
9
|
const { url, requestInit } = this;
|
|
9
|
-
const { coordinateTransformations: coordinateTransformationsFromOptions } = this.options || {};
|
|
10
|
+
const { coordinateTransformations: coordinateTransformationsFromOptions, obsTypesFromChannelNames, } = this.options || {};
|
|
10
11
|
const offsets = await this.loadOffsets();
|
|
11
12
|
const loader = await viv.loadOmeTiff(url, { offsets, headers: requestInit?.headers });
|
|
12
13
|
const imageWrapper = new ImageWrapper(loader, this.options);
|
|
@@ -32,6 +33,21 @@ export default class OmeTiffAsObsSegmentationsLoader extends OmeTiffLoader {
|
|
|
32
33
|
};
|
|
33
34
|
// Get image name and URL tuples.
|
|
34
35
|
const urls = [{ url, name: image.name }];
|
|
36
|
+
const channelObjects = imageWrapper.getChannelObjects();
|
|
37
|
+
const channelCoordination = channelObjects.slice(0, 5).map((channelObj, i) => ({
|
|
38
|
+
spatialTargetC: i,
|
|
39
|
+
spatialChannelColor: (channelObj.defaultColor || channelObj.autoDefaultColor).slice(0, 3),
|
|
40
|
+
spatialChannelVisible: true,
|
|
41
|
+
spatialChannelOpacity: 1.0,
|
|
42
|
+
spatialChannelWindow: channelObj.defaultWindow || null,
|
|
43
|
+
// featureType: 'feature',
|
|
44
|
+
// featureValueType: 'value',
|
|
45
|
+
obsColorEncoding: 'spatialChannelColor',
|
|
46
|
+
spatialSegmentationFilled: true,
|
|
47
|
+
spatialSegmentationStrokeWidth: 1.0,
|
|
48
|
+
obsHighlight: null,
|
|
49
|
+
...(obsTypesFromChannelNames ? { obsType: channelObj.name } : {}),
|
|
50
|
+
}));
|
|
35
51
|
// Add a loaderCreator function for each image layer.
|
|
36
52
|
const imagesWithLoaderCreators = [
|
|
37
53
|
{
|
|
@@ -53,7 +69,19 @@ export default class OmeTiffAsObsSegmentationsLoader extends OmeTiffLoader {
|
|
|
53
69
|
return this.autoImageCache.then((autoImages) => {
|
|
54
70
|
const [autoImageLayers, imageLayerLoaders, imageLayerMeta] = autoImages;
|
|
55
71
|
const coordinationValues = {
|
|
72
|
+
// Old
|
|
56
73
|
spatialSegmentationLayer: autoImageLayers,
|
|
74
|
+
// New
|
|
75
|
+
spatialTargetZ: imageWrapper.getDefaultTargetZ(),
|
|
76
|
+
spatialTargetT: imageWrapper.getDefaultTargetT(),
|
|
77
|
+
segmentationLayer: CL([
|
|
78
|
+
{
|
|
79
|
+
fileUid: this.coordinationValues?.fileUid || null,
|
|
80
|
+
spatialLayerOpacity: 1.0,
|
|
81
|
+
spatialLayerVisible: true,
|
|
82
|
+
segmentationChannel: CL(channelCoordination),
|
|
83
|
+
},
|
|
84
|
+
]),
|
|
57
85
|
};
|
|
58
86
|
return new LoaderResult({
|
|
59
87
|
obsSegmentationsType: 'bitmask',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OmeTiffLoader.d.ts","sourceRoot":"","sources":["../src/OmeTiffLoader.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OmeTiffLoader.d.ts","sourceRoot":"","sources":["../src/OmeTiffLoader.js"],"names":[],"mappings":"AAUA;IACE,4BAWC;IAED,qBAqHC;IA1CG,oBAIC;CAuCN"}
|
|
@@ -2,6 +2,7 @@ import { viv } from '@vitessce/gl';
|
|
|
2
2
|
import { initializeRasterLayersAndChannels, coordinateTransformationsToMatrix, getNgffAxesForTiff, } from '@vitessce/spatial-utils';
|
|
3
3
|
import { ImageWrapper } from '@vitessce/image-utils';
|
|
4
4
|
import { AbstractTwoStepLoader, LoaderResult } from '@vitessce/vit-s';
|
|
5
|
+
import { CoordinationLevel as CL } from '@vitessce/config';
|
|
5
6
|
export default class OmeTiffLoader extends AbstractTwoStepLoader {
|
|
6
7
|
async loadOffsets() {
|
|
7
8
|
const { offsetsUrl } = this.options || {};
|
|
@@ -46,6 +47,14 @@ export default class OmeTiffLoader extends AbstractTwoStepLoader {
|
|
|
46
47
|
const urls = [
|
|
47
48
|
{ url, name: image.name },
|
|
48
49
|
];
|
|
50
|
+
const channelObjects = imageWrapper.getChannelObjects();
|
|
51
|
+
const channelCoordination = channelObjects.slice(0, 5).map((channelObj, i) => ({
|
|
52
|
+
spatialTargetC: i,
|
|
53
|
+
spatialChannelColor: (channelObj.defaultColor || channelObj.autoDefaultColor).slice(0, 3),
|
|
54
|
+
spatialChannelVisible: true,
|
|
55
|
+
spatialChannelOpacity: 1.0,
|
|
56
|
+
spatialChannelWindow: channelObj.defaultWindow || null,
|
|
57
|
+
}));
|
|
49
58
|
// Add a loaderCreator function for each image layer.
|
|
50
59
|
const imagesWithLoaderCreators = [
|
|
51
60
|
{
|
|
@@ -62,7 +71,22 @@ export default class OmeTiffLoader extends AbstractTwoStepLoader {
|
|
|
62
71
|
return this.autoImageCache.then((autoImages) => {
|
|
63
72
|
const [autoImageLayers, imageLayerLoaders, imageLayerMeta] = autoImages;
|
|
64
73
|
const coordinationValues = {
|
|
74
|
+
// Old
|
|
65
75
|
spatialImageLayer: autoImageLayers,
|
|
76
|
+
// New
|
|
77
|
+
spatialTargetZ: imageWrapper.getDefaultTargetZ(),
|
|
78
|
+
spatialTargetT: imageWrapper.getDefaultTargetT(),
|
|
79
|
+
imageLayer: CL([
|
|
80
|
+
{
|
|
81
|
+
fileUid: this.coordinationValues?.fileUid || null,
|
|
82
|
+
spatialLayerOpacity: 1.0,
|
|
83
|
+
spatialLayerVisible: true,
|
|
84
|
+
photometricInterpretation: imageWrapper.getPhotometricInterpretation(),
|
|
85
|
+
volumetricRenderingAlgorithm: 'maximumIntensityProjection',
|
|
86
|
+
spatialTargetResolution: null,
|
|
87
|
+
imageChannel: CL(channelCoordination),
|
|
88
|
+
},
|
|
89
|
+
]),
|
|
66
90
|
};
|
|
67
91
|
return new LoaderResult({
|
|
68
92
|
image: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/ome-tiff",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.3",
|
|
4
4
|
"author": "Gehlenborg Lab",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -19,13 +19,14 @@
|
|
|
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.3.
|
|
23
|
-
"@vitessce/
|
|
24
|
-
"@vitessce/
|
|
25
|
-
"@vitessce/spatial-utils": "3.3.
|
|
26
|
-
"@vitessce/
|
|
27
|
-
"@vitessce/vit-s": "3.3.
|
|
28
|
-
"@vitessce/
|
|
22
|
+
"@vitessce/constants-internal": "3.3.3",
|
|
23
|
+
"@vitessce/config": "3.3.3",
|
|
24
|
+
"@vitessce/gl": "3.3.3",
|
|
25
|
+
"@vitessce/spatial-utils": "3.3.3",
|
|
26
|
+
"@vitessce/utils": "3.3.3",
|
|
27
|
+
"@vitessce/vit-s": "3.3.3",
|
|
28
|
+
"@vitessce/sets-utils": "3.3.3",
|
|
29
|
+
"@vitessce/image-utils": "3.3.3"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"ajv": "^6.10.0"
|
|
@@ -8,12 +8,16 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
ImageWrapper,
|
|
10
10
|
} from '@vitessce/image-utils';
|
|
11
|
+
import { CoordinationLevel as CL } from '@vitessce/config';
|
|
11
12
|
import OmeTiffLoader from './OmeTiffLoader.js';
|
|
12
13
|
|
|
13
14
|
export default class OmeTiffAsObsSegmentationsLoader extends OmeTiffLoader {
|
|
14
15
|
async load() {
|
|
15
16
|
const { url, requestInit } = this;
|
|
16
|
-
const {
|
|
17
|
+
const {
|
|
18
|
+
coordinateTransformations: coordinateTransformationsFromOptions,
|
|
19
|
+
obsTypesFromChannelNames,
|
|
20
|
+
} = this.options || {};
|
|
17
21
|
const offsets = await this.loadOffsets();
|
|
18
22
|
const loader = await viv.loadOmeTiff(url, { offsets, headers: requestInit?.headers });
|
|
19
23
|
const imageWrapper = new ImageWrapper(loader, this.options);
|
|
@@ -58,6 +62,22 @@ export default class OmeTiffAsObsSegmentationsLoader extends OmeTiffLoader {
|
|
|
58
62
|
// Get image name and URL tuples.
|
|
59
63
|
const urls = [{ url, name: image.name }];
|
|
60
64
|
|
|
65
|
+
const channelObjects = imageWrapper.getChannelObjects();
|
|
66
|
+
const channelCoordination = channelObjects.slice(0, 5).map((channelObj, i) => ({
|
|
67
|
+
spatialTargetC: i,
|
|
68
|
+
spatialChannelColor: (channelObj.defaultColor || channelObj.autoDefaultColor).slice(0, 3),
|
|
69
|
+
spatialChannelVisible: true,
|
|
70
|
+
spatialChannelOpacity: 1.0,
|
|
71
|
+
spatialChannelWindow: channelObj.defaultWindow || null,
|
|
72
|
+
// featureType: 'feature',
|
|
73
|
+
// featureValueType: 'value',
|
|
74
|
+
obsColorEncoding: 'spatialChannelColor',
|
|
75
|
+
spatialSegmentationFilled: true,
|
|
76
|
+
spatialSegmentationStrokeWidth: 1.0,
|
|
77
|
+
obsHighlight: null,
|
|
78
|
+
...(obsTypesFromChannelNames ? { obsType: channelObj.name } : {}),
|
|
79
|
+
}));
|
|
80
|
+
|
|
61
81
|
// Add a loaderCreator function for each image layer.
|
|
62
82
|
const imagesWithLoaderCreators = [
|
|
63
83
|
{
|
|
@@ -87,8 +107,21 @@ export default class OmeTiffAsObsSegmentationsLoader extends OmeTiffLoader {
|
|
|
87
107
|
const [autoImageLayers, imageLayerLoaders, imageLayerMeta] = autoImages;
|
|
88
108
|
|
|
89
109
|
const coordinationValues = {
|
|
110
|
+
// Old
|
|
90
111
|
spatialSegmentationLayer: autoImageLayers,
|
|
112
|
+
// New
|
|
113
|
+
spatialTargetZ: imageWrapper.getDefaultTargetZ(),
|
|
114
|
+
spatialTargetT: imageWrapper.getDefaultTargetT(),
|
|
115
|
+
segmentationLayer: CL([
|
|
116
|
+
{
|
|
117
|
+
fileUid: this.coordinationValues?.fileUid || null,
|
|
118
|
+
spatialLayerOpacity: 1.0,
|
|
119
|
+
spatialLayerVisible: true,
|
|
120
|
+
segmentationChannel: CL(channelCoordination),
|
|
121
|
+
},
|
|
122
|
+
]),
|
|
91
123
|
};
|
|
124
|
+
|
|
92
125
|
return new LoaderResult(
|
|
93
126
|
{
|
|
94
127
|
obsSegmentationsType: 'bitmask',
|
package/src/OmeTiffLoader.js
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from '@vitessce/spatial-utils';
|
|
7
7
|
import { ImageWrapper } from '@vitessce/image-utils';
|
|
8
8
|
import { AbstractTwoStepLoader, LoaderResult } from '@vitessce/vit-s';
|
|
9
|
+
import { CoordinationLevel as CL } from '@vitessce/config';
|
|
9
10
|
|
|
10
11
|
export default class OmeTiffLoader extends AbstractTwoStepLoader {
|
|
11
12
|
async loadOffsets() {
|
|
@@ -74,6 +75,15 @@ export default class OmeTiffLoader extends AbstractTwoStepLoader {
|
|
|
74
75
|
{ url, name: image.name },
|
|
75
76
|
];
|
|
76
77
|
|
|
78
|
+
const channelObjects = imageWrapper.getChannelObjects();
|
|
79
|
+
const channelCoordination = channelObjects.slice(0, 5).map((channelObj, i) => ({
|
|
80
|
+
spatialTargetC: i,
|
|
81
|
+
spatialChannelColor: (channelObj.defaultColor || channelObj.autoDefaultColor).slice(0, 3),
|
|
82
|
+
spatialChannelVisible: true,
|
|
83
|
+
spatialChannelOpacity: 1.0,
|
|
84
|
+
spatialChannelWindow: channelObj.defaultWindow || null,
|
|
85
|
+
}));
|
|
86
|
+
|
|
77
87
|
// Add a loaderCreator function for each image layer.
|
|
78
88
|
const imagesWithLoaderCreators = [
|
|
79
89
|
{
|
|
@@ -98,8 +108,24 @@ export default class OmeTiffLoader extends AbstractTwoStepLoader {
|
|
|
98
108
|
const [autoImageLayers, imageLayerLoaders, imageLayerMeta] = autoImages;
|
|
99
109
|
|
|
100
110
|
const coordinationValues = {
|
|
111
|
+
// Old
|
|
101
112
|
spatialImageLayer: autoImageLayers,
|
|
113
|
+
// New
|
|
114
|
+
spatialTargetZ: imageWrapper.getDefaultTargetZ(),
|
|
115
|
+
spatialTargetT: imageWrapper.getDefaultTargetT(),
|
|
116
|
+
imageLayer: CL([
|
|
117
|
+
{
|
|
118
|
+
fileUid: this.coordinationValues?.fileUid || null,
|
|
119
|
+
spatialLayerOpacity: 1.0,
|
|
120
|
+
spatialLayerVisible: true,
|
|
121
|
+
photometricInterpretation: imageWrapper.getPhotometricInterpretation(),
|
|
122
|
+
volumetricRenderingAlgorithm: 'maximumIntensityProjection',
|
|
123
|
+
spatialTargetResolution: null,
|
|
124
|
+
imageChannel: CL(channelCoordination),
|
|
125
|
+
},
|
|
126
|
+
]),
|
|
102
127
|
};
|
|
128
|
+
|
|
103
129
|
return new LoaderResult(
|
|
104
130
|
{
|
|
105
131
|
image: {
|