public AbstractNeighborhoodCursor(AbstractNeighborhood<T> neighborhood) { this.neighborhood = neighborhood; this.ra = neighborhood.extendedSource.randomAccess(); }
@SuppressWarnings({"rawtypes","unchecked"}) public ComplexImageFunction( Img<I> img, OutOfBoundsFactory<I,Img<I>> factory, O type) { this(new ExtendedRandomAccessibleInterval(img, factory).randomAccess(), type); }
/** * * @param container * @param transform * @param interpolatorFactory * @deprecated Use a different constructor and explicitly define a {@link ImgFactory} which will create the output. */ @Deprecated public ImageTransform( final ExtendedRandomAccessibleInterval<T, Img<T>> container, final InvertibleBoundable transform, final InterpolatorFactory<T,RandomAccessible<T>> interpolatorFactory ){ this( container, container.getSource(), transform, interpolatorFactory, container.getSource().factory() ); }
/** * Extend a RandomAccessibleInterval with an out-of-bounds strategy. * * @param source * the interval to extend. * @param factory * the out-of-bounds strategy. * @return (unbounded) RandomAccessible which extends the input interval to * infinity. */ public static < T, F extends RandomAccessibleInterval< T > > ExtendedRandomAccessibleInterval< T, F > extend( final F source, final OutOfBoundsFactory< T, ? super F > factory ) { return new ExtendedRandomAccessibleInterval<>( source, factory ); }
@Override public int numDimensions() { return source.numDimensions(); }
/** * Extend a RandomAccessibleInterval with an out-of-bounds strategy. * * @param source * the interval to extend. * @param factory * the out-of-bounds strategy. * @return (unbounded) RandomAccessible which extends the input interval to * infinity. */ public static < T, F extends RandomAccessibleInterval< T > > ExtendedRandomAccessibleInterval< T, F > extend( final F source, final OutOfBoundsFactory< T, ? super F > factory ) { return new ExtendedRandomAccessibleInterval<>( source, factory ); }
@Override public int numDimensions() { return source.numDimensions(); }
/** * Constructs a new 2x2x2 neighborhood * * <p> * <em>NB</em>: Copies reference * </p> * * @param interval Image space where the neighborhood is located */ public Octant(final RandomAccessibleInterval<B> interval) { access = Views.extendZero(interval).randomAccess(); }
t.set( i++ ); cArray = new ExtendedRandomAccessibleInterval< IntType, Img< IntType > >( arrayImage, new OutOfBoundsMirrorFactory< IntType, Img< IntType > >( Boundary.DOUBLE ) ).randomAccess(); cCell = new ExtendedRandomAccessibleInterval< IntType, Img< IntType > >( cellImage, new OutOfBoundsMirrorFactory< IntType, Img< IntType > >( Boundary.DOUBLE ) ).randomAccess(); cList = new ExtendedRandomAccessibleInterval< IntType, Img< IntType > >( listImage, new OutOfBoundsMirrorFactory< IntType, Img< IntType > >( Boundary.DOUBLE ) ).randomAccess();
public RealImageFunction( RandomAccessibleInterval<I> img, OutOfBoundsFactory<I,RandomAccessibleInterval<I>> factory, O type) { @SuppressWarnings({"rawtypes","unchecked"}) RandomAccessible<I> extendedRandAcessible = new ExtendedRandomAccessibleInterval(img, factory); this.accessor = extendedRandAcessible.randomAccess(); this.type = type; }
/** * Visit a ExtendedRandomAccessibleInterval (while traversing the view * hierarchy). If the no out-of-bounds extension is needed for the current * bounding box, {@link #visit(RandomAccessible)} the view's source. * Otherwise, the traversal stops and {@code randomAccessible} is set as the * {@link #source}. * * @param randomAccessible */ protected void visitExtended( final ExtendedRandomAccessibleInterval< T, ? > randomAccessible ) { final RandomAccessibleInterval< T > sourceInterval = randomAccessible.getSource(); if ( ( boundingBox != null ) && Intervals.contains( sourceInterval, boundingBox.getInterval() ) ) visit( sourceInterval ); else source = randomAccessible; }
/** * Creates a view that spans from (x-1, y-1, ... i-1) to (x+1, y+1, ... i+1) * around the given coordinates * * @param interval the space of the coordinates * @param coordinates coordinates (x, y, ... i) * @return a view of a neighbourhood in the space */ private IntervalView<B> neighbourhoodInterval( final ExtendedRandomAccessibleInterval<B, RandomAccessibleInterval<B>> interval, final long[] coordinates) { final int dimensions = interval.numDimensions(); final BoundingBox box = new BoundingBox(dimensions); final long[] minBounds = Arrays.stream(coordinates).map(c -> c - 1) .toArray(); final long[] maxBounds = Arrays.stream(coordinates).map(c -> c + 1) .toArray(); box.update(minBounds); box.update(maxBounds); return Views.offsetInterval(interval, box); }
public SquareNeighborhoodCursor3x3(ExtendedRandomAccessibleInterval<T,RandomAccessibleInterval<T>> extendedSource, long[] center) { this.source = extendedSource; this.center = center; this.ra = extendedSource.randomAccess(); reset(); }
t.set( i++ ); cArray = new ExtendedRandomAccessibleInterval< IntType, Img< IntType > >( arrayImage, new OutOfBoundsBorderFactory< IntType, Img< IntType > >() ).randomAccess(); cCell = new ExtendedRandomAccessibleInterval< IntType, Img< IntType > >( cellImage, new OutOfBoundsBorderFactory< IntType, Img< IntType > >() ).randomAccess(); cList = new ExtendedRandomAccessibleInterval< IntType, Img< IntType > >( listImage, new OutOfBoundsBorderFactory< IntType, Img< IntType > >() ).randomAccess();
/** * Extend a RandomAccessibleInterval with a periodic out-of-bounds strategy. * * @param source * the interval to extend. * @return (unbounded) RandomAccessible which extends the input interval to * infinity. * @see net.imglib2.outofbounds.OutOfBoundsPeriodic */ public static < T, F extends RandomAccessibleInterval< T > > ExtendedRandomAccessibleInterval< T, F > extendPeriodic( final F source ) { return new ExtendedRandomAccessibleInterval<>( source, new OutOfBoundsPeriodicFactory<>() ); }
/** * Visit a ExtendedRandomAccessibleInterval (while traversing the view * hierarchy). If the no out-of-bounds extension is needed for the current * bounding box, {@link #visit(RandomAccessible)} the view's source. * Otherwise, the traversal stops and {@code randomAccessible} is set as the * {@link #source}. * * @param randomAccessible */ protected void visitExtended( final ExtendedRandomAccessibleInterval< T, ? > randomAccessible ) { final RandomAccessibleInterval< T > sourceInterval = randomAccessible.getSource(); if ( ( boundingBox != null ) && Intervals.contains( sourceInterval, boundingBox.getInterval() ) ) visit( sourceInterval ); else source = randomAccessible; }
public SquareNeighborhoodCursor3x3(ExtendedRandomAccessibleInterval<T,RandomAccessibleInterval<T>> extendedSource, long[] center) { this.source = extendedSource; this.center = center; this.ra = extendedSource.randomAccess(); reset(); }
t.set( i++ ); cArray = new ExtendedRandomAccessibleInterval< IntType, Img< IntType > >( arrayImage, new OutOfBoundsPeriodicFactory< IntType, Img< IntType > >() ).randomAccess(); cCell = new ExtendedRandomAccessibleInterval< IntType, Img< IntType > >( cellImage, new OutOfBoundsPeriodicFactory< IntType, Img< IntType > >() ).randomAccess(); cList = new ExtendedRandomAccessibleInterval< IntType, Img< IntType > >( listImage, new OutOfBoundsPeriodicFactory< IntType, Img< IntType > >() ).randomAccess();
/** * Extend a RandomAccessibleInterval with a mirroring out-of-bounds * strategy. Boundary pixels are repeated. * * @param source * the interval to extend. * @return (unbounded) RandomAccessible which extends the input interval to * infinity. * @see net.imglib2.outofbounds.OutOfBoundsMirrorDoubleBoundary */ public static < T, F extends RandomAccessibleInterval< T > > ExtendedRandomAccessibleInterval< T, F > extendMirrorDouble( final F source ) { return new ExtendedRandomAccessibleInterval<>( source, new OutOfBoundsMirrorFactory<>( OutOfBoundsMirrorFactory.Boundary.DOUBLE ) ); }
@Override final public RandomAccess< T > randomAccess( final Interval interval ) { assert source.numDimensions() == interval.numDimensions(); if ( Intervals.contains( source, interval ) ) { return source.randomAccess( interval ); } return randomAccess(); }