Skip to content

Commit

Permalink
Fixes #1160
Browse files Browse the repository at this point in the history
  • Loading branch information
tischi committed Jun 20, 2024
1 parent 98f0a6a commit f446f17
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/org/embl/mobie/lib/SourcesFromTableCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/embl/mobie/lib/bdv/view/SliceViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
11 changes: 3 additions & 8 deletions src/main/java/org/embl/mobie/lib/view/save/ViewSaver.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -206,7 +206,7 @@ private void saveNewViewToProject( View view, String viewJson ) {
try {
if ( viewJson.equals( "dataset.json" ) )
{
saveViewToDatasetJson( view, false );
saveViewToDatasetJson( view );
}
else
{
Expand Down Expand Up @@ -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" );
}
Expand Down
26 changes: 23 additions & 3 deletions src/test/resources/minimal-mobie-project/data/blobs/dataset.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand Down

0 comments on commit f446f17

Please sign in to comment.