Skip to content

Commit

Permalink
Collection table with contrasts per grid position
Browse files Browse the repository at this point in the history
  • Loading branch information
tischi committed Oct 18, 2024
1 parent 9a0e954 commit 69cedce
Show file tree
Hide file tree
Showing 45 changed files with 725 additions and 315 deletions.
11 changes: 11 additions & 0 deletions .checksums
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
356acc218258751f5e1ed53ee870d42ab21dd673 20231226200404 README.md
2c83491b886d08de395d00c4022aba2a85c71bba 20230807160348 images/74152530-c9603500-4c0e-11ea-81d8-d518b9ed1ef3.png
82fdb8b52f6193f76125d9890d321bef40df48c1 20230807160348 images/74152904-98cccb00-4c0f-11ea-9819-6c772174a2c0.png
a375450e7776d246071f5b50c9f477b8f96eccde 20230807160348 images/74152986-cc0f5a00-4c0f-11ea-869d-23456fec0cdc.png
bec35cfbf13684d4ef73521e737b7f691492c7f6 20230807160348 images/74168546-37febc00-4c2a-11ea-9981-85232ed5322e.png
11f8d83f03952423124d3f46a7a22189fb052190 20230807160348 images/74252332-d2740380-4ced-11ea-9a4e-d25cb1e83859.png
d238dc37c990bc99d20ed721e1fc7830f999fadc 20230807160348 images/mobie-beta-update-site.png
2c4cbd6b245d453691974d4d94d6a95e3a5441a6 20230807160348 images/mobie-logo-highres.png
25f4e1de2d22ac36510a496229e4b51d47134f13 20231206194322 scripts/visualise_morpholibj_2d_output.ijm
6163a44341132da743ca32573b1b8bed7139b85c 20231206194322 scripts/visualise_morpholibj_3d_output.ijm
c0b74dc4fb1134303d666aa3e4455c6d54487e05 20231206194322 scripts/visualise_particleanalyzer_2d_output.ijm
Binary file added db.xml.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<groupId>org.embl.mobie</groupId>
<artifactId>mobie-viewer-fiji</artifactId>
<version>5.3.10-SNAPSHOT</version>
<version>5.5.0</version>
<!-- mvn clean install -Dmaven.test.skip=true -Dscijava.app.directory=/Users/tischer/Desktop/Fiji/Fiji-MoBIE.app -->

<!-- ../scijava-scripts/release-version.sh - -skip-version-check - -skip-license-update -->
Expand Down
25 changes: 21 additions & 4 deletions src/main/java/org/embl/mobie/MoBIE.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.embl.mobie.io.util.IOHelper;
import org.embl.mobie.io.util.S3Utils;
import org.embl.mobie.lib.*;
import org.embl.mobie.lib.bdv.BdvViewingMode;
import org.embl.mobie.lib.data.*;
import org.embl.mobie.lib.hcs.HCSDataSetter;
import org.embl.mobie.lib.hcs.Plate;
Expand All @@ -52,6 +53,7 @@
import org.embl.mobie.lib.io.StorageLocation;
import org.embl.mobie.lib.serialize.*;
import org.embl.mobie.lib.table.TableDataFormat;
import org.embl.mobie.lib.table.columns.CollectionTableConstants;
import org.embl.mobie.lib.table.saw.TableOpener;
import org.embl.mobie.lib.transform.GridType;
import org.embl.mobie.lib.view.ViewManager;
Expand All @@ -61,6 +63,7 @@
import sc.fiji.bdvpg.PlaygroundPrefs;
import sc.fiji.bdvpg.scijava.services.SourceAndConverterService;
import sc.fiji.bdvpg.services.SourceAndConverterServices;
import tech.tablesaw.api.ColumnType;
import tech.tablesaw.api.Table;
import tech.tablesaw.io.csv.CsvReadOptions;

Expand All @@ -74,8 +77,8 @@
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;

import static org.embl.mobie.io.util.IOHelper.combinePath;
import static org.embl.mobie.io.util.IOHelper.getFileName;
import static org.embl.mobie.io.util.IOHelper.*;
import static org.embl.mobie.lib.table.saw.TableOpener.determineDelimiter;

