Skip to content

Commit

Permalink
Added a status message to ManualTransformationCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
tischi committed Jun 15, 2024
1 parent 31668b6 commit 1b6308b
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 9 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.0.4</version>
<version>5.0.6-SNAPSHOT</version>

<!-- force javadoc generation to fetch errors: -->
<!-- mvn javadoc:javadoc | grep error -->
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/embl/mobie/command/SpatialCalibration.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void setVoxelDimensions( MoBIESettings settings, String tablePath )
if ( rows.columnNames().contains( PixelSizeColumns.PIXEL_SIZE ) )
{
FinalVoxelDimensions voxelDimensions = new FinalVoxelDimensions(
rows.textColumn( PixelSizeColumns.PIXEL_UNIT ).get( 0 ),
rows.stringColumn( PixelSizeColumns.PIXEL_UNIT ).get( 0 ),
rows.doubleColumn( PixelSizeColumns.PIXEL_SIZE ).get( 0 ),
rows.doubleColumn( PixelSizeColumns.PIXEL_SIZE ).get( 0 ),
rows.doubleColumn( PixelSizeColumns.PIXEL_SIZE ).get( 0 )
Expand All @@ -40,7 +40,7 @@ public void setVoxelDimensions( MoBIESettings settings, String tablePath )
else
{
FinalVoxelDimensions voxelDimensions = new FinalVoxelDimensions(
rows.textColumn( PixelSizeColumns.PIXEL_UNIT ).get( 0 ),
rows.stringColumn( PixelSizeColumns.PIXEL_UNIT ).get( 0 ),
rows.doubleColumn( PixelSizeColumns.PIXEL_SIZE_X ).get( 0 ),
rows.doubleColumn( PixelSizeColumns.PIXEL_SIZE_Y ).get( 0 ),
rows.doubleColumn( PixelSizeColumns.PIXEL_SIZE_Z ).get( 0 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.embl.mobie.command.MoBIEManualTransformationEditor;
import org.embl.mobie.lib.image.Image;
import org.embl.mobie.lib.image.RegionAnnotationImage;
import org.scijava.ItemVisibility;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;
import org.scijava.widget.Button;
Expand All @@ -46,6 +47,9 @@
@Plugin(type = BdvPlaygroundActionCommand.class, menuPath = CommandConstants.CONTEXT_MENU_ITEMS_ROOT + "Transform>Registration - Manual")
public class ManualTransformationCommand extends AbstractTransformationCommand
{

public static final String INACTIVE = "Status: Manual transform inactive.";

static { net.imagej.patcher.LegacyInjector.preinit(); }

@Parameter ( label = "Start manual transform", callback = "startManualTransform" )
Expand All @@ -57,6 +61,9 @@ public class ManualTransformationCommand extends AbstractTransformationCommand
@Parameter ( label = "Cancel manual transform", callback = "cancelManualTransform" )
public Button cancelManualTransform;

@Parameter( visibility = ItemVisibility.MESSAGE )
private final String status = INACTIVE;

private MoBIEManualTransformationEditor transformationEditor;

@Override
Expand All @@ -71,6 +78,9 @@ public void startManualTransform()
transformationEditor = new MoBIEManualTransformationEditor( bdvHandle.getViewerPanel(), bdvHandle.getKeybindings() );
transformationEditor.setTransformableSources( movingSacs );
transformationEditor.setActive( true );

getInfo().getMutableInput( "status", String.class )
.setValue( this, "Status: You are transforming " + selectedSourceName + "...");
}

private void acceptManualTransform()
Expand All @@ -83,12 +93,18 @@ private void acceptManualTransform()
// but this is intended as the transformed image is now a new image that is stored as a new view.
// And this new transformed image will also be shown by the above applyTransform function.
transformationEditor.setActive( false );

getInfo().getMutableInput( "status", String.class )
.setValue( this, INACTIVE );
}

private void cancelManualTransform()
{
if ( transformationEditor == null ) return;

transformationEditor.setActive( false );

getInfo().getMutableInput( "status", String.class )
.setValue( this, INACTIVE );
}
}
12 changes: 10 additions & 2 deletions src/main/java/org/embl/mobie/lib/files/FileSourcesDataSetter.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void addDataAndDisplaysAndViews( Dataset dataset )
List< String > imageNames = sources.getSources();
ImageDataFormat imageDataFormat = ImageDataFormat.fromPath( sources.getPath( imageNames.get( 0 ) ) );

IJ.log(sources.name + " file type: " + imageDataFormat );
IJ.log( "\""+ sources.name + "\" file type: " + imageDataFormat );

for ( String imageName : imageNames )
{
Expand Down Expand Up @@ -339,7 +339,15 @@ else if ( sources.getGridType().equals( GridType.Transformed ) )
// construct and add the view
//
final ImageZoomViewerTransform viewerTransform = new ImageZoomViewerTransform( fileSourcesList.get( 0 ).getSources().get( 0 ), 0 );
final View view = new View( "all images", "data", displays, transformations, viewerTransform, false, null );
final View view = new View(
"all images",
"data",
displays,
transformations,
viewerTransform,
false,
null );
view.overlayNames( true );
dataset.views().put( view.getName(), view );
}
}
14 changes: 10 additions & 4 deletions src/test/java/projects/microbial_predation/MicrobialPredation.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ public static void main( String[] args )

OpenImageAndLabelsCommand command = new OpenImageAndLabelsCommand();

String root = "/Users/tischer/Documents/microbial-predation-data/";
command.image = new File( root + "test_timelapse_subset/.*.tif" );
command.labels = new File( root + "test_timelapse_results/.*_labels.tif" );
command.table = new File( root + "test_timelapse_results/.*_measurements.csv" );
// String root = "/Users/tischer/Documents/microbial-predation-data/";
// command.image = new File( root + "test_timelapse_subset/.*.tif" );
// command.labels = new File( root + "test_timelapse_results/.*_labels.tif" );
// command.table = new File( root + "test_timelapse_results/.*_measurements.csv" );
// command.spatialCalibration = SpatialCalibration.FromTable;

String root = "/Volumes/Microbial_Predation_Analysis_Dev/Interval_output";
command.image = new File( root, "Source/.*.tif" );
command.labels = new File( root , ".*_profile_labels.tif" );
command.table = new File( root, ".*_measurements.csv" );
command.spatialCalibration = SpatialCalibration.FromTable;

command.run();
Expand Down

0 comments on commit 1b6308b

Please sign in to comment.