Skip to content

Commit

Permalink
bug fix: channelIndex -> channel
Browse files Browse the repository at this point in the history
  • Loading branch information
tischi committed Feb 8, 2024
1 parent e72aeff commit 39a6a14
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/embl/mobie/MoBIE.java
Original file line number Diff line number Diff line change
Expand Up @@ -728,17 +728,17 @@ private void initDataSource( DataSource dataSource, String log )
{
// the whole plate is already initialised as one big SpimData
// note that channel <=> setupID
return new SpimDataImage( site.getSpimData(), site.channelIndex, name, settings.values.getRemoveSpatialCalibration() );
return new SpimDataImage( site.getSpimData(), site.channel, name, settings.values.getRemoveSpatialCalibration() );
}

if ( site.getImageDataFormat().equals( ImageDataFormat.OmeZarr ) )
{
return new SpimDataImage( ImageDataFormat.OmeZarr, site.absolutePath, site.channelIndex, name, ThreadHelper.sharedQueue, settings.values.getRemoveSpatialCalibration() );
return new SpimDataImage( ImageDataFormat.OmeZarr, site.absolutePath, site.channel, name, ThreadHelper.sharedQueue, settings.values.getRemoveSpatialCalibration() );
}

if ( site.getImageDataFormat().equals( ImageDataFormat.OmeZarrS3 ) )
{
return new SpimDataImage( ImageDataFormat.OmeZarrS3, site.absolutePath, site.channelIndex, name, ThreadHelper.sharedQueue, settings.values.getRemoveSpatialCalibration() );
return new SpimDataImage( ImageDataFormat.OmeZarrS3, site.absolutePath, site.channel, name, ThreadHelper.sharedQueue, settings.values.getRemoveSpatialCalibration() );
}

return new SpimDataImage( site, name, ThreadHelper.sharedQueue, settings.values.getRemoveSpatialCalibration() );
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/embl/mobie/lib/hcs/Plate.java
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ private void buildPlateMap( List< String > imagePaths )
if ( hcsPattern.equals( hcsPattern.OMEZarr ) )
{
site.absolutePath = imagePath;
site.channelIndex = channel.getChannelIndex();
site.channel = channel.getChannelIndex();
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/embl/mobie/lib/hcs/Site.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ public Site( String id, ImageDataFormat imageDataFormat )
{
this.id = id;
this.imageDataFormat = imageDataFormat;
this.channelIndex = 0;
this.channel = 0;
}

public Site( String id, ImageDataFormat imageDataFormat, AbstractSpimData< ? > spimData, int imageIndex )
{
this.id = id;
this.imageDataFormat = imageDataFormat;
this.spimData = spimData;
this.channelIndex = imageIndex;
this.channel = imageIndex;
}

public String getId()
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/embl/mobie/lib/io/StorageLocation.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ public class StorageLocation
// historically, we only had fluorescence channels,
// and thus the name of the variable is "channel" and cannot
// readily be changed because we use in the MoBIE JSON spec
public Integer channelIndex; // only for images, will default to zero if not set
public Integer channel; // only for images, will default to zero if not set

public Integer getChannel()
{
return channelIndex == null ? 0 : channelIndex;
return channel == null ? 0 : channel;
}

public void setChannel( Integer channel )
{
this.channelIndex = channel;
this.channel = channel;
}
}
50 changes: 50 additions & 0 deletions src/test/java/projects/jonas/OpenLocalJonas.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*-
* #%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 projects.jonas;

import net.imagej.ImageJ;
import org.embl.mobie.MoBIE;
import org.embl.mobie.MoBIESettings;
import org.embl.mobie.lib.io.DataFormats;

import java.io.IOException;

public class OpenLocalJonas
{
public static void main( String[] args ) throws IOException
{
final ImageJ imageJ = new ImageJ();
imageJ.ui().showUI();

MoBIESettings settings = new MoBIESettings();
settings.preferentialDataLocation( DataFormats.Location.Local );
settings.view( "5488_5533" );
final MoBIE moBIE = new MoBIE( "/Volumes/kreshuk/hellgoth/mobie_project_shared/culture-collections/data/", settings);
}
}

0 comments on commit 39a6a14

Please sign in to comment.