From f446f17be880ded2233a0d70ed778cc4b6251f2c Mon Sep 17 00:00:00 2001 From: Christian Tischer Date: Thu, 20 Jun 2024 09:06:14 +0200 Subject: [PATCH] Fixes #1160 --- .../context/CurrentLocationLoggerCommand.java | 2 +- .../mobie/lib/SourcesFromTableCreator.java | 11 ++++++-- .../embl/mobie/lib/bdv/view/SliceViewer.java | 3 ++- .../embl/mobie/lib/view/save/ViewSaver.java | 11 +++----- .../data/blobs/dataset.json | 26 ++++++++++++++++--- 5 files changed, 38 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/embl/mobie/command/context/CurrentLocationLoggerCommand.java b/src/main/java/org/embl/mobie/command/context/CurrentLocationLoggerCommand.java index 2c63efb09..26e4481e9 100644 --- a/src/main/java/org/embl/mobie/command/context/CurrentLocationLoggerCommand.java +++ b/src/main/java/org/embl/mobie/command/context/CurrentLocationLoggerCommand.java @@ -103,7 +103,7 @@ public static void logCurrentPosition( BdvHandle bdvHandle, Double distanceToRecentPosition = null; if ( mousePointer == null ) { - Logger.log( "To get this please use the \"" + SHORTCUT + "\" keyboard shortcut to trigger this action." ); + Logger.log( "Only given when using the [" + SHORTCUT + "] keyboard shortcut in the BDV window to trigger this action." ); } else { diff --git a/src/main/java/org/embl/mobie/lib/SourcesFromTableCreator.java b/src/main/java/org/embl/mobie/lib/SourcesFromTableCreator.java index 715749949..0e78891da 100644 --- a/src/main/java/org/embl/mobie/lib/SourcesFromTableCreator.java +++ b/src/main/java/org/embl/mobie/lib/SourcesFromTableCreator.java @@ -73,12 +73,19 @@ public SourcesFromTableCreator( String tablePath, List< String > imageColumns, L String fileName = table.getString( 0, imageColumn); String relativeFolder = table.getString( 0, imageColumn.replace( "FileName_", "PathName_" ) ); String referenceImagePath = MoBIEHelper.createAbsolutePath( root, fileName, relativeFolder ); - IJ.log( "Determining number of channels of " + imageColumn + " from " + referenceImagePath + "..." ); + IJ.log( "Determining number of channels of \"" + imageColumn + "\" from " + referenceImagePath + "..." ); int numChannels = ImageDataOpener.open( referenceImagePath, ThreadHelper.sharedQueue ).getNumDatasets(); IJ.log( "Number of channels: " + numChannels ); for ( int channelIndex = 0; channelIndex < numChannels; channelIndex++ ) { - imageFileSources.add( new ImageFileSources( imageColumn + "_C" + channelIndex, table, imageColumn, channelIndex, pathMapping, root, gridType ) ); + imageFileSources.add( new ImageFileSources( + imageColumn + "_C" + channelIndex, + table, + imageColumn, + channelIndex, + root, + pathMapping, + gridType ) ); } } else diff --git a/src/main/java/org/embl/mobie/lib/bdv/view/SliceViewer.java b/src/main/java/org/embl/mobie/lib/bdv/view/SliceViewer.java index e13eacbae..5ddda1221 100644 --- a/src/main/java/org/embl/mobie/lib/bdv/view/SliceViewer.java +++ b/src/main/java/org/embl/mobie/lib/bdv/view/SliceViewer.java @@ -219,7 +219,8 @@ public static BdvHandle createBdv( boolean is2D, String frameTitle ) sOptions.interpolate = false; IJ.log("BigDataViewer (BDV) initialised."); IJ.log("BDV navigation mode: " + ( is2D ? "2D" : "3D" )); - IJ.log("BDV interpolation: Nearest neighbour (Press \"I\" in BDV window to change this)" ); + IJ.log("BDV interpolation: Nearest neighbour"); + IJ.log(" - Use [I] keyboard shortcut in BDV window to change this" ); IJ.log("" ); IBdvSupplier bdvSupplier = new MobieBdvSupplier( sOptions ); diff --git a/src/main/java/org/embl/mobie/lib/view/save/ViewSaver.java b/src/main/java/org/embl/mobie/lib/view/save/ViewSaver.java index 3c068b78c..27da10549 100644 --- a/src/main/java/org/embl/mobie/lib/view/save/ViewSaver.java +++ b/src/main/java/org/embl/mobie/lib/view/save/ViewSaver.java @@ -115,7 +115,7 @@ public boolean saveViewDialog( View view ) if ( moBIE.getViews().containsKey( view.getName() ) ) { GenericDialog dialog = new GenericDialog( "Overwrite view?" ); - dialog.addMessage( view.getName() + " exists already; are you sure you want to overwrite it?" ); + dialog.addMessage( "A view named \"" + view.getName() + "\" exists already.\nAre you sure you want to overwrite it?" ); dialog.showDialog(); if ( ! dialog.wasOKed() ) { return false; @@ -206,7 +206,7 @@ private void saveNewViewToProject( View view, String viewJson ) { try { if ( viewJson.equals( "dataset.json" ) ) { - saveViewToDatasetJson( view, false ); + saveViewToDatasetJson( view ); } else { @@ -251,15 +251,10 @@ private void addViewToUi( View view ) moBIE.getUserInterface().addViews( views ); } - public void saveViewToDatasetJson( View view, boolean overwrite ) throws IOException + public void saveViewToDatasetJson( View view ) throws IOException { String datasetJsonPath = moBIE.absolutePath( "dataset.json"); Dataset dataset = new DatasetJsonParser().parseDataset( datasetJsonPath ); - - if ( ! overwrite ) - if ( dataset.views().containsKey( view.getName() ) ) - throw new IOException( "View saving aborted - this view name already exists!" ); - writeDatasetJson( dataset, view, datasetJsonPath ); IJ.log( "View \"" + view.getName() + "\" written to dataset.json" ); } diff --git a/src/test/resources/minimal-mobie-project/data/blobs/dataset.json b/src/test/resources/minimal-mobie-project/data/blobs/dataset.json index 477ebf27d..9b32751a2 100644 --- a/src/test/resources/minimal-mobie-project/data/blobs/dataset.json +++ b/src/test/resources/minimal-mobie-project/data/blobs/dataset.json @@ -28,7 +28,7 @@ "sources": [ "blobs" ], - "color": "r255-g255-b255-a255", + "color": "r=255,g=255,b=255,a=255", "contrastLimits": [ 0.0, 255.0 @@ -37,11 +37,31 @@ "invert": false, "name": "blobs", "opacity": 1.0, - "visible": true + "visible": true, + "blendingMode": "sum" } } ], - "isExclusive": false + "sourceTransforms": [], + "viewerTransform": { + "normalizedAffine": [ + 0.0016175016000465467, + 0.0, + 0.0, + -0.20623145400593473, + 0.0, + 0.0016175016000465467, + 0.0, + -0.20461395240588817, + 0.0, + 0.0, + 0.0016175016000465467, + 0.0 + ], + "timepoint": 0 + }, + "isExclusive": true, + "description": "" }, "default": { "uiSelectionGroup": "bookmark",