@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 ); }
/** * 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() ); }
/** * 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 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() ); }
/** * 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() ); }
/** * 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 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() ); }
final Img< UnsignedShortType > s = new ImagePlusImgFactory< UnsignedShortType >().create( interval, new UnsignedShortType() ); final RandomAccess< UnsignedShortType > r = Views.extendZero( s ).randomAccess();
protected static < T extends Type< T > > Img< FloatType > convertToFloat( final Img< T > input, final Converter< T, FloatType > c ) { final ImagePlusImg< FloatType, ? > output = new ImagePlusImgFactory< FloatType >().create( input, new FloatType() ); final Cursor< T > in = input.cursor(); final Cursor< FloatType > out = output.cursor(); while ( in.hasNext() ) { in.fwd(); out.fwd(); c.convert(in.get(), out.get()); } return output; } }
final ImagePlusImg< ARGBType, ? > img = factory.create( new long[]{ imp1.getWidth(), imp1.getHeight() }, new ARGBType() ); drawNearestNeighbor( img,
final ImagePlusImg< ARGBType, ? > img = factory.create( new long[]{ imp1.getWidth(), imp1.getHeight() }, new ARGBType() ); drawNearestNeighbor( img,