public class MoBIE
{
Expand Down Expand Up @@ -115,7 +118,19 @@ public MoBIE( String uri, MoBIESettings settings ) throws IOException
IJ.log("\n# MoBIE" );
IJ.log("Opening collection table: " + uri );

final Table table = TableOpener.openDelimitedTextFile( uri );
// Read the table

HashMap< String, ColumnType > nameToType = new HashMap<>();
nameToType.put( CollectionTableConstants.GRID, ColumnType.STRING );
nameToType.put( CollectionTableConstants.VIEW, ColumnType.STRING );

String content = IOHelper.read( uri );
CsvReadOptions.Builder builder =
CsvReadOptions.builderFromString( content )
.separator( determineDelimiter( uri ) )
.missingValueIndicator( "na", "none", "nan" )
.columnTypesPartial( nameToType );
Table table = Table.read().usingOptions( builder );

initImageJAndMoBIE();
initProject( IOHelper.getFileName( uri ) );
Expand Down Expand Up @@ -416,7 +431,9 @@ private void buildUI()
{
userInterface = new UserInterface( this );
adjustLogWindow( userInterface );
viewManager = new ViewManager( this, userInterface, dataset.is2D() );

boolean is2D = dataset.is2D() || settings.values.getBdvViewingMode().equals( BdvViewingMode.TwoDimensional );
viewManager = new ViewManager( this, userInterface, is2D );
}

private View getView( String viewName, Dataset dataset )
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/org/embl/mobie/MoBIESettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
package org.embl.mobie;

import mpicbg.spim.data.sequence.VoxelDimensions;
import org.embl.mobie.lib.bdv.BdvViewingMode;
import org.embl.mobie.lib.io.DataFormats;
import org.embl.mobie.lib.serialize.View;
import org.embl.mobie.lib.table.TableDataFormat;
Expand Down Expand Up @@ -126,6 +127,11 @@ public MoBIESettings dataRoot( String dataRoot )
return this;
}

public MoBIESettings bdvViewingMode( BdvViewingMode bdvViewingMode )
{
this.values.bdvViewingMode = bdvViewingMode;
return this;
}

