Skip to content

Commit

Permalink
Add Screenshot Stack Command, #1191
Browse files Browse the repository at this point in the history
  • Loading branch information
tischi committed Nov 26, 2024
1 parent 9d3353c commit cb1aa30
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 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.5.7-SNAPSHOT</version>
<version>5.5.7</version>

<!-- mvn clean install -Dmaven.test.skip=true -Dscijava.app.directory=/Users/tischer/Desktop/Fiji/Fiji-MoBIE.app -->
<!-- ../scijava-scripts/release-version.sh - -skip-version-check - -skip-license-update -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import ij.IJ;
import ij.ImagePlus;
import ij.ImageStack;
import ij.measure.Calibration;
import net.imglib2.realtransform.AffineTransform3D;
import net.imglib2.util.LinAlgHelpers;
import org.embl.mobie.MoBIE;
Expand Down Expand Up @@ -82,14 +83,15 @@ public void run()
System.out.println( screenToPhysicalScale );

// move viewer to starting point
viewerTransform.translate( 0, 0, -numSlices * physicalSliceDistance * screenToPhysicalScale );
viewerTransform.translate( 0, 0, - numSlices * physicalSliceDistance * screenToPhysicalScale );
bdvHandle.getViewerPanel().state().setViewerTransform( viewerTransform );
bdvHandle.getViewerPanel().requestRepaint();

// collect all slices
ImageStack rgbStack = new ImageStack();
CompositeImage compositeImage = null; // TODO
ImageStack compositeStack = new ImageStack();
numSlices = numSlices * 2 + 1;
Calibration calibration = null;

for ( int sliceIndex = 0; sliceIndex < numSlices; sliceIndex++ )
{
Expand All @@ -106,6 +108,13 @@ public void run()
try
{
rgbStack.addSlice( screenShotMaker.getRGBImagePlus().getProcessor() );
ImageStack stack = screenShotMaker.getCompositeImagePlus().getStack();
for ( int i = 0; i < stack.size(); i++ )
{
compositeStack.addSlice( stack.getProcessor( i + 1 ) );
}

calibration = screenShotMaker.getRGBImagePlus().getCalibration();
}
catch ( Exception e )
{
Expand All @@ -118,11 +127,19 @@ public void run()
}
}

bdvHandle.getViewerPanel().state().setViewerTransform( initialViewerTransform );
bdvHandle.getViewerPanel().requestRepaint();

calibration.pixelDepth = physicalSliceDistance;

ImagePlus rgbImage = new ImagePlus( "RGB stack", rgbStack );
rgbImage.setDimensions( 1, rgbStack.size(), 1 );
rgbImage.setCalibration( calibration );
rgbImage.show();

bdvHandle.getViewerPanel().state().setViewerTransform( initialViewerTransform );
bdvHandle.getViewerPanel().requestRepaint();
CompositeImage compositeImage = new CompositeImage( new ImagePlus( "Composite stack", compositeStack ) );
compositeImage.setDimensions( compositeStack.size() / rgbStack.size(), rgbStack.size(), 1 );
compositeImage.setCalibration( calibration );
compositeImage.show();
}
}

0 comments on commit cb1aa30

Please sign in to comment.