Skip to content

Commit

Permalink
Let user also choose non-visible images for transformations, #1165
Browse files Browse the repository at this point in the history
  • Loading branch information
tischi committed Jul 3, 2024
1 parent bb5533e commit dbbf978
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 11 deletions.
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.1.2</version>
<version>5.1.3-SNAPSHOT</version>

<!-- force javadoc generation to fetch errors: -->
<!-- mvn javadoc:javadoc | grep error -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -164,7 +165,6 @@ protected void createAndSaveAffineTransformedImages(
}
}

// button callback => rename with care!
protected void setMovingImages()
{

Expand Down Expand Up @@ -220,7 +220,6 @@ protected void setMovingImages()
AffineTransform3D initialTransform = new AffineTransform3D();
movingSource.getFixedTransform( initialTransform );
movingSourcesToInitialTransform.put( movingSource, initialTransform );

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -79,6 +79,8 @@ public void applyTransform()

public void launchBigWarp()
{
setMovingImages();

ISourceAndConverterService sacService = SourceAndConverterServices.getSourceAndConverterService();
SourceAndConverterBdvDisplayService bdvDisplayService = SourceAndConverterServices.getBdvDisplayService();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand All @@ -59,6 +59,8 @@ public class EnterTransformationCommand extends AbstractTransformationCommand

private void applyTransform()
{
setMovingImages();

AffineTransform3D affineTransform3D = new AffineTransform3D();
affineTransform3D.set( parseStringToDoubleArray( transformation ) );
applyTransform( affineTransform3D );
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/embl/mobie/command/context/FlipCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down Expand Up @@ -69,6 +68,8 @@ public void initialize()

public void startManualTransform()
{
setMovingImages();

transformationEditor = new MoBIEManualTransformationEditor( bdvHandle.getViewerPanel(), bdvHandle.getKeybindings() );
transformationEditor.setTransformableSources( movingSacs );
transformationEditor.setActive( true );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] );

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/org/embl/mobie/lib/MoBIEHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit dbbf978

Please sign in to comment.