diff --git a/pom.xml b/pom.xml index 13a1e434..856a03f2 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ org.embl.mobie mobie-viewer-fiji - 5.1.2 + 5.1.3-SNAPSHOT diff --git a/src/main/java/org/embl/mobie/command/context/AbstractTransformationCommand.java b/src/main/java/org/embl/mobie/command/context/AbstractTransformationCommand.java index 6e6baf1f..8abd9c52 100644 --- a/src/main/java/org/embl/mobie/command/context/AbstractTransformationCommand.java +++ b/src/main/java/org/embl/mobie/command/context/AbstractTransformationCommand.java @@ -70,7 +70,8 @@ public abstract class AbstractTransformationCommand extends DynamicCommand imple // style = "radioButtonHorizontal") // public String selectedSourceName; - @Parameter ( label = "Moving image(s)", callback = "setMovingImages" ) + // Note that this is populated by org.embl.mobie.command.widget.SwingSelectableImagesWidget + @Parameter ( label = "Moving image(s)" ) // , callback = "setMovingImages" public SelectableImages selectedImages = new SelectableImages(); @Parameter ( label = "Transformed image(s) suffix", @@ -133,7 +134,7 @@ protected void applyTransform( AffineTransform3D affineTransform3D ) // https://imagesc.zulipchat.com/#narrow/stream/327238-Fiji/topic/Close.20Scijava.20Command.20UI } - protected void createAndSaveAffineTransformedImages( + protected static void createAndSaveAffineTransformedImages( Collection< Image< ? > > movingImages, AffineTransform3D affineTransform3D, String suffix ) @@ -164,7 +165,6 @@ protected void createAndSaveAffineTransformedImages( } } - // button callback => rename with care! protected void setMovingImages() { @@ -220,7 +220,6 @@ protected void setMovingImages() AffineTransform3D initialTransform = new AffineTransform3D(); movingSource.getFixedTransform( initialTransform ); movingSourcesToInitialTransform.put( movingSource, initialTransform ); - } } diff --git a/src/main/java/org/embl/mobie/command/context/BigWarpRegistrationCommand.java b/src/main/java/org/embl/mobie/command/context/BigWarpRegistrationCommand.java index 511f9ea6..0386405d 100644 --- a/src/main/java/org/embl/mobie/command/context/BigWarpRegistrationCommand.java +++ b/src/main/java/org/embl/mobie/command/context/BigWarpRegistrationCommand.java @@ -55,10 +55,10 @@ public class BigWarpRegistrationCommand extends AbstractRegistrationCommand impl { static { net.imagej.patcher.LegacyInjector.preinit(); } - @Parameter ( label = "Launch BigWarp", callback = "launchBigWarp") + @Parameter ( label = "Launch BigWarp", callback = "launchBigWarp" ) private Button launchBigWarp; - @Parameter ( label = "Apply current transform and exit", callback = "applyTransform") + @Parameter ( label = "Apply transform", callback = "applyTransform" ) private Button applyTransform; private BigWarp< ? > bigWarp; @@ -79,6 +79,8 @@ public void applyTransform() public void launchBigWarp() { + setMovingImages(); + ISourceAndConverterService sacService = SourceAndConverterServices.getSourceAndConverterService(); SourceAndConverterBdvDisplayService bdvDisplayService = SourceAndConverterServices.getBdvDisplayService(); diff --git a/src/main/java/org/embl/mobie/command/context/EnterTransformationCommand.java b/src/main/java/org/embl/mobie/command/context/EnterTransformationCommand.java index e9daffeb..e5ea1a28 100644 --- a/src/main/java/org/embl/mobie/command/context/EnterTransformationCommand.java +++ b/src/main/java/org/embl/mobie/command/context/EnterTransformationCommand.java @@ -45,7 +45,7 @@ public class EnterTransformationCommand extends AbstractTransformationCommand @Parameter ( label = "Transformation 3D affine" ) public String transformation = Arrays.toString( new AffineTransform3D().getRowPackedCopy() ); - @Parameter ( label = "Apply", callback = "applyTransform" ) + @Parameter ( label = "Apply transform", callback = "applyTransform" ) public Button applyTransform; @@ -59,6 +59,8 @@ public class EnterTransformationCommand extends AbstractTransformationCommand private void applyTransform() { + setMovingImages(); + AffineTransform3D affineTransform3D = new AffineTransform3D(); affineTransform3D.set( parseStringToDoubleArray( transformation ) ); applyTransform( affineTransform3D ); diff --git a/src/main/java/org/embl/mobie/command/context/FlipCommand.java b/src/main/java/org/embl/mobie/command/context/FlipCommand.java index 1a4423b9..68463cba 100644 --- a/src/main/java/org/embl/mobie/command/context/FlipCommand.java +++ b/src/main/java/org/embl/mobie/command/context/FlipCommand.java @@ -67,6 +67,8 @@ public void initialize() public void applyTransform() { + setMovingImages(); + // FIXME: This needs a transform for each of the sacs AffineTransform3D transform = createFlipTransform( movingSacs.iterator().next() ); applyTransform( transform ); diff --git a/src/main/java/org/embl/mobie/command/context/ManualTransformationCommand.java b/src/main/java/org/embl/mobie/command/context/ManualTransformationCommand.java index 15714bdf..b7fb502d 100644 --- a/src/main/java/org/embl/mobie/command/context/ManualTransformationCommand.java +++ b/src/main/java/org/embl/mobie/command/context/ManualTransformationCommand.java @@ -41,7 +41,6 @@ @Plugin(type = BdvPlaygroundActionCommand.class, attrs = {}, menuPath = CommandConstants.CONTEXT_MENU_ITEMS_ROOT + "Transform>Registration - Manual") public class ManualTransformationCommand extends AbstractTransformationCommand { - public static final String INACTIVE = "Manual transform inactive"; static { net.imagej.patcher.LegacyInjector.preinit(); } @@ -69,6 +68,8 @@ public void initialize() public void startManualTransform() { + setMovingImages(); + transformationEditor = new MoBIEManualTransformationEditor( bdvHandle.getViewerPanel(), bdvHandle.getKeybindings() ); transformationEditor.setTransformableSources( movingSacs ); transformationEditor.setActive( true ); diff --git a/src/main/java/org/embl/mobie/command/widget/SwingSelectableImagesWidget.java b/src/main/java/org/embl/mobie/command/widget/SwingSelectableImagesWidget.java index 78d027bd..4b3739aa 100644 --- a/src/main/java/org/embl/mobie/command/widget/SwingSelectableImagesWidget.java +++ b/src/main/java/org/embl/mobie/command/widget/SwingSelectableImagesWidget.java @@ -69,8 +69,9 @@ public void set(final WidgetModel model) { super.set(model); BdvHandle bdvHandle = MoBIE.getInstance().getViewManager().getSliceViewer().getBdvHandle(); - List< SourceAndConverter< ? > > visibleSacs = MoBIEHelper.getVisibleSacs( bdvHandle ); - String[] names = visibleSacs.stream() + + List< SourceAndConverter< ? > > sacs = MoBIEHelper.getSacs( bdvHandle ); // MoBIEHelper.getVisibleSacs( bdvHandle ); + String[] names = sacs.stream() .map( sac -> sac.getSpimSource().getName() ) .collect( Collectors.toList() ).toArray( new String[ 0 ] ); diff --git a/src/main/java/org/embl/mobie/lib/MoBIEHelper.java b/src/main/java/org/embl/mobie/lib/MoBIEHelper.java index f0c514b4..ed20523b 100644 --- a/src/main/java/org/embl/mobie/lib/MoBIEHelper.java +++ b/src/main/java/org/embl/mobie/lib/MoBIEHelper.java @@ -317,6 +317,12 @@ else if ( currentTimeMillis - lastLogMillis.get() > 6000 ) return visibleSacs; } + public static List< SourceAndConverter< ? > > getSacs( BdvHandle bdv ) + { + final SourceAndConverterBdvDisplayService displayService = SourceAndConverterServices.getBdvDisplayService(); + return displayService.getSourceAndConverterOf( bdv ); + } + public static VoxelDimensions getPixelDimensions() { return new FinalVoxelDimensions( "pixel", 1.0, 1.0, 1.0 );