Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up display of SCIFIOCellImg (depends on PR in imglib2-ij) #202

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ Institute of Molecular Cell Biology and Genetics.</license.copyrightOwners>
<jmh.version>1.19</jmh.version>
<jmh-core.version>${jmh.version}</jmh-core.version>
<jmh-generator-annprocess.version>${jmh.version}</jmh-generator-annprocess.version>
<imglib2-ij.version>2.0.0-beta-44-SNAPSHOT</imglib2-ij.version>
</properties>

<repositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import net.imagej.display.ImageDisplay;
import net.imagej.display.ImageDisplayService;
import net.imglib2.img.display.imagej.ArrayImgToVirtualStack;
import net.imglib2.img.display.imagej.CellImgToVirtualStack;
import net.imglib2.img.display.imagej.ImgPlusViews;
import net.imglib2.img.display.imagej.ImgToVirtualStack;
import net.imglib2.img.display.imagej.PlanarImgToVirtualStack;
Expand Down Expand Up @@ -110,6 +111,8 @@ public ImagePlus createLegacyImage(final Dataset dataset,
private static ImagePlus createImagePlus( Dataset dataset )
{
ImgPlus< ? extends RealType< ? > > imgPlus = dataset.getImgPlus();
if( CellImgToVirtualStack.isSupported( imgPlus ) )
return CellImgToVirtualStack.wrap( imgPlus );
if( PlanarImgToVirtualStack.isSupported( imgPlus ) )
return PlanarImgToVirtualStack.wrap( imgPlus );
if( ArrayImgToVirtualStack.isSupported( imgPlus ) )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public class ImagePlusCreatorBenchmark
private final Dataset deepPlanarImg = makeDataset( PlanarImgs.unsignedBytes( deepDims ) );
private final Dataset small2dArrayImg = makeDataset( ArrayImgs.unsignedBytes( 10, 10 ) );
private final Dataset big2dArrayImg = makeDataset( ArrayImgs.unsignedBytes( 10000, 10000 ) );
private final Dataset cubicCellImgWithPlanarCells = makeDataset( new CellImgFactory<>( new UnsignedByteType(), 1000, 1000, 1 ).create( cubicDims ) );

@Benchmark
public void testSmallCellImg() {
Expand Down Expand Up @@ -118,6 +119,11 @@ public void testLarge2dArrayImg() {
creator.createLegacyImage( big2dArrayImg );
}

@Benchmark
public void testCubicCellImageWithPlanarCells() {
creator.createLegacyImage( cubicCellImgWithPlanarCells );
}

private Dataset makeDataset( Img< UnsignedByteType > deepPlanarImg )
{
AxisType[] axes = { Axes.X, Axes.Y, Axes.Z };
Expand Down