Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/AdministrationGUI/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<parent>
<groupId>org.janelia</groupId>
<artifactId>workstation</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<relativePath>../..</relativePath>
</parent>

<name>AdministrationGUI</name>
<groupId>org.janelia.workstation</groupId>
<artifactId>adminstration</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<packaging>nbm</packaging>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions modules/ColorDepthSearch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<parent>
<groupId>org.janelia</groupId>
<artifactId>workstation</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<relativePath>../..</relativePath>
</parent>

<name>ColorDepthSearch</name>
<groupId>org.janelia.workstation</groupId>
<artifactId>colordepth</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<packaging>nbm</packaging>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions modules/CommonGUI/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<parent>
<groupId>org.janelia</groupId>
<artifactId>workstation</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<relativePath>../..</relativePath>
</parent>

<name>CommonGUI</name>
<groupId>org.janelia.workstation</groupId>
<artifactId>common-gui</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<packaging>nbm</packaging>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions modules/CommonLibraries/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<parent>
<groupId>org.janelia</groupId>
<artifactId>workstation</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<relativePath>../..</relativePath>
</parent>

<name>CommonLibraries</name>
<groupId>org.janelia.workstation</groupId>
<artifactId>libraries</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<packaging>nbm</packaging>

<properties>
Expand Down
4 changes: 2 additions & 2 deletions modules/Core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<parent>
<groupId>org.janelia</groupId>
<artifactId>workstation</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<relativePath>../..</relativePath>
</parent>

<name>Core</name>
<groupId>org.janelia.workstation</groupId>
<artifactId>core</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<packaging>nbm</packaging>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions modules/DarculaLAF/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<parent>
<groupId>org.janelia</groupId>
<artifactId>workstation</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<relativePath>../..</relativePath>
</parent>

<name>DarculaLAF</name>
<groupId>org.janelia.workstation</groupId>
<artifactId>darcula</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<packaging>nbm</packaging>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions modules/DataBrowser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<parent>
<groupId>org.janelia</groupId>
<artifactId>workstation</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<relativePath>../..</relativePath>
</parent>

<name>DataBrowser</name>
<groupId>org.janelia.workstation</groupId>
<artifactId>browser</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<packaging>nbm</packaging>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions modules/GLViewerTools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<parent>
<groupId>org.janelia</groupId>
<artifactId>workstation</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<relativePath>../..</relativePath>
</parent>

<name>GLViewerTools</name>
<groupId>org.janelia.workstation</groupId>
<artifactId>gltools</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<packaging>nbm</packaging>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions modules/Geometry3d/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<parent>
<groupId>org.janelia</groupId>
<artifactId>workstation</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<relativePath>../..</relativePath>
</parent>

<name>Geometry3d</name>
<groupId>org.janelia.workstation</groupId>
<artifactId>geometry3d</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<packaging>nbm</packaging>

<dependencies>
Expand Down
6 changes: 3 additions & 3 deletions modules/HortaTracer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<parent>
<groupId>org.janelia</groupId>
<artifactId>workstation</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<relativePath>../..</relativePath>
</parent>

<name>HortaTracer</name>
<groupId>org.janelia.workstation</groupId>
<artifactId>horta</artifactId>
<version>9.24.1</version>
<version>9.25.1</version>
<packaging>nbm</packaging>

