From a2c6c8424b1e949ff3920edc905ba85b891b2ff0 Mon Sep 17 00:00:00 2001 From: Christian Tischer Date: Thu, 26 Oct 2023 19:31:05 +0200 Subject: [PATCH] Add more --- .../org/embl/mobie/lib/color/ColorHelper.java | 1 - .../org/embl/mobie/lib/hcs/HCSDataAdder.java | 6 +- .../embl/mobie/lib/hcs/OperettaMetadata.java | 172 ++++++++++++------ .../java/org/embl/mobie/lib/hcs/Plate.java | 84 ++++----- .../java/org/embl/mobie/lib/hcs/Site.java | 27 ++- .../mobie/lib/hcs/SiteSpimDataCreator.java | 2 +- .../embl/mobie/lib/image/SpimDataImage.java | 4 +- 7 files changed, 187 insertions(+), 109 deletions(-) diff --git a/src/main/java/org/embl/mobie/lib/color/ColorHelper.java b/src/main/java/org/embl/mobie/lib/color/ColorHelper.java index c48b756cb..886cade6f 100644 --- a/src/main/java/org/embl/mobie/lib/color/ColorHelper.java +++ b/src/main/java/org/embl/mobie/lib/color/ColorHelper.java @@ -39,7 +39,6 @@ public abstract class ColorHelper { final static public double goldenRatio = 1.0 / ( 0.5 * Math.sqrt( 5 ) + 0.5 ); - public static final String RANDOM_FROM_GLASBEY = "randomFromGlasbey"; public static Color getColor( ARGBType argbType ) diff --git a/src/main/java/org/embl/mobie/lib/hcs/HCSDataAdder.java b/src/main/java/org/embl/mobie/lib/hcs/HCSDataAdder.java index 7048ab524..fac0ab2cd 100644 --- a/src/main/java/org/embl/mobie/lib/hcs/HCSDataAdder.java +++ b/src/main/java/org/embl/mobie/lib/hcs/HCSDataAdder.java @@ -30,10 +30,6 @@ import net.thisptr.jackson.jq.internal.misc.Strings; import org.embl.mobie.lib.annotation.AnnotatedRegion; -import org.embl.mobie.lib.hcs.Channel; -import org.embl.mobie.lib.hcs.Plate; -import org.embl.mobie.lib.hcs.Site; -import org.embl.mobie.lib.hcs.Well; import org.embl.mobie.lib.serialize.Dataset; import org.embl.mobie.lib.serialize.ImageDataSource; import org.embl.mobie.lib.serialize.View; @@ -197,7 +193,7 @@ public void addData( Dataset dataset ) private String getSiteID( Plate plate, Channel channel, Well well, Site site ) { - return getWellID( plate, channel, well ) + "-s" + site.getName(); + return getWellID( plate, channel, well ) + "-s" + site.getId(); } private String getWellID( Plate plate, Channel channel, Well well ) diff --git a/src/main/java/org/embl/mobie/lib/hcs/OperettaMetadata.java b/src/main/java/org/embl/mobie/lib/hcs/OperettaMetadata.java index d52cac1f4..36ae5679b 100644 --- a/src/main/java/org/embl/mobie/lib/hcs/OperettaMetadata.java +++ b/src/main/java/org/embl/mobie/lib/hcs/OperettaMetadata.java @@ -1,37 +1,9 @@ -/*- - * #%L - * Fiji viewer for MoBIE projects - * %% - * Copyright (C) 2018 - 2023 EMBL - * %% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * #L% - */ package org.embl.mobie.lib.hcs; -import ij.gui.PointRoi; -import ij.gui.Roi; +import ch.epfl.biop.bdv.img.opener.ChannelProperties; import mpicbg.spim.data.sequence.FinalVoxelDimensions; import mpicbg.spim.data.sequence.VoxelDimensions; +import org.embl.mobie.lib.color.ColorHelper; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -41,16 +13,25 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import java.awt.*; import java.io.File; import java.io.IOException; import java.util.HashMap; - +import java.util.LinkedHashMap; // one could extract an interface here for the // getter methods if this is useful for other data public class OperettaMetadata { - private HashMap< String, Element > filenameToMetadata; + private HashMap< String, Element > filenameToImageElement; + private HashMap< String, Element > channelIDToElement; + private HashMap< String, Integer > filenameToImageIndex; + private double dx; + private double dy; + private String spatialUnit; + private int imageSizeX; + private int imageSizeY; + private int maxIntensity; public OperettaMetadata( File xml ) { @@ -76,29 +57,57 @@ private void parse( File xml ) throws ParserConfigurationException, SAXException Document doc = builder.parse( xml ); doc.getDocumentElement().normalize(); - final double dx = Double.parseDouble( doc.getElementsByTagName( "ImageResolutionX" ).item( 0 ).getTextContent() ); - final double dy = Double.parseDouble( doc.getElementsByTagName( "ImageResolutionY" ).item( 0 ).getTextContent() ); - final String unit = doc.getElementsByTagName( "ImageResolutionX" ).item( 0 ).getAttributes().item( 0 ).getTextContent(); + dx = Double.parseDouble( doc.getElementsByTagName( "ImageResolutionX" ).item( 0 ).getTextContent() ); + dy = Double.parseDouble( doc.getElementsByTagName( "ImageResolutionY" ).item( 0 ).getTextContent() ); + spatialUnit = doc.getElementsByTagName( "ImageResolutionX" ).item( 0 ).getAttributes().item( 0 ).getTextContent(); + + // could be channel specific + // + imageSizeX = Integer.parseInt( doc.getElementsByTagName( "ImageSizeX" ).item( 0 ).getTextContent() ); + imageSizeY = Integer.parseInt( doc.getElementsByTagName( "ImageSizeY" ).item( 0 ).getTextContent() ); + + // could be channel specific + // + maxIntensity = Integer.parseInt( doc.getElementsByTagName( "MaxIntensity" ).item( 0 ).getTextContent() ); - filenameToMetadata = new HashMap<>(); - final NodeList fileNames = doc.getElementsByTagName( "URL" ); - final int numFiles = fileNames.getLength(); - for ( int i = 0; i < numFiles; i++ ) + filenameToImageElement = new LinkedHashMap<>(); + filenameToImageIndex = new LinkedHashMap<>(); + channelIDToElement = new LinkedHashMap<>(); + + final NodeList imageFileNames = doc.getElementsByTagName( "URL" ); + final int numImages = imageFileNames.getLength(); + for ( int imageIndex = 0; imageIndex < numImages; imageIndex++ ) { - final Node item = fileNames.item( i ); + final Node item = imageFileNames.item( imageIndex ); final Element parentNode = (Element) item.getParentNode(); - filenameToMetadata.put( item.getTextContent(), parentNode ); + filenameToImageElement.put( item.getTextContent(), parentNode ); + filenameToImageIndex.put( item.getTextContent(), imageIndex ); + } + + final NodeList channelIDs = doc.getElementsByTagName( "MaxIntensity" ); + final int numChannels = channelIDs.getLength(); + for ( int channelIndex = 0; channelIndex < numChannels; channelIndex++ ) + { + final Node item = channelIDs.item( channelIndex ); + final Element parentNode = (Element) item.getParentNode(); + final String channelID = parentNode.getAttributes().item( 0 ).getTextContent(); + channelIDToElement.put( channelID, parentNode ); } } public VoxelDimensions getVoxelDimensions( String path ) { - final Element element = getElement( path ); - final double imageResolutionX = getDouble( element, "ImageResolutionX" ); - final double imageResolutionY = getDouble( element, "ImageResolutionY" ); - final String unit = element.getElementsByTagName( "ImageResolutionX" ).item( 0 ).getAttributes().item( 0 ).getTextContent(); + // In Operetta 4 and 5 this is not consistently at the same position + // thus we just fetch it once globally. Hopefully it is the same for all + // images anyway. + + // This only works in Operetta 4 + // final Element element = getElement( path ); + // final double imageResolutionX = getDouble( element, "ImageResolutionX" ); + // final double imageResolutionY = getDouble( element, "ImageResolutionY" ); + // final String unit = element.getElementsByTagName( "ImageResolutionX" ).item( 0 ).getAttributes().item( 0 ).getTextContent(); - return new FinalVoxelDimensions( unit, imageResolutionX, imageResolutionY, 1.0 ); + return new FinalVoxelDimensions( spatialUnit, dx, dy, 1.0 ); } private double getDouble( Element element, String tag ) @@ -114,10 +123,36 @@ private double getDouble( Element element, String tag ) } } - private Element getElement( String path ) + private int getInteger( Element element, String tag ) + { + try + { + return Integer.parseInt( element.getElementsByTagName( tag ).item( 0 ).getTextContent() ); + } + catch ( Exception e ) + { + e.printStackTrace(); + throw new RuntimeException( e ); + } + } + + private String getString( Element element, String tag ) + { + try + { + return element.getElementsByTagName( tag ).item( 0 ).getTextContent(); + } + catch ( Exception e ) + { + e.printStackTrace(); + throw new RuntimeException( e ); + } + } + + private Element getImageElement( String path ) { final String filename = new File( path ).getName(); - final Element element = filenameToMetadata.get( filename ); + final Element element = filenameToImageElement.get( filename ); if ( element == null ) { System.err.println("Could not find operetta metadata for " + filename ); @@ -129,15 +164,44 @@ private Element getElement( String path ) public boolean contains( String path ) { final String filename = new File( path ).getName(); - return filenameToMetadata.containsKey( filename ); + return filenameToImageElement.containsKey( filename ); } public double[] getRealPosition( String path ) { - final Element element = getElement( path ); + final Element imageElement = getImageElement( path ); return new double[]{ - getDouble( element, "PositionX" ), - -getDouble( element, "PositionY" ) - }; + getDouble( imageElement, "PositionX" ), + -getDouble( imageElement, "PositionY" ) + }; + } + + public String getColor( String path ) + { + final Element imageElement = getImageElement( path ); + final String channelID = getString( imageElement, "ChannelID" ); + final Element channelElement = channelIDToElement.get( channelID ); + final int mainEmissionWavelength = getInteger( channelElement, "MainEmissionWavelength" ); + + final Color color = ChannelProperties.getColorFromWavelength( mainEmissionWavelength ); + final String string = ColorHelper.getString( ColorHelper.getARGBType( color ) ); + return string; + } + + public int getImageIndex( String path ) + { + return filenameToImageIndex.get( new File( path ).getName() ); + } + + public double[] getContrastLimits( String path ) + { + // TODO: fetch per channel via channelID of image + return new double[]{ 0, maxIntensity }; + } + + public int[] getSiteDimensions( String path ) + { + // TODO: fetch per channel via channelID of image + return new int[]{ imageSizeX, imageSizeY }; } -} +} \ No newline at end of file diff --git a/src/main/java/org/embl/mobie/lib/hcs/Plate.java b/src/main/java/org/embl/mobie/lib/hcs/Plate.java index bba6c51b6..b8b39d9b8 100644 --- a/src/main/java/org/embl/mobie/lib/hcs/Plate.java +++ b/src/main/java/org/embl/mobie/lib/hcs/Plate.java @@ -28,21 +28,22 @@ */ package org.embl.mobie.lib.hcs; -import bdv.SpimSource; -import bdv.viewer.Source; import ij.IJ; import ij.ImagePlus; import ij.io.Opener; import ij.measure.Calibration; import mpicbg.spim.data.SpimDataException; import mpicbg.spim.data.generic.AbstractSpimData; +import mpicbg.spim.data.generic.sequence.BasicViewSetup; import mpicbg.spim.data.sequence.FinalVoxelDimensions; import mpicbg.spim.data.sequence.VoxelDimensions; +import mpicbg.spim.data.generic.base.Entity; import org.embl.mobie.io.ImageDataFormat; import org.embl.mobie.io.SpimDataOpener; import org.embl.mobie.io.toml.TPosition; import org.embl.mobie.lib.color.ColorHelper; -import org.embl.mobie.lib.source.SourceToImagePlusConverter; + +import ch.epfl.biop.bdv.img.bioformats.entity.SeriesIndex; import java.io.File; import java.io.IOException; @@ -70,7 +71,9 @@ public class Plate private Set< TPosition > tPositions; private int wellsPerPlate; private ImageDataFormat imageDataFormat; - private OperettaMetadata metadata; + private OperettaMetadata operettaMetadata; + private AbstractSpimData< ? > spimDataPlate; + public Plate( String hcsDirectory ) throws IOException { @@ -99,14 +102,14 @@ public Plate( String hcsDirectory ) throws IOException hcsPattern = determineHCSPattern( hcsDirectory, imageSitePaths ); + // FIXME: remove support of Operetta?! if ( hcsPattern == HCSPattern.Operetta ) { //final File xml = new File( hcsDirectory, "Index.idx.xml" ); final File xml = new File( hcsDirectory, "Index.xml" ); - metadata = new OperettaMetadata( xml ); + operettaMetadata = new OperettaMetadata( xml ); } - - if ( hcsPattern == HCSPattern.OMEZarr.OMEZarr ) + else if ( hcsPattern == HCSPattern.OMEZarr ) { try { @@ -117,7 +120,8 @@ public Plate( String hcsDirectory ) throws IOException .mapToObj( i -> ( ( Integer ) i ).toString() ) .collect( Collectors.toList() ); hcsPattern.setChannels( channels ); - } catch ( SpimDataException e ) + } + catch ( SpimDataException e ) { e.printStackTrace(); throw new RuntimeException( e ); @@ -131,7 +135,7 @@ private void buildPlateMap( List< String > paths ) { channelWellSites = new HashMap<>(); tPositions = new HashSet<>(); - int numImages = 0; + int numValidImages = 0; IJ.log("Files: " + paths.size() ); @@ -140,16 +144,16 @@ private void buildPlateMap( List< String > paths ) if ( ! hcsPattern.setMatcher( path ) ) continue; - if ( metadata != null ) + if ( operettaMetadata != null ) { - if ( ! metadata.contains( path ) ) + if ( ! operettaMetadata.contains( path ) ) { IJ.log( "[WARNING] No metadata found for " + path ); continue; } } - numImages++; + numValidImages++; if ( imageDataFormat == null ) { @@ -170,31 +174,29 @@ private void buildPlateMap( List< String > paths ) channel = new Channel( channelName ); channelWellSites.put( channel, new HashMap<>() ); - ImagePlus singleChannel = hcsMetadata == null ? openImagePlus( path, channelName ) : null; + ImagePlus singleChannelImagePlus = operettaMetadata == null ? openImagePlus( path, channelName ) : null; // set channel metadata // - if ( hcsMetadata != null ) + if ( operettaMetadata != null ) { - - - final String color = hcsMetadata.getColor( path ); + final String color = operettaMetadata.getColor( path ); channel.setColor( color ); // TODO: There does not always seem to be enough metadata for the // contrast limits, thus opening one image may be worth it // then convert to image plus and run once auto contrast on it - final double[] contrastLimits = hcsMetadata.getContrastLimits( path ); + final double[] contrastLimits = operettaMetadata.getContrastLimits( path ); channel.setContrastLimits( contrastLimits ); } else // from image file { - final String color = ColorHelper.getString( singleChannel.getLuts()[ 0 ] ); + final String color = ColorHelper.getString( singleChannelImagePlus.getLuts()[ 0 ] ); channel.setColor( color ); final double[] contrastLimits = new double[]{ - singleChannel.getDisplayRangeMin(), - singleChannel.getDisplayRangeMax() + singleChannelImagePlus.getDisplayRangeMin(), + singleChannelImagePlus.getDisplayRangeMax() }; channel.setContrastLimits( contrastLimits ); } @@ -203,16 +205,16 @@ private void buildPlateMap( List< String > paths ) // if ( voxelDimensions == null ) { - if ( hcsMetadata != null ) + if ( operettaMetadata != null ) { - voxelDimensions = hcsMetadata.getVoxelDimensions( path ); - siteDimensions = hcsMetadata.getSiteDimensions( path ); + voxelDimensions = operettaMetadata.getVoxelDimensions( path ); + siteDimensions = operettaMetadata.getSiteDimensions( path ); } else // from image file { - final Calibration calibration = singleChannel.getCalibration(); + final Calibration calibration = singleChannelImagePlus.getCalibration(); voxelDimensions = new FinalVoxelDimensions( calibration.getUnit(), calibration.pixelWidth, calibration.pixelHeight, calibration.pixelDepth ); - siteDimensions = new int[]{ singleChannel.getWidth(), singleChannel.getHeight() }; + siteDimensions = new int[]{ singleChannelImagePlus.getWidth(), singleChannelImagePlus.getHeight() }; } // compute derived spatial metadata @@ -228,7 +230,7 @@ private void buildPlateMap( List< String > paths ) } // well // - String wellGroup = hcsScheme.getWell(); + String wellGroup = hcsPattern.getWellGroup(); Well well = getWell( channelWellSites, channel, wellGroup ); if ( well == null ) { @@ -241,13 +243,13 @@ private void buildPlateMap( List< String > paths ) // site // - final String siteGroup = hcsScheme.getSite(); + final String siteGroup = hcsPattern.getSiteGroup(); Site site = getSite( channelWellSites, channel, well, siteGroup ); if ( site == null ) { if ( imageDataFormat.equals( ImageDataFormat.SpimData ) ) { - final int imageIndex = hcsMetadata.getImageIndex( path ); + final int imageIndex = operettaMetadata.getImageIndex( path ); final BasicViewSetup viewSetup = spimDataPlate.getSequenceDescription().getViewSetupsOrdered().get( imageIndex ); IJ.log( "" ); final Map< String, Entity > attributes = viewSetup.getAttributes(); @@ -269,15 +271,15 @@ private void buildPlateMap( List< String > paths ) sitesPerWell = numSites; // needed to compute the site position within a well } - if ( hcsScheme.equals( HCSScheme.OMEZarr ) ) + if ( hcsPattern.equals( hcsPattern.OMEZarr ) ) { site.absolutePath = path; site.channel = Integer.parseInt( channelName ); } else { - final String t = hcsScheme.getT(); - final String z = hcsScheme.getZ(); + final String t = hcsPattern.getT(); + final String z = hcsPattern.getZ(); site.addPath( t, z, path ); tPositions.add( new TPosition( t ) ); } @@ -298,15 +300,15 @@ private ImagePlus openImagePlus( String path, String channelName ) final File file = new File( path ); return ( new Opener() ).openTiff( file.getParent(), file.getName() ); } - - if ( imageDataFormat.equals( ImageDataFormat.OmeZarr ) ) + else if ( imageDataFormat.equals( ImageDataFormat.OmeZarr ) ) { final int setupID = Integer.parseInt( channelName ); return MoBIEHelper.openOMEZarrAsImagePlus( path, setupID ); } - - return IJ.openImage( path ); - + else + { + return IJ.openImage( path ); + } } private Channel getChannel( HashMap< Channel, Map< Well, Set< Site > > > channelWellSites, String channelName ) @@ -338,7 +340,7 @@ private Site getSite( HashMap< Channel, Map< Well, Set< Site > > > channelWellSi { try { - return channelWellSites.get( channel ).get( well ).stream().filter( s -> s.getName().equals( siteName ) ).findFirst().get(); + return channelWellSites.get( channel ).get( well ).stream().filter( s -> s.getId().equals( siteName ) ).findFirst().get(); } catch ( NoSuchElementException e ) { @@ -394,7 +396,7 @@ public int[] getMolecularDevicesGridPosition( Site site ) if ( sitesPerWell == 1 ) return new int[]{ 0, 0 }; - int siteIndex = Integer.parseInt( site.getName() ) - 1; + int siteIndex = Integer.parseInt( site.getId() ) - 1; int numColumns = (int) Math.ceil( Math.sqrt( sitesPerWell ) ); int[] gridPosition = new int[ 2 ]; @@ -407,7 +409,7 @@ public int[] getMolecularDevicesGridPosition( Site site ) private int[] getOperettaGridPosition( Site site ) { final String path = site.getPaths().values().iterator().next().values().iterator().next(); - final double[] realPosition = metadata.getRealPosition( path ); + final double[] realPosition = operettaMetadata.getRealPosition( path ); final int[] position = new int[ 2 ]; for ( int d = 0; d < 2; d++ ) @@ -423,7 +425,7 @@ public int[] getDefaultGridPosition( Site site ) if ( sitesPerWell == 1 ) return new int[]{ 0, 0 }; - int siteIndex = Integer.parseInt( site.getName() ) - 1; + int siteIndex = Integer.parseInt( site.getId() ) - 1; int numSiteColumns = (int) Math.sqrt( sitesPerWell ); int[] gridPosition = new int[ 2 ]; diff --git a/src/main/java/org/embl/mobie/lib/hcs/Site.java b/src/main/java/org/embl/mobie/lib/hcs/Site.java index 88ea53ee4..e40617a1c 100644 --- a/src/main/java/org/embl/mobie/lib/hcs/Site.java +++ b/src/main/java/org/embl/mobie/lib/hcs/Site.java @@ -28,6 +28,7 @@ */ package org.embl.mobie.lib.hcs; +import mpicbg.spim.data.generic.AbstractSpimData; import mpicbg.spim.data.sequence.VoxelDimensions; import org.embl.mobie.io.ImageDataFormat; import org.embl.mobie.io.toml.TPosition; @@ -39,22 +40,33 @@ public class Site extends StorageLocation { - private final String name; + // The ID is not the final name of the corresponding image, + // but the image name will be concatenated also using the channel and well name. + private final String id; private int[] dimensions; private Map< TPosition, Map< ZPosition, String > > paths = new LinkedHashMap(); private VoxelDimensions voxelDimensions; private ImageDataFormat imageDataFormat; + private AbstractSpimData< ? > spimData; - public Site( String name, ImageDataFormat imageDataFormat ) + public Site( String id, ImageDataFormat imageDataFormat ) { - this.name = name; + this.id = id; this.imageDataFormat = imageDataFormat; this.channel = 0; } - public String getName() + public Site( String id, ImageDataFormat imageDataFormat, AbstractSpimData< ? > spimData, int imageIndex ) { - return name; + this.id = id; + this.imageDataFormat = imageDataFormat; + this.spimData = spimData; + this.channel = imageIndex; + } + + public String getId() + { + return id; } public int[] getDimensions() @@ -103,4 +115,9 @@ public ImageDataFormat getImageDataFormat() { return imageDataFormat; } + + public AbstractSpimData< ? > getSpimData() + { + return spimData; + } } diff --git a/src/main/java/org/embl/mobie/lib/hcs/SiteSpimDataCreator.java b/src/main/java/org/embl/mobie/lib/hcs/SiteSpimDataCreator.java index a52fc25b2..bf2705a47 100644 --- a/src/main/java/org/embl/mobie/lib/hcs/SiteSpimDataCreator.java +++ b/src/main/java/org/embl/mobie/lib/hcs/SiteSpimDataCreator.java @@ -72,7 +72,7 @@ public class SiteSpimDataCreator } } - final ImagePlus imagePlus = new ImagePlus( site.getName(), virtualStack ); + final ImagePlus imagePlus = new ImagePlus( site.getId(), virtualStack ); final Calibration calibration = new Calibration(); final VoxelDimensions voxelDimensions = site.getVoxelDimensions(); diff --git a/src/main/java/org/embl/mobie/lib/image/SpimDataImage.java b/src/main/java/org/embl/mobie/lib/image/SpimDataImage.java index ecfed673b..d879233ff 100644 --- a/src/main/java/org/embl/mobie/lib/image/SpimDataImage.java +++ b/src/main/java/org/embl/mobie/lib/image/SpimDataImage.java @@ -179,12 +179,12 @@ private AbstractSpimData openSpimData( ) { if ( site != null ) { - AbstractSpimData< ? > cachedSpimData = DataStore.getSpimData( site.getName() ); + AbstractSpimData< ? > cachedSpimData = DataStore.getSpimData( site.getId() ); if ( cachedSpimData != null ) return cachedSpimData; AbstractSpimData< ? > spimData = SiteSpimDataCreator.create( site, sharedQueue ); - DataStore.putSpimData( site.getName(), spimData ); + DataStore.putSpimData( site.getId(), spimData ); return spimData; }