@SuppressWarnings( { "unchecked", "rawtypes" } ) @Override public < S > ImgFactory< S > imgFactory( final S type ) throws IncompatibleTypeException { if ( type instanceof NativeType ) return new ArrayImgFactory( (NativeType) type ); throw new IncompatibleTypeException( this, type.getClass().getCanonicalName() + " does not implement NativeType." ); }
public Img< FloatType > getPSFCopy() { if ( img == null ) img = IOFunctions.openAs32Bit( new File( new File( xmlBasePath, subDir ), file ), new ArrayImgFactory<>() ); return img.copy(); }
/** * Create an {@link ArrayImg}<{@link UnsignedShortType}, * {@link ShortArray}>. */ @SuppressWarnings( "unchecked" ) final static public ArrayImg< UnsignedShortType, ShortArray > unsignedShorts( final long... dim ) { return ( ArrayImg< UnsignedShortType, ShortArray > ) new ArrayImgFactory<>( new UnsignedShortType() ).create( dim ); }
/** * Create an {@link ArrayImg}<{@link Unsigned2BitType}, {@link LongArray}>. */ @SuppressWarnings( "unchecked" ) final static public ArrayImg< Unsigned2BitType, LongArray > unsigned2Bits( final long... dim ) { return ( ArrayImg< Unsigned2BitType, LongArray > ) new ArrayImgFactory<>( new Unsigned2BitType() ).create( dim ); }
/** * Create an {@link ArrayImg}<{@link DoubleType}, {@link DoubleArray}>. */ @SuppressWarnings( "unchecked" ) final static public ArrayImg< DoubleType, DoubleArray > doubles( final long... dim ) { return ( ArrayImg< DoubleType, DoubleArray > ) new ArrayImgFactory<>( new DoubleType() ).create( dim ); }
/** * Create an {@link ArrayImg}<{@link ByteType}, {@link ByteArray}>. */ @SuppressWarnings( "unchecked" ) final static public ArrayImg< ByteType, ByteArray > bytes( final long... dim ) { return ( ArrayImg< ByteType, ByteArray > ) new ArrayImgFactory<>( new ByteType() ).create( dim ); }
/** * Create an {@link ArrayImg}<{@link ShortType}, {@link ShortArray}>. */ @SuppressWarnings( "unchecked" ) final static public ArrayImg< ShortType, ShortArray > shorts( final long... dim ) { return ( ArrayImg< ShortType, ShortArray > ) new ArrayImgFactory<>( new ShortType() ).create( dim ); }
/** * Create an {@link ArrayImg}<{@link UnsignedIntType}, {@link IntArray}>. */ @SuppressWarnings( "unchecked" ) final static public ArrayImg< UnsignedIntType, IntArray > unsignedInts( final long... dim ) { return ( ArrayImg< UnsignedIntType, IntArray > ) new ArrayImgFactory<>( new UnsignedIntType() ).create( dim ); }
/** * Create an {@link ArrayImg}<{@link NativeBoolType}, {@link BooleanArray}>. */ @SuppressWarnings( "unchecked" ) final static public ArrayImg< NativeBoolType, BooleanArray > booleans( final long... dim ) { return ( ArrayImg< NativeBoolType, BooleanArray > ) new ArrayImgFactory<>( new NativeBoolType() ).create( dim ); }
/** * Create an {@link ArrayImg}<{@link ARGBType}, {@link IntArray}>. */ @SuppressWarnings( "unchecked" ) final static public ArrayImg< ARGBType, IntArray > argbs( final long... dim ) { return ( ArrayImg< ARGBType, IntArray > ) new ArrayImgFactory<>( new ARGBType() ).create( dim ); }
/** * Create an {@link ArrayImg}<{@link UnsignedIntType}, {@link IntArray}>. */ @SuppressWarnings( "unchecked" ) final static public ArrayImg< UnsignedIntType, IntArray > unsignedInts( final long... dim ) { return ( ArrayImg< UnsignedIntType, IntArray > ) new ArrayImgFactory<>( new UnsignedIntType() ).create( dim ); }
/** * Create an {@link ArrayImg}<{@link FloatType}, {@link FloatArray}>. */ @SuppressWarnings( "unchecked" ) final static public ArrayImg< FloatType, FloatArray > floats( final long... dim ) { return ( ArrayImg< FloatType, FloatArray > ) new ArrayImgFactory<>( new FloatType() ).create( dim ); }
/** * Create an {@link ArrayImg}<{@link ARGBType}, {@link IntArray}>. */ @SuppressWarnings( "unchecked" ) final static public ArrayImg< ARGBType, IntArray > argbs( final long... dim ) { return ( ArrayImg< ARGBType, IntArray > ) new ArrayImgFactory<>( new ARGBType() ).create( dim ); }
@Override public Img< O > createEmptyOutput( Img< I > in ) { try { return in.factory().imgFactory( m_outType ).create( in, m_outType ); } catch ( IncompatibleTypeException e ) { return new ArrayImgFactory< O >().create( in, m_outType ); } }
/** * @throws java.lang.Exception */ @BeforeClass public static void setUpBeforeClass() throws Exception { img = new ArrayImgFactory<>( new Unsigned2BitType() ).create( 10, 20, 30 ); }
/** * @throws java.lang.Exception */ @BeforeClass public static void setUpBeforeClass() throws Exception { img = new ArrayImgFactory<> ( new Unsigned4BitType() ).create( 10, 20, 30 ); }
@Test public void testCopyArrayToArrayWithIterationBoth() { final ArrayImg< IntType, ? > array2 = new ArrayImgFactory<>( new IntType() ).create( dimensions ); final ArrayImg< IntType, ? > array = new ArrayImgFactory<>( new IntType() ).create( dimensions ); copyWithDestIteration( intImg, array2 ); copyWithIterationBoth( array2, array ); assertArrayEquals( intData, getImgAsInts( array ) ); } }
@Test public void testCopyToArrayImgWithSourceIteration() { final ArrayImg< IntType, ? > array = new ArrayImgFactory<>( new IntType() ).create( dimensions ); copyWithSourceIteration( intImg, array ); assertArrayEquals( intData, getImgAsInts( array ) ); }
@Test public void testCopyToArrayContainerWithSourceIteration() { final ArrayImg< IntType, ? > array = new ArrayImgFactory<>( new IntType() ).create( dimensions ); copyWithSourceIteration( intImg, array ); assertArrayEquals( intData, getImgAsInts( array ) ); }
@Test public void testCopyToArrayContainerWithDestIteration() { final ArrayImg< IntType, ? > array = new ArrayImgFactory<>( new IntType() ).create( dimensions ); copyWithDestIteration( intImg, array ); assertArrayEquals( intData, getImgAsInts( array ) ); }