<dependencies>
Expand Down Expand Up @@ -78,7 +78,7 @@
<dependency>
<groupId>org.aind</groupId>
<artifactId>jomezarr</artifactId>
<version>1.4.3</version>
<version>1.4.4</version>
</dependency>
<dependency>
<groupId>dev.zarr</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,17 @@ public boolean loadDroppedOmeZarr(String sourceName) {
if (!haveSetBoundingBox[0] && !source.getResolutions().isEmpty()) {
haveSetBoundingBox[0] = true;

// Metadata is loaded, so the channel count is known: size the
// shared color model to match, plus one extra slot for the
// synthetic tracing/unmix channel (mirrors the legacy 2-channel
// TetVolumeActor convention), and rebuild the slider UI.
if (getImageColorModel().getChannelCount() != source.getChannelCount() + 1) {
getImageColorModel().reset(65535, source.getChannelCount() + 1);
getImageColorModel().getChannel(source.getChannelCount())
.setColor(new Color(0f, 0.5f, 1.0f)); // unmixed channel in Economo blue
initColorModel();
}

TmModelManager.getInstance().setSampleBoundingBox(source.getBoundingBox3d());
TmModelManager.getInstance().setVoxelCenter(source.getVoxelCenter());

Expand Down Expand Up @@ -2370,6 +2381,13 @@ void setKtxSource(KtxOctreeBlockTileSource ktxSource) {
if (ktxSource != null) {
omeZarrSource = null;
setVolumeSource(null);
// TetVolumeActor only supports exactly 3 channels; reset the shared color
// model in case a previous OME-Zarr multichannel session resized it larger,
// otherwise TetVolumeActor.display() throws UnsupportedOperationException.
if (getImageColorModel().getChannelCount() != 3) {
getImageColorModel().reset(65535, 3);
initColorModel();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.janelia.horta;

import java.awt.Color;
import java.io.IOException;
import java.net.URL;

Expand Down Expand Up @@ -138,6 +139,18 @@ private OmeZarrBlockTileSource createOmeZarrSource(URL renderedOmeZarrUrl, TmSam
if (!haveFirstDataset[0] && !source.getResolutions().isEmpty()) {
haveFirstDataset[0] = true;
try {
// OME-Zarr metadata is now loaded, so the channel count is known.
// Size the shared color model to match, plus one extra slot for the
// synthetic tracing/unmix channel (mirrors the legacy 2-channel
// TetVolumeActor convention of a dedicated slider for that channel),
// then re-apply the persisted/workspace color model at the correct
// channel count (this also rebuilds the slider UI via ColorModelUpdateEvent).
if (nttc.getImageColorModel().getChannelCount() != source.getChannelCount() + 1) {
nttc.getImageColorModel().reset(65535, source.getChannelCount() + 1);
nttc.getImageColorModel().getChannel(source.getChannelCount())
.setColor(new Color(0f, 0.5f, 1.0f)); // unmixed channel in Economo blue
nttc.initColorModel();
}
if (nttc.doesUpdateVolumeCache()) {
loader.loadTransientOmeZarrTileAtCurrentFocus(nttc.getOmeZarrSource());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.janelia.horta.blocks.OmeZarrBlockResolution;
import org.janelia.horta.blocks.OmeZarrBlockTileKey;
import org.janelia.horta.blocks.OmeZarrBlockTileSource;
import org.janelia.horta.volume.OmeZarrVolumeMipMaterial;
import org.janelia.horta.volume.VolumeMipMaterial;
import org.janelia.workstation.controller.model.color.ImageColorModel;

Expand All @@ -36,8 +37,8 @@ public class OmeZarrVolumeMeshActor extends MeshActor implements SortableBlockAc

private double distance;

public OmeZarrVolumeMeshActor(OmeZarrBlockTileSource source, OmeZarrBlockTileKey tile, VolumeMipMaterial.VolumeState volumeState, int colorChannel) throws IOException {
super(new OmeZarrMesh(tile), new OmeZarrVolumeMeshActor.MeshMaterial(source, tile, source.getColorModel(), volumeState, colorChannel), null);
public OmeZarrVolumeMeshActor(OmeZarrBlockTileSource source, OmeZarrBlockTileKey tile, VolumeMipMaterial.VolumeState volumeState) throws IOException {
super(new OmeZarrMesh(tile), new OmeZarrVolumeMeshActor.MeshMaterial(source, tile, source.getColorModel(), volumeState), null);

this.meshMaterial = (OmeZarrVolumeMeshActor.MeshMaterial) getMaterial();

Expand Down Expand Up @@ -99,18 +100,25 @@ public BlockTileResolution getResolution() {
return resolution;
}

private static class MeshMaterial extends VolumeMipMaterial {
private MeshMaterial(OmeZarrBlockTileSource source, OmeZarrBlockTileKey tile, ImageColorModel imageColorModel, VolumeState volumeState, int colorChannel) throws IOException {
super(safeLoadData(source, tile, colorChannel), imageColorModel);
private static class MeshMaterial extends OmeZarrVolumeMipMaterial {
private MeshMaterial(OmeZarrBlockTileSource source, OmeZarrBlockTileKey tile, ImageColorModel imageColorModel, VolumeMipMaterial.VolumeState volumeState) throws IOException {
super(safeLoadData(source, tile), imageColorModel);
setVolumeState(volumeState);
}

private static Texture3d safeLoadData(OmeZarrBlockTileSource source, OmeZarrBlockTileKey tile, int colorChannel) throws IOException {
Texture3d brick = source.loadBrick(tile, colorChannel);
if (brick == null) {
throw new IOException("Load was interrupted");
// Load every channel of the block into its own single-component texture, preserving
// OME-Zarr's per-channel separation; the shader combines them at render time.
private static Texture3d[] safeLoadData(OmeZarrBlockTileSource source, OmeZarrBlockTileKey tile) throws IOException {
int channelCount = Math.max(1, Math.min(source.getChannelCount(), OmeZarrVolumeMipMaterial.MAX_CHANNELS));
Texture3d[] textures = new Texture3d[channelCount];
for (int c = 0; c < channelCount; ++c) {
Texture3d brick = source.loadBrick(tile, c);
if (brick == null) {
throw new IOException("Load was interrupted");
}
textures[c] = brick;
}
return brick;
return textures;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private void loadFromBlockSource() {
try {
state = OmeZarrBlockLoadRunner.State.LOADING;
OmeZarrVolumeActor parentActor = OmeZarrVolumeActor.getInstance();
blockActor = new OmeZarrVolumeMeshActor(omeZarrBlockTileSource, omeZarrOctreeBlockTileKey, parentActor.getVolumeState(), 0);
blockActor = new OmeZarrVolumeMeshActor(omeZarrBlockTileSource, omeZarrOctreeBlockTileKey, parentActor.getVolumeState());
state = OmeZarrBlockLoadRunner.State.LOADED;
setChanged();
long endTime = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,19 @@ public double getResolutionMicrometers() {
private static final ColorModel colorModel = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_GRAY), false, true, Transparency.OPAQUE, DataBuffer.TYPE_USHORT);

public Texture3d loadBrick(AutoContrastParameters parameters) {
return loadBrick(parameters, 0);
}

public Texture3d loadBrick(AutoContrastParameters parameters, int channel) {
Texture3d texture = new Texture3d();

try {
WritableRaster[] slices = TCZYXRasterZStack.fromDataset(dataset, readShape, readOffset, 1, parameters != null, parameters, null);
// readShape/readOffset are TCZYX; index 1 is the channel. Read one channel at a time
// into a single-component texture, leaving the key itself channel-agnostic.
int[] channelOffset = readOffset.clone();
channelOffset[1] = channel;

WritableRaster[] slices = TCZYXRasterZStack.fromDataset(dataset, readShape, channelOffset, 1, parameters != null, parameters, null);

texture.loadRasterSlices(slices, colorModel);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public class OmeZarrBlockTileSource implements BlockTileSource<OmeZarrBlockTileK
private final ArrayList<OmeZarrBlockResolution> resolutions = new ArrayList<>();
private OmeZarrBlockResolution maximumResolution = null;

private int channelCount = 1;

private final ImageColorModel imageColorModel;

private final boolean useAutoContrast;
Expand Down Expand Up @@ -128,6 +130,9 @@ private OmeZarrBlockTileSource init(OmeZarrReaderProgressObserver progressObserv
boundingBox3d = new BoundingBox3d(new Vec3(origin.getX(), origin.getY(), origin.getZ()), new Vec3(outerCorner.getX(), outerCorner.getY(), outerCorner.getZ()));
voxelCenter = boundingBox3d.getCenter();

// TCZYX: channel count is the C dimension; constant across resolution levels.
channelCount = Math.max(1, shapeIndex.getC());

haveExtents = true;
}

Expand Down Expand Up @@ -239,13 +244,16 @@ ConstVector3 getBlockSize(OmeZarrBlockResolution resolution) {
resolution.getChunkSize()[2] * resolution.getResolutionMicrometers());
}

public int getChannelCount() {
return channelCount;
}

public Texture3d loadBrick(OmeZarrBlockTileKey tile, int colorChannel) {
// setColorChannelIndex(colorChannel);
return loadBrick(tile);
return tile.loadBrick(useAutoContrast ? autoContrastParameters : null, colorChannel);
}

public Texture3d loadBrick(OmeZarrBlockTileKey tile) {
return tile.loadBrick(useAutoContrast ? autoContrastParameters : null);
return loadBrick(tile, 0);
}
/*
private void createTileKeysForDataset(OmeZarrDataset dataset, OmeZarrReaderProgressObserver progressReceiver) {
Expand Down
Loading
Loading