@Override public ImagePlusImgFactory< T > factory() { return new ImagePlusImgFactory< T >(); }
protected ImagePlusImg( final int width, final int height, final int depth, final int frames, final int channels, final int entitiesPerPixel ) { super( reduceDimensions( new long[] { width, height, channels, depth, frames } ), entitiesPerPixel ); this.width = width; this.height = height; this.depth = depth; this.frames = frames; this.channels = channels; }
@Override public NativeImg< T, ByteArray > createByteInstance( final long[] dimensions, final int entitiesPerPixel ) { if ( dimensions.length > 5 ) throw new RuntimeException( "Unsupported dimensionality: " + dimensions.length ); return new ByteImagePlus< T >( dimensions, entitiesPerPixel ); }
/** * Create a {@link ByteImagePlus}<{@link UnsignedByteType}>. * * <p>(in ImageJ that would be a hyperstack of {@link ByteProcessor}s)</p> */ @SuppressWarnings( "unchecked" ) final static public ByteImagePlus< UnsignedByteType > unsignedBytes( final long... dim ) { return ( ByteImagePlus< UnsignedByteType > )new ImagePlusImgFactory< UnsignedByteType >().create( dim, new UnsignedByteType() ); }
@Override public ImagePlusImg< T, ? > create( final Dimensions dim, final T type ) { final long[] size = new long[ dim.numDimensions() ]; dim.dimensions( size ); return create( size, type ); }
public static ShortImagePlus<UnsignedShortType> wrapShort( final ImagePlus imp ) { if ( imp.getType() != ImagePlus.GRAY16) return null; final ShortImagePlus< UnsignedShortType > container = new ShortImagePlus< UnsignedShortType >( imp ); // create a Type that is linked to the container final UnsignedShortType linkedType = new UnsignedShortType( container ); // pass it to the DirectAccessContainer container.setLinkedType( linkedType ); return container; }
@Override public NativeImg< T, CharArray > createCharInstance( long[] dimensions, final int entitiesPerPixel ) { if ( dimensions.length > 5 ) throw new RuntimeException( "Unsupported dimensionality: " + dimensions.length ); return new ImagePlusImg< T, CharArray >( new CharArray( 1 ), dimensions, entitiesPerPixel ); }
@Override public NativeImg< T, ShortArray > createShortInstance( long[] dimensions, final int entitiesPerPixel ) { if ( dimensions.length > 5 ) throw new RuntimeException( "Unsupported dimensionality: " + dimensions.length ); return new ShortImagePlus< T >( dimensions, entitiesPerPixel ); }
@Override public NativeImg< T, FloatArray > createFloatInstance( long[] dimensions, final int entitiesPerPixel ) { if ( dimensions.length > 5 ) throw new RuntimeException( "Unsupported dimensionality: " + dimensions.length ); return new FloatImagePlus< T >( dimensions, entitiesPerPixel ); }
@Override public NativeImg< T, IntArray > createIntInstance( long[] dimensions, final int entitiesPerPixel ) { if ( dimensions.length > 5 ) throw new RuntimeException( "Unsupported dimensionality: " + dimensions.length ); return new IntImagePlus< T >( dimensions, entitiesPerPixel ); }
/** * Create a {@link ByteImagePlus}<{@link ByteType}>. * * <p>(in ImageJ that would be a hyperstack of {@link ByteProcessor}s)</p> */ @SuppressWarnings( "unchecked" ) final static public ByteImagePlus< ByteType > bytes( final long... dim ) { return ( ByteImagePlus< ByteType > )new ImagePlusImgFactory< ByteType >().create( dim, new ByteType() ); }
@Override public NativeImg< T, DoubleArray > createDoubleInstance( long[] dimensions, final int entitiesPerPixel ) { if ( dimensions.length > 5 ) throw new RuntimeException( "Unsupported dimensionality: " + dimensions.length ); return new ImagePlusImg< T, DoubleArray >( new DoubleArray( 1 ), dimensions, entitiesPerPixel ); }
/** * Create a {@link IntImagePlus}<{@link IntType}>. * * <p>(In ImageJ that would be a hyperstack of {@link ColorProcessor}s. * The integers, however, would be displayed as ARGB unsigned byte channels * and thus look weird.)</p> */ @SuppressWarnings( "unchecked" ) final static public IntImagePlus< IntType > ints( final long... dim ) { return ( IntImagePlus< IntType > )new ImagePlusImgFactory< IntType >().create( dim, new IntType() ); }
@Override public NativeImg< T, LongArray > createLongInstance( long[] dimensions, final int entitiesPerPixel ) { if ( dimensions.length > 5 ) throw new RuntimeException( "Unsupported dimensionality: " + dimensions.length ); return new ImagePlusImg< T, LongArray >( new LongArray( 1 ), dimensions, entitiesPerPixel ); }
/** * Create an {@link IntImagePlus}<{@link ARGBType}>. * * <p>(in ImageJ that would be a hyperstack of {@link ColorProcessor}s)</p> */ @SuppressWarnings( "unchecked" ) final static public IntImagePlus< ARGBType > argbs( final long... dim ) { return ( IntImagePlus< ARGBType > )new ImagePlusImgFactory< ARGBType >().create( dim, new ARGBType() ); }
/** * Create a {@link ShortImagePlus}<{@link ShortType}>. * * <p>(in ImageJ that would be a hyperstack of {@link ShortProcessor}s)</p> */ @SuppressWarnings( "unchecked" ) final static public ShortImagePlus< ShortType > shorts( final long... dim ) { return ( ShortImagePlus< ShortType > )new ImagePlusImgFactory< ShortType >().create( dim, new ShortType() ); }
/** * Create a {@link FloatImagePlus}<{@link ComplexFloatType}>. * * <p>(In ImageJ that would be a hyperstack of {@link FloatProcessor}s * with real and imaginary numbers interleaved in the plane. That means it * would look weird.)</p> */ @SuppressWarnings( "unchecked" ) final static public FloatImagePlus< ComplexFloatType > complexFloats( final long... dim ) { return ( FloatImagePlus< ComplexFloatType > )new ImagePlusImgFactory< ComplexFloatType >().create( dim, new ComplexFloatType() ); }
/** * Create a {@link ShortImagePlus}<{@link UnsignedShortType}>. * * <p>(in ImageJ that would be a hyperstack of {@link ShortProcessor}s)</p> */ @SuppressWarnings( "unchecked" ) final static public ShortImagePlus< UnsignedShortType > unsignedShorts( final long... dim ) { return ( ShortImagePlus< UnsignedShortType > )new ImagePlusImgFactory< UnsignedShortType >().create( dim, new UnsignedShortType() ); }
/** * Create a {@link IntImagePlus}<{@link UnsignedIntType}>. * * <p>(In ImageJ that would be a hyperstack of {@link ColorProcessor}s. * The integers, however, would be displayed as ARGB unsigned byte channels * and thus look weird.)</p> */ @SuppressWarnings( "unchecked" ) final static public IntImagePlus< UnsignedIntType > unsignedInts( final long... dim ) { return ( IntImagePlus< UnsignedIntType > )new ImagePlusImgFactory< UnsignedIntType >().create( dim, new UnsignedIntType() ); }
/** * Create an {@link FloatImagePlusImg}<{@link FloatType}>. * * <p>(in ImageJ that would be a hyperstack of {@link FloatProcessor}s)</p> */ @SuppressWarnings( "unchecked" ) final static public FloatImagePlus< FloatType > floats( final long... dim ) { return ( FloatImagePlus< FloatType > )new ImagePlusImgFactory< FloatType >().create( dim, new FloatType() ); }