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

ImageJFunctions wrap supports volatile types #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
20 changes: 13 additions & 7 deletions src/main/java/net/imglib2/img/display/imagej/ImageJFunctions.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@
import net.imglib2.type.numeric.integer.UnsignedIntType;
import net.imglib2.type.numeric.integer.UnsignedShortType;
import net.imglib2.type.numeric.real.FloatType;
import net.imglib2.type.volatiles.VolatileARGBType;
import net.imglib2.type.volatiles.VolatileDoubleType;
import net.imglib2.type.volatiles.VolatileFloatType;
import net.imglib2.type.volatiles.VolatileIntType;
import net.imglib2.type.volatiles.VolatileRealType;
import net.imglib2.type.volatiles.VolatileShortType;
import net.imglib2.type.volatiles.VolatileUnsignedByteType;
import net.imglib2.type.volatiles.VolatileUnsignedShortType;
import net.imglib2.util.Util;

import ij.ImagePlus;
Expand Down Expand Up @@ -223,19 +231,17 @@ public static < T extends NumericType< T > > ImagePlus wrap( final RandomAccessi
// see e.g. http://bugs.sun.com/view_bug.do?bug_id=6548436
// TODO: remove casting madness as soon as the bug is fixed
final Object oImg = img;
if ( ARGBType.class.isInstance( t ) )
if ( ARGBType.class.isInstance( t ) || VolatileARGBType.class.isInstance( t ))
target = wrapRGB( ( RandomAccessibleInterval< ARGBType > ) oImg, title, service );
else if ( UnsignedByteType.class.isInstance( t ) )
else if ( UnsignedByteType.class.isInstance( t ) || VolatileUnsignedByteType.class.isInstance( t ))
target = wrapUnsignedByte( ( RandomAccessibleInterval< RealType > ) oImg, title, service );
else if ( BitType.class.isInstance( t ) )
{
target = wrapBit( ( RandomAccessibleInterval< RealType > ) oImg, title, service );
}
else if ( IntegerType.class.isInstance( t ) )
else if (IntegerType.class.isInstance( t ) || VolatileIntType.class.isInstance( t ) || VolatileShortType.class.isInstance( t ) || VolatileUnsignedShortType.class.isInstance( t ))
target = wrapUnsignedShort( ( RandomAccessibleInterval< RealType > ) oImg, title, service );
else if ( RealType.class.isInstance( t ) )
else if ( RealType.class.isInstance( t ) || VolatileRealType.class.isInstance( t ) || VolatileFloatType.class.isInstance( t ) || VolatileDoubleType.class.isInstance( t ) )
target = wrapFloat( ( RandomAccessibleInterval< RealType > ) oImg, title, service );
else if ( ComplexType.class.isInstance( t ) )
else if ( ComplexType.class.isInstance( t ))
target = wrapFloat( ( RandomAccessibleInterval< ComplexType > ) oImg, new ComplexPowerGLogFloatConverter(), title, service );
else
{
Expand Down