public static class Values
{
Expand All @@ -143,6 +149,8 @@ public static class Values
private ProjectType projectType = ProjectType.MoBIEJSON;
private String dataRoot = null;

private BdvViewingMode bdvViewingMode = BdvViewingMode.ThreeDimensional;

public String getDataRoot()
{
return dataRoot;
Expand Down Expand Up @@ -212,5 +220,10 @@ public ProjectType getProjectType()
{
return projectType;
}

public BdvViewingMode getBdvViewingMode()
{
return bdvViewingMode;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.embl.mobie.ProjectType;
import org.embl.mobie.command.CommandConstants;
import org.embl.mobie.lib.MoBIEHelper;
import org.embl.mobie.lib.bdv.BdvViewingMode;
import org.scijava.command.Command;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;
Expand Down Expand Up @@ -65,6 +66,12 @@ public static enum DataRoot{
required = false )
public File dataRootFile;

@Parameter( label = "Viewing mode",
description = "Volumetric viewing enables arbitrary plane slicing. Planar viewing mode will restrict browsing to the XY, YZ, or XZ planes.",
required = false )
public BdvViewingMode bdvViewingMode = BdvViewingMode.ThreeDimensional;


@Override
public void run()
{
Expand All @@ -87,7 +94,8 @@ public void run()

final MoBIESettings settings = new MoBIESettings()
.projectType( ProjectType.CollectionTable )
.dataRoot( dataRootString );
.dataRoot( dataRootString )
.bdvViewingMode( bdvViewingMode );

try
{
Expand Down
40 changes: 26 additions & 14 deletions src/main/java/org/embl/mobie/command/open/OpenOMEZARRCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,31 @@ public class OpenOMEZARRCommand implements Command {

static { net.imagej.patcher.LegacyInjector.preinit(); }

@Parameter( label = "Image URI", description = "Local path or S3 address to an OME-Zarr multi-scale image.")
public String image = "https://s3.embl.de/i2k-2020/platy-raw.ome.zarr";

@Parameter( label = "( Labels URI )", description = "Optional. Local path or S3 address to an OME-Zarr label mask multi-scale image.", required = false )
public String labels = "https://s3.embl.de/i2k-2020/platy-raw.ome.zarr/labels/cells";

@Parameter( label = "( Labels Table URI )", description = "Optional. Local path or S3 address to an table with label mask features.", required = false )
public String table; // FIXME: Add a cells table

@Parameter ( label = "( S3 Access Key )", description = "Optional. Access key for a protected S3 bucket.", persist = false )
@Parameter( label = "Multi-scale Image URI",
description = "Local path or S3 address to an OME-Zarr multi-scale image."
)
public String image; // = "https://s3.embl.de/i2k-2020/platy-raw.ome.zarr";

@Parameter( label = "( Labels URI )",
description = "Optional. Local path or S3 address to an OME-Zarr label mask multi-scale image.",
required = false )
public String labels; // = "https://s3.embl.de/i2k-2020/platy-raw.ome.zarr/labels/cells";

@Parameter( label = "( Labels Table URI )",
description = "Optional. Local path or S3 address to an table with label mask features.",
required = false )
public String table; // FIXME: Add a cells table example

@Parameter ( label = "( S3 Access Key )",
description = "Optional. Access key for a protected S3 bucket.",
persist = false,
required = false )
public String s3AccessKey;

@Parameter ( label = "( S3 Secret Key )", description = "Optional. Secret key for a protected S3 bucket.", persist = false )
@Parameter ( label = "( S3 Secret Key )",
description = "Optional. Secret key for a protected S3 bucket.",
persist = false,
required = false )
public String s3SecretKey;

@Override
Expand All @@ -69,13 +81,13 @@ public void run() {
settings.s3AccessAndSecretKey( new String[]{ s3AccessKey, s3SecretKey } );

final ArrayList< String > imageList = new ArrayList<>();
if ( image != null ) imageList.add( image );
if ( image != null && ! image.isEmpty() ) imageList.add( image );

final ArrayList< String > labelsList = new ArrayList<>();
if ( labels != null ) labelsList.add( labels );
if ( labels != null && ! labels.isEmpty() ) labelsList.add( labels );

final ArrayList< String > tablesList = new ArrayList<>();
if ( table != null ) tablesList.add( table );
if ( table != null && ! table.isEmpty() ) tablesList.add( table );

try
{
Expand Down
28 changes: 22 additions & 6 deletions src/main/java/org/embl/mobie/command/open/OpenTableCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,37 @@ public class OpenTableCommand implements Command {
@Parameter( label = "Table Path", required = true )
public File table;

@Parameter( label = "Image Path Columns (Comma Separated)", required = true )
@Parameter( label = "Image Path Column(s)",
required = true,
description = "The name(s) of the table columns containing paths to images that you want to open.\n" +
"You can enter multiple columns using comma-separation.\n" +
"Example:\n" +
"Path_DAPI,Path_GFP"
)
public String images;

@Parameter( label = "Labels Path Columns (Comma Separated)", required = false )
@Parameter( label = "Labels Path Column(s)",
required = false,
description = "Optional.\n" +
"The name(s) of the table columns containing paths to label masks that you want to open.\n" +
"You can enter multiple columns using comma-separation.\n" +
"Example:\n" +
"Path_Nuclei_Labels,Path_Cell_Labels"
)
public String labels;

@Parameter( label = "Data Root Folder",
style = "directory",
description = "Use this is if the paths to the images and labels in the table are relative.",
description = "Optional.\n" +
"Use this is if the paths to the images and labels in the table are relative.",
required = false )
public File root;

@Parameter( label = "Path Mapping (From,To)",
description = "If the data was analysed on a different computer.\n" +
"For example from Linux to MacOS: \"/g,/Volumes\"",
@Parameter( label = "Path Mapping: From,To",
description = "Optional.\n" +
"Use this if the data was analysed on a different computer.\n" +
"Example mapping Linux to MacOS:\n" +
"/g,/Volumes",
required = false )
public String pathMapping;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/*-
* #%L
* Fiji viewer for MoBIE projects
* %%
* Copyright (C) 2018 - 2024 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.command.open.special;

import loci.common.DebugTools;
import org.embl.mobie.MoBIE;
import org.embl.mobie.MoBIESettings;
import org.embl.mobie.command.CommandConstants;
import org.embl.mobie.command.SpatialCalibration;
import org.embl.mobie.lib.MoBIEHelper;
import org.embl.mobie.lib.transform.GridType;
import org.scijava.ItemVisibility;
import org.scijava.command.Command;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@Plugin(type = Command.class, menuPath = CommandConstants.MOBIE_PLUGIN_OPEN + "Special>Open Microglia Morphometry Table..." )
public class OpenMicrogliaTableCommand implements Command {

static { net.imagej.patcher.LegacyInjector.preinit(); }

@Parameter( label = "Table", required = true )
public File table;

@Parameter(visibility = ItemVisibility.MESSAGE,
persist = false,
required = false )
private String message = "Opens tables created with the Microglia-Morphometry plugin.";

@Parameter(visibility = ItemVisibility.MESSAGE,
persist = false,
required = false)
private String info = "More info: https://github.com/embl-cba/microglia-morphometry";


private String images = "Path_Intensities,Path_Skeletons,Path_Annotations";

private String labels = "Path_LabelMasks";

private File root;

private String pathMapping;

private SpatialCalibration spatialCalibration = SpatialCalibration.FromImage;

private GridType gridType = GridType.Transformed;

@Override
public void run()
{
run( gridType );
}

private void run( GridType gridType )
{
DebugTools.setRootLevel( "OFF" );

final MoBIESettings settings = new MoBIESettings();

spatialCalibration.setVoxelDimensions( settings, table != null ? table.getAbsolutePath() : null );
root = table.getParentFile();

List< String > imageList = new ArrayList<>();
if ( images != null && ! images.equals( "" ) )
{
imageList = Arrays.asList( images.split( "," ) );
imageList = imageList.stream().map( s -> s.trim() ).collect( Collectors.toList() );
}

List< String > labelList = new ArrayList<>();
if ( labels != null && ! labels.equals( "" ) )
{
labelList = Arrays.asList( labels.split( "," ) );
labelList = labelList.stream().map( s -> s.trim() ).collect( Collectors.toList() );
}

try
{
String rootPath = root == null ? null : root.getAbsolutePath();
new MoBIE( table.getAbsolutePath(), imageList, labelList, rootPath, pathMapping ,gridType, settings );
}
catch ( IOException e )
{
e.printStackTrace();
}
}
}
Loading

0 comments on commit 69cedce

Please sign in to comment.