/** * 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 ); }
@Override public PlanarImgFactory< T > factory() { return new PlanarImgFactory<>( linkedType ); }
@Override public PlanarImg< T, ? > create( final Dimensions dimensions ) { return create( Intervals.dimensionsAsLongArray( dimensions ) ); }
public FusionImageLoader( final String pattern, final HashMap< Integer, Integer > setupIdToChannelId, final int numSlices, final SliceLoader< T > sliceLoader, final double sliceValueMin, final double sliceValueMax ) { this( pattern, setupIdToChannelId, numSlices, sliceLoader, sliceValueMin, sliceValueMax, new PlanarImgFactory< UnsignedShortType >() ); }
@Override public PlanarImg< T, ? > create( final Dimensions dimensions ) { return create( Intervals.dimensionsAsLongArray( dimensions ) ); }
/** * 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 ); }
@Override public PlanarImgFactory< T > factory() { return new PlanarImgFactory<>( linkedType ); }
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; }
/** * 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 ); }
@SuppressWarnings( { "unchecked", "rawtypes" } ) @Override public < S > ImgFactory< S > imgFactory( final S type ) throws IncompatibleTypeException { if ( NativeType.class.isInstance( type ) ) return new PlanarImgFactory( ( NativeType ) type ); throw new IncompatibleTypeException( this, type.getClass().getCanonicalName() + " does not implement NativeType." ); }
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; }
/** * 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 ); }
@SuppressWarnings( { "unchecked", "rawtypes" } ) @Override public < S > ImgFactory< S > imgFactory( final S type ) throws IncompatibleTypeException { if ( NativeType.class.isInstance( type ) ) return new PlanarImgFactory( ( NativeType ) type ); throw new IncompatibleTypeException( this, type.getClass().getCanonicalName() + " does not implement NativeType." ); }
@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; }
/** * 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 ); }
@Override public <T extends RealType<T> & NativeType<T>> Dataset create( final T type, final long[] dims, final String name, final AxisType[] axes) { final PlanarImgFactory<T> imgFactory = new PlanarImgFactory<T>(); return create(imgFactory, type, dims, name, axes); }