diff --git a/src/main/java/org/embl/mobie/lib/table/saw/TableOpener.java b/src/main/java/org/embl/mobie/lib/table/saw/TableOpener.java index ca1ea7229..2733f096b 100644 --- a/src/main/java/org/embl/mobie/lib/table/saw/TableOpener.java +++ b/src/main/java/org/embl/mobie/lib/table/saw/TableOpener.java @@ -119,7 +119,8 @@ private static Table openTableFile( StorageLocation storageLocation, String chun } else { - final String path = resolveTablePath( IOHelper.combinePath( storageLocation.absolutePath, chunk ) ); + String tablePath = chunk != null ? IOHelper.combinePath( storageLocation.absolutePath, chunk ) : storageLocation.absolutePath; + final String path = resolveTablePath( tablePath ); final Character separator = tableDataFormat.getSeparator(); return openDelimitedTextFile( numSamples, path, separator ); } diff --git a/src/test/java/org/embl/mobie/command/open/OpenCollectionTableCommandTest.java b/src/test/java/org/embl/mobie/command/open/OpenCollectionTableCommandTest.java index b547b6c3d..cfd855ce5 100644 --- a/src/test/java/org/embl/mobie/command/open/OpenCollectionTableCommandTest.java +++ b/src/test/java/org/embl/mobie/command/open/OpenCollectionTableCommandTest.java @@ -11,7 +11,7 @@ public class OpenCollectionTableCommandTest static { net.imagej.patcher.LegacyInjector.preinit(); } @Test - public void blobsTable( ) + public void blobs( ) { final ImageJ imageJ = new ImageJ(); imageJ.ui().showUI(); @@ -25,7 +25,7 @@ public void blobsTable( ) } @Test - public void clemTable( ) + public void clem( ) { final ImageJ imageJ = new ImageJ(); imageJ.ui().showUI(); @@ -37,21 +37,52 @@ public void clemTable( ) } @Test - public void gridTable( ) + public void grid( ) { final ImageJ imageJ = new ImageJ(); imageJ.ui().showUI(); OpenCollectionTableCommand command = new OpenCollectionTableCommand(); command.table = new File( "src/test/resources/collections/blobs-grid-table.txt" ); + // FIXME: Make this work with relative paths command.dataRoot = OpenCollectionTableCommand.DataRoot.UseBelowDataRootFolder; command.dataRootFile = new File( "/Users/tischer/Documents/mobie-viewer-fiji/src/test/resources/collections" ); command.bdvViewingMode = BdvViewingMode.TwoDimensional; command.run(); } + @Test + public void spots2D( ) + { + final ImageJ imageJ = new ImageJ(); + imageJ.ui().showUI(); + + OpenCollectionTableCommand command = new OpenCollectionTableCommand(); + command.table = new File( "src/test/resources/collections/spots-2d-collection.txt" ); + // FIXME: Make this work with relative paths + command.dataRoot = OpenCollectionTableCommand.DataRoot.UseBelowDataRootFolder; + command.dataRootFile = new File( "/Users/tischer/Documents/mobie-viewer-fiji/src/test/resources/collections" ); + command.bdvViewingMode = BdvViewingMode.TwoDimensional; + command.run(); + } + + @Test + public void spots3D( ) + { + final ImageJ imageJ = new ImageJ(); + imageJ.ui().showUI(); + + OpenCollectionTableCommand command = new OpenCollectionTableCommand(); + command.table = new File( "src/test/resources/collections/spots-3d-collection.txt" ); + // FIXME: Make this work with relative paths + command.dataRoot = OpenCollectionTableCommand.DataRoot.UseBelowDataRootFolder; + command.dataRootFile = new File( "/Users/tischer/Documents/mobie-viewer-fiji/src/test/resources/collections" ); + command.bdvViewingMode = BdvViewingMode.ThreeDimensional; + command.run(); + } + public static void main( String[] args ) { - new OpenCollectionTableCommandTest().gridTable(); + new OpenCollectionTableCommandTest().spots3D(); } } \ No newline at end of file diff --git a/src/test/resources/collections/spots-2d-collection.txt b/src/test/resources/collections/spots-2d-collection.txt new file mode 100644 index 000000000..91c33db48 --- /dev/null +++ b/src/test/resources/collections/spots-2d-collection.txt @@ -0,0 +1,2 @@ +uri name type +spots-2d.txt spots spots \ No newline at end of file diff --git a/src/test/resources/collections/spots-2d.txt b/src/test/resources/collections/spots-2d.txt new file mode 100644 index 000000000..895bc780c --- /dev/null +++ b/src/test/resources/collections/spots-2d.txt @@ -0,0 +1,5 @@ +spot_id x y +1 10 0 +2 0 10 +3 0 0 +4 10 10 \ No newline at end of file diff --git a/src/test/resources/collections/spots-3d-collection.txt b/src/test/resources/collections/spots-3d-collection.txt new file mode 100644 index 000000000..dc70880c4 --- /dev/null +++ b/src/test/resources/collections/spots-3d-collection.txt @@ -0,0 +1,2 @@ +uri name type +spots-3d.txt spots spots \ No newline at end of file diff --git a/src/test/resources/collections/spots-3d.txt b/src/test/resources/collections/spots-3d.txt new file mode 100644 index 000000000..298f60149 --- /dev/null +++ b/src/test/resources/collections/spots-3d.txt @@ -0,0 +1,5 @@ +spot_id x y z +1 10 0 0 +2 0 10 0.25 +3 0 0 0 +4 10 10 0.25 \ No newline at end of file