@Override public PlanarImg< T, ? > create( final Dimensions dimensions ) { return create( Intervals.dimensionsAsLongArray( dimensions ) ); }
@Deprecated @Override public PlanarImg< T, ? > create( final long[] dimensions, final T type ) { cache( type ); @SuppressWarnings( { "unchecked", "rawtypes" } ) final PlanarImg< T, ? > img = create( dimensions, type, ( NativeTypeFactory ) type.getNativeTypeFactory() ); return img; }
@Deprecated @Override public PlanarImg< T, ? > create( final long[] dimensions, final T type ) { cache( type ); @SuppressWarnings( { "unchecked", "rawtypes" } ) final PlanarImg< T, ? > img = create( dimensions, type, ( NativeTypeFactory ) type.getNativeTypeFactory() ); return img; }
/** * Create an {@link PlanarImg}<{@link LongType}, {@link LongArray}>. */ @SuppressWarnings( "unchecked" ) final static public PlanarImg< LongType, LongArray > longs( final long... dim ) { return ( PlanarImg< LongType, LongArray > ) new PlanarImgFactory<>( new LongType() ).create( dim ); }
@Override public PlanarImg< T, ? > create( final long... dimensions ) { @SuppressWarnings( { "unchecked", "rawtypes" } ) final PlanarImg< T, ? > img = create( dimensions, type(), ( NativeTypeFactory ) type().getNativeTypeFactory() ); return img; }
/** * Create an {@link PlanarImg}<{@link UnsignedByteType}, {@link ByteArray}>. */ @SuppressWarnings( "unchecked" ) final static public PlanarImg< UnsignedByteType, ByteArray > unsignedBytes( final long... dim ) { return ( PlanarImg< UnsignedByteType, ByteArray > ) new PlanarImgFactory<>( new UnsignedByteType() ).create( dim ); }
/** * Create an {@link PlanarImg}<{@link UnsignedShortType}, {@link ShortArray} * >. */ @SuppressWarnings( "unchecked" ) final static public PlanarImg< UnsignedShortType, ShortArray > unsignedShorts( final long... dim ) { return ( PlanarImg< UnsignedShortType, ShortArray > ) new PlanarImgFactory<>( new UnsignedShortType() ).create( dim ); }
/** * Create an {@link PlanarImg}<{@link NativeBoolType}, {@link BooleanArray}>. */ @SuppressWarnings( "unchecked" ) final static public PlanarImg< NativeBoolType, BooleanArray > booleans( final long... dim ) { return ( PlanarImg< NativeBoolType, BooleanArray > ) new PlanarImgFactory<>( new NativeBoolType() ).create( dim ); }
/** * Create an {@link PlanarImg}<{@link IntType}, {@link IntArray}>. */ @SuppressWarnings( "unchecked" ) final static public PlanarImg< IntType, IntArray > ints( final long... dim ) { return ( PlanarImg< IntType, IntArray > ) new PlanarImgFactory<>( new IntType() ).create( dim ); }
/** * Create an {@link PlanarImg}<{@link FloatType}, {@link FloatArray}>. */ @SuppressWarnings( "unchecked" ) final static public PlanarImg< FloatType, FloatArray > floats( final long... dim ) { return ( PlanarImg< FloatType, FloatArray > ) new PlanarImgFactory<>( new FloatType() ).create( dim ); }
/** * Create an {@link PlanarImg}<{@link BitType}, {@link LongArray}>. */ @SuppressWarnings( "unchecked" ) final static public PlanarImg< BitType, LongArray > bits( final long... dim ) { return ( PlanarImg< BitType, LongArray > ) new PlanarImgFactory<>( new BitType() ).create( dim ); }
/** * Create an {@link PlanarImg}<{@link UnsignedByteType}, {@link ByteArray}>. */ @SuppressWarnings( "unchecked" ) final static public PlanarImg< UnsignedByteType, ByteArray > unsignedBytes( final long... dim ) { return ( PlanarImg< UnsignedByteType, ByteArray > ) new PlanarImgFactory<>( new UnsignedByteType() ).create( dim ); }
/** * Create an {@link PlanarImg}<{@link UnsignedShortType}, {@link ShortArray} * >. */ @SuppressWarnings( "unchecked" ) final static public PlanarImg< UnsignedShortType, ShortArray > unsignedShorts( final long... dim ) { return ( PlanarImg< UnsignedShortType, ShortArray > ) new PlanarImgFactory<>( new UnsignedShortType() ).create( dim ); }
/** * Create an {@link PlanarImg}<{@link NativeBoolType}, {@link BooleanArray}>. */ @SuppressWarnings( "unchecked" ) final static public PlanarImg< NativeBoolType, BooleanArray > booleans( final long... dim ) { return ( PlanarImg< NativeBoolType, BooleanArray > ) new PlanarImgFactory<>( new NativeBoolType() ).create( dim ); }
/** * Create an {@link PlanarImg}<{@link ComplexFloatType}, {@link FloatArray} * >. */ @SuppressWarnings( "unchecked" ) final static public PlanarImg< ComplexFloatType, FloatArray > complexFloats( final long... dim ) { return ( PlanarImg< ComplexFloatType, FloatArray > ) new PlanarImgFactory<>( new ComplexFloatType() ).create( dim ); }
/** * Create an {@link PlanarImg}<{@link ByteType}, {@link ByteArray}>. */ @SuppressWarnings( "unchecked" ) final static public PlanarImg< ByteType, ByteArray > bytes( final long... dim ) { return ( PlanarImg< ByteType, ByteArray > ) new PlanarImgFactory<>( new ByteType() ).create( dim ); }
private < A extends ArrayDataAccess< A > > PlanarImg< T, ? > create( final long[] dimensions, final T type, final NativeTypeFactory< T, A > typeFactory ) { final Fraction entitiesPerPixel = type.getEntitiesPerPixel(); final PlanarImg< T, A > img = new PlanarImg<>( ArrayDataAccessFactory.get( typeFactory ), dimensions, entitiesPerPixel ); img.setLinkedType( typeFactory.createLinkedType( img ) ); return img; }
@Override public PlanarImg< T, ? > copy() { final PlanarImg< T, ? > copy = factory().create( dimension ); final PlanarCursor< T > cursor1 = this.cursor(); final PlanarCursor< T > cursor2 = copy.cursor(); while ( cursor1.hasNext() ) cursor2.next().set( cursor1.next() ); return copy; }
@Test public void testCopyToPlanarContainerWithSourceIteration() { final PlanarImg< IntType, ? > planarImg = new PlanarImgFactory<>( new IntType() ).create( dimensions ); copyWithSourceIteration( intImg, planarImg ); assertArrayEquals( intData, getImgAsInts( planarImg ) ); }
@Test public void testCopyToPlanarContainerWithDestIteration() { final PlanarImg< IntType, ? > planarImg = new PlanarImgFactory<>( new IntType() ).create( dimensions ); copyWithDestIteration( intImg, planarImg ); assertArrayEquals( intData, getImgAsInts( planarImg ) ); } }