@Deprecated public Img< T > create( final Supplier< T > typeSupplier, final Dimensions dim ) { return create( dim, typeSupplier.get() ); }
@Deprecated public Img< T > create( final Supplier< T > typeSupplier, final long... dim ) { return create( dim, typeSupplier.get() ); }
@Deprecated public Img< T > create( final Supplier< T > typeSupplier, final int[] dim ) { return create( dim, typeSupplier.get() ); }
@Deprecated public Img< T > create( final Supplier< T > typeSupplier, final int[] dim ) { return create( dim, typeSupplier.get() ); }
@Deprecated public Img< T > create( final int[] dim, final T type ) { return create( Util.int2long( dim ), type ); }
@Deprecated @Override public <T extends RealType<T>> Dataset create(final ImgFactory<T> factory, final T type, final long[] dims, final String name, final AxisType[] axes) { final Img<T> img = factory.create(dims, type); final ImgPlus<T> imgPlus = new ImgPlus<>(img, name, axes, null); return create(imgPlus); }
@Override public CellImg< T, A > copy() { @SuppressWarnings( "unchecked" ) final CellImg< T, A > copy = ( CellImg< T, A > ) factory().create( dimension ); copyDataTo( copy ); return copy; } }
@Override public <T extends RealType<T>> Dataset create( final ImgFactory<T> factory, final T type, final long[] dims, final String name, final AxisType[] axes) { final Img<T> img = factory.create(dims, type); final ImgPlus<T> imgPlus = new ImgPlus<T>(img, name, axes, null); return create(imgPlus); }
/** * Create a new mask image without any specific content, but with * a defined size. */ public static RandomAccessibleInterval<BitType> createMask(long[] dim) { ImgFactory< BitType > imgFactory = new ArrayImgFactory< BitType >(); return imgFactory.create(dim, new BitType()); }
/** * Create an {@code Img<T>} with the specified {@code dimensions}. * * @return new image with the specified {@code dimensions}. */ public Img< T > create( final Dimensions dimensions ) { final long[] size = new long[ dimensions.numDimensions() ]; dimensions.dimensions( size ); return create( size ); }
@Override public final Img< T > createEmptyOutput( final IterableInterval< T >[] src ) { long[] resDims = initConstants( src ); return m_factory.create( resDims, src[ 0 ].firstElement().createVariable() ); }
public IsotropicDiffusionTensor(final long[] dimensions, float val) { this.dimensions = dimensions; this.val = val; // Instantiate tensor holder, and initialize cursors long[] tensorDims = new long[dimensions.length + 1]; for (int i = 0; i < dimensions.length; i++) { tensorDims[i] = dimensions[i]; } tensorDims[dimensions.length] = dimensions.length * (dimensions.length - 1); ImgFactory< FloatType > factory = Util.getSuitableImgFactory( new FinalDimensions( dimensions ), new FloatType() ); this.D = factory.create( tensorDims ); }
@Override public final Img< T > createEmptyOutput( final IterableInterval< T >[] src ) { long[] resDims = initConstants( src ); return m_factory.create( resDims, src[ 0 ].firstElement().createVariable() ); }
@Override public Labeling< LL > create( final long[] dim ) { return new NativeImgLabeling< LL, I >( img.factory().create( dim, img.firstElement().createVariable() ) ); } };
@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 ); } }
/** Makes an image that has same type, container, and dimensions as refImage. */ private static <T extends RealType<T>> ImgPlus<T> createBlankCopy( final ImgPlus<T> img) { final long[] dimensions = new long[img.numDimensions()]; img.dimensions(dimensions); final Img<T> blankImg = img.factory().create(dimensions, img.firstElement()); return new ImgPlus<T>(blankImg, img); }
@Override public NtreeImg< T, A > copy() { // TODO: More efficient way to create a copy of the img @SuppressWarnings( "unchecked" ) final NtreeImg< T, A > copy = ( NtreeImg< T, A > ) factory().create( dimension ); final NtreeCursor< T > source = this.cursor(); final NtreeCursor< T > target = copy.cursor(); while ( source.hasNext() ) target.next().set( source.next() ); return copy; }
protected < T extends BooleanType< T > > Img< T > calculate( final Img< T > source ) { final Img< T > target = source.factory().create( source ); final T extendedVal = source.firstElement().createVariable(); extendedVal.set( getExtendedValue() ); final ExtendedRandomAccessibleInterval< T, Img< T > > extended = Views.extendValue( source, extendedVal ); calculate( extended, target ); return target; }
public static < T extends BooleanType< T > > void spur( final RandomAccessible< T > source, final IterableInterval< T > target ) { final T extendedVal = target.firstElement().createVariable(); extendedVal.set( false ); final ImgFactory< T > factory = Util.getSuitableImgFactory( target, extendedVal ); final Img< T > temp = factory.create( target ); new Spur1().calculate( source, temp ); new Spur2().calculate( temp, target ); }
public static < T extends BooleanType< T > > void thin( final RandomAccessible< T > source, final IterableInterval< T > target ) { final T extendedVal = target.firstElement().createVariable(); extendedVal.set( false ); final ImgFactory< T > factory = Util.getSuitableImgFactory( target, extendedVal ); final Img< T > temp = factory.create( target ); new Thin1().calculate( source, temp ); new Thin2().calculate( temp, target ); }