@Override public T invMap( final int i ) { final T out = minType.createVariable(); out.setInteger( i + minVal ); return out; }
@Override public T invMap(final int i) { T out = minType.createVariable(); out.setInteger(i + minVal); return out; }
/** * Given an IntegerType, returns a new Type containing its minimum possible * value. * @param <R> the IntegerType in question. * @param r a representative Type object. * @return a new Type containing its minimum possible * value. */ private static <R extends IntegerType<R>> R minType(R r) { R type = r.createVariable(); type.setReal(r.getMinValue()); return type; }
/** * Given an IntegerType, returns a new Type containing its maximum possible * value. * @param <R> the IntegerType in question. * @param r a representative Type object. * @return a new Type containing its maximum possible * value. */ private static <R extends IntegerType<R>> R maxType(R r) { R type = r.createVariable(); type.setReal(r.getMaxValue()); return type; }
/** * Given an IntegerType, returns a new Type containing its minimum possible * value. * * @param <R> * the IntegerType in question. * @param r * a representative Type object. * @return a new Type containing its minimum possible value. */ private static < R extends IntegerType< R >> R minType( final R r ) { final R type = r.createVariable(); type.setReal( r.getMinValue() ); return type; }
/** * Given an IntegerType, returns a new Type containing its maximum possible * value. * * @param <R> * the IntegerType in question. * @param r * a representative Type object. * @return a new Type containing its maximum possible value. */ private static < R extends IntegerType< R >> R maxType( final R r ) { final R type = r.createVariable(); type.setReal( r.getMaxValue() ); return type; }
/** * Create a labeling backed by a native image with custom strategy and image * factory * * @param strategyFactory * - the strategy factory that drives iteration and statistics * @param img */ public NativeImgLabeling( final LabelingROIStrategyFactory< T > strategyFactory, final Img< I > img ) { super( dimensions( img ), strategyFactory, new LabelingMapping< T >( img.firstElement().createVariable() ) ); this.img = img; this.generation = new long[ 1 ]; }
/** * Expand a RandomAccessibleInterval as specified by border. source will be * extended with a constant value specified by the caller. * * @param source * the interval to expand. * @param value * Constant extension of source. * @return Expansion of the {@link RandomAccessibleInterval} source as * specified by t and border. */ public static < T extends IntegerType< T > > IntervalView< T > expandValue( final RandomAccessibleInterval< T > source, final long value, final long... border ) { final T extension = Util.getTypeFromInterval( source ).createVariable(); extension.setInteger( value ); return Views.expandValue( source, extension, border ); }
/** * Extend a RandomAccessibleInterval with a constant-value out-of-bounds * strategy. * * @param source * the interval to extend. * @param value * the extension value * @return (unbounded) RandomAccessible which extends the input interval to * infinity. * @see net.imglib2.outofbounds.OutOfBoundsConstantValue */ public static < T extends IntegerType< T >, F extends RandomAccessibleInterval< T > > ExtendedRandomAccessibleInterval< T, F > extendValue( final F source, final long value ) { final T extension = Util.getTypeFromInterval( source ).createVariable(); extension.setInteger( value ); return Views.extendValue( source, extension ); }
/** * Expand a RandomAccessibleInterval as specified by border. source will be * extended with a constant value specified by the caller. * * @param source * the interval to expand. * @param value * Constant extension of source. * @return Expansion of the {@link RandomAccessibleInterval} source as * specified by t and border. */ public static < T extends IntegerType< T > > IntervalView< T > expandValue( final RandomAccessibleInterval< T > source, final int value, final long... border ) { final T extension = Util.getTypeFromInterval( source ).createVariable(); extension.setInteger( value ); return Views.expandValue( source, extension, border ); }
@Override public Labeling< LL > create( final long[] dim ) { return new NativeImgLabeling< LL, I >( img.factory().create( dim, img.firstElement().createVariable() ) ); } };
/** * Pick vote space peaks with a {@link LocalExtrema}. * * @param voteSpace * - the {@link RandomAccessibleInterval} containing the output * of a Hough Transform vote * @param threshold * - the {@link IntegerType} at and below which maxima will be * ignored * @return {@code List<Point>} - a list of all of the local maxima of the * {@code voteSpace} */ public static < T extends IntegerType< T > > List< Point > pickLinePeaks( final RandomAccessibleInterval< T > voteSpace, final long threshold ) { final T minPeak = Util.getTypeFromInterval( voteSpace ).createVariable(); minPeak.setInteger( threshold ); return pickLinePeaks( voteSpace, minPeak ); }
/** * Extend a RandomAccessibleInterval with a constant-value out-of-bounds * strategy. * * @param source * the interval to extend. * @param value * the extension value * @return (unbounded) RandomAccessible which extends the input interval to * infinity. * @see net.imglib2.outofbounds.OutOfBoundsConstantValue */ public static < T extends IntegerType< T >, F extends RandomAccessibleInterval< T > > ExtendedRandomAccessibleInterval< T, F > extendValue( final F source, final int value ) { final T extension = Util.getTypeFromInterval( source ).createVariable(); extension.setInteger( value ); return Views.extendValue( source, extension ); }
public NativeImgLabeling( final Img< I > img ) { super( dimensions( img ), new DefaultROIStrategyFactory< T >(), new LabelingMapping< T >( img.firstElement().createVariable() ) ); this.img = img; this.generation = new long[ 1 ]; }
/** * Note: This creates an <em>"independent"</em> {@link LabelingType} * instance that has its own {@link LabelingMapping}. */ @Override public LabelingType< T > createVariable() { final IntegerType< ? > newtype = type.createVariable(); final LabelingMapping< T > newmapping = mapping.newInstance(); final LabelingType< T > t = new LabelingType< T >( newtype, newmapping, new ModCount() ); return t; }
/** * Creates a new {@link LabelingType} based on the underlying * {@link IntegerType} of the existing {@link LabelingType} with a different * label type L * * @param newType * the type of the labels of the created {@link LabelingType} * * @return new {@link LabelingType} */ public < L > LabelingType< L > createVariable( Class< ? extends L > newType ) { return new LabelingType< L >( this.type.createVariable(), new LabelingMapping< L >( this.type ), new ModCount() ); }
@Override public boolean conforms() { final Object inType = in().firstElement(); // HACK: Help the matcher overcome generics limitations. if (!(inType instanceof IntegerType)) return false; // HACK: Reject types that are small. // Because the InvertII is faster. // TODO: Think of a better solution. final T copy = in().firstElement().createVariable(); copy.setInteger(Long.MAX_VALUE); return copy.getIntegerLong() == Long.MAX_VALUE; }
public static < I extends IntegerType< I >> long[][] createElementFromImg( Img< I > kernel ) final int max = new Max< I, I >().compute( kernel.cursor(), kernel.firstElement().createVariable() ).getInteger(); final long[] origin = new long[ kernel.numDimensions() ]; boolean customOrigin = false;
public static < I extends IntegerType< I >> long[][] createElementFromImg( Img< I > kernel ) final int max = new Max< I, I >().compute( kernel.cursor(), kernel.firstElement().createVariable() ).getInteger(); final long[] origin = new long[ kernel.numDimensions() ]; boolean customOrigin = false;