@Override public void dimensions( final long[] dimensions ) { interval.dimensions( dimensions ); }
/** * * Create appropriately sized image for tensor input. * * @param tensor * n+1 dimensional {@link RandomAccessibleInterval}. * @param factory * {@link ImgFactory} used for creating the result image. * @return n+1 dimensional {@link Img} with size n in the last dimension. */ public static < T extends RealType< T >, U extends RealType< U > > Img< U > createAppropriateResultImg( final RandomAccessibleInterval< T > tensor, final ImgFactory< U > factory) { final int nDim = tensor.numDimensions(); final long[] dimensions = new long[ nDim ]; tensor.dimensions( dimensions ); dimensions[ nDim - 1 ] = nDim - 1; return factory.create( dimensions ); }
/** * According to the dimensions of the input image, create a {@link LongType} * {@link Img} to store the {@link PixelList} used in the components * generated {@link #createComponent(Type)}. * * @param maxValue * a value (e.g., grey-level) greater than any occurring in the * input image. * @param input * input image. * @param imgFactory * used to create PixelList image. */ public MserPartialComponentGenerator( final T maxValue, final RandomAccessibleInterval< T > input, final ImgFactory< LongType > imgFactory ) { this.maxValue = maxValue; dimensions = new long[ input.numDimensions() ]; input.dimensions( dimensions ); linkedList = imgFactory.create( dimensions ); }
/** * According to the dimensions of the input image, create a {@link LongType} * {@link Img} to store the {@link PixelList} used in the components * generated {@link #createComponent(Type)}. * * @param maxValue * a value (e.g., grey-level) greater than any occurring in the * input image. * @param input * input image. * @param imgFactory * used to create PixelList image. */ PixelListPartialComponentGenerator( final T maxValue, final RandomAccessibleInterval< T > input, final ImgFactory< LongType > imgFactory ) { this.maxValue = maxValue; dimensions = new long[ input.numDimensions() ]; input.dimensions( dimensions ); linkedList = imgFactory.create( dimensions ); }
public PeriodicLineNeighborhoodCursor( final RandomAccessibleInterval< T > source, final long span, final int[] increments, final PeriodicLineNeighborhoodFactory< T > factory ) { super( source, span, increments, factory, source ); dimensions = new long[ n ]; min = new long[ n ]; max = new long[ n ]; source.dimensions( dimensions ); source.min( min ); source.max( max ); long size = dimensions[ 0 ]; for ( int d = 1; d < n; ++d ) size *= dimensions[ d ]; maxIndex = size - 1; reset(); }
public RectangleNeighborhoodCursor( final RandomAccessibleInterval< T > source, final Interval span, final RectangleNeighborhoodFactory< T > factory ) { super( source, span, factory, source ); dimensions = new long[ n ]; min = new long[ n ]; max = new long[ n ]; source.dimensions( dimensions ); source.min( min ); source.max( max ); long size = dimensions[ 0 ]; for ( int d = 1; d < n; ++d ) size *= dimensions[ d ]; maxIndex = size - 1; reset(); }
public HorizontalLineNeighborhoodCursor( final RandomAccessibleInterval< T > source, final long span, final int dim, final boolean skipCenter, final HorizontalLineNeighborhoodFactory< T > factory ) { super( source, span, dim, skipCenter, factory, source ); dimensions = new long[ n ]; min = new long[ n ]; max = new long[ n ]; source.dimensions( dimensions ); source.min( min ); source.max( max ); long size = dimensions[ 0 ]; for ( int d = 1; d < n; ++d ) size *= dimensions[ d ]; maxIndex = size - 1; reset(); }
public PairOfPointsNeighborhoodCursor( final RandomAccessibleInterval< T > source, final long[] offset, final PairOfPointsNeighborhoodFactory< T > factory ) { super( source, offset, factory, source ); dimensions = new long[ n ]; min = new long[ n ]; max = new long[ n ]; source.dimensions( dimensions ); source.min( min ); source.max( max ); long size = dimensions[ 0 ]; for ( int d = 1; d < n; ++d ) size *= dimensions[ d ]; maxIndex = size - 1; reset(); }
public HyperSphereNeighborhoodCursor( final RandomAccessibleInterval< T > source, final long radius, final HyperSphereNeighborhoodFactory< T > factory ) { super( source, radius, factory, source ); dimensions = new long[ n ]; min = new long[ n ]; max = new long[ n ]; source.dimensions( dimensions ); source.min( min ); source.max( max ); long size = dimensions[ 0 ]; for ( int d = 1; d < n; ++d ) size *= dimensions[ d ]; maxIndex = size - 1; reset(); }
public DiamondNeighborhoodCursor( final RandomAccessibleInterval< T > source, final long radius, final DiamondNeighborhoodFactory< T > factory ) { super( source, radius, factory, source ); dimensions = new long[ n ]; min = new long[ n ]; max = new long[ n ]; source.dimensions( dimensions ); source.min( min ); source.max( max ); long size = dimensions[ 0 ]; for ( int d = 1; d < n; ++d ) { size *= dimensions[ d ]; } maxIndex = size - 1; reset(); }
public DiamondTipsNeighborhoodCursor( final RandomAccessibleInterval< T > source, final long radius, final DiamondTipsNeighborhoodFactory< T > factory ) { super( source, radius, factory, source ); dimensions = new long[ n ]; min = new long[ n ]; max = new long[ n ]; source.dimensions( dimensions ); source.min( min ); source.max( max ); long size = dimensions[ 0 ]; for ( int d = 1; d < n; ++d ) { size *= dimensions[ d ]; } maxIndex = size - 1; reset(); }
/** * Calculates Pearson's R value without any constraint in values, thus it uses no thresholds. * If additional data like the images mean is needed, it is calculated. * * @param <S> The images base type. * @param img1 The first image to walk over. * @param img2 The second image to walk over. * @return Pearson's R value. * @throws MissingPreconditionException */ public <S extends RealType<S>> double calculatePearsons( RandomAccessibleInterval<S> img1, RandomAccessibleInterval<S> img2) throws MissingPreconditionException { // create an "always true" mask to walk over the images final long[] dims = new long[img1.numDimensions()]; img1.dimensions(dims); RandomAccessibleInterval<BitType> alwaysTrueMask = MaskFactory.createMask(dims, true); return calculatePearsons(img1, img2, alwaysTrueMask); }
/** * According to the dimensions of the input image, create a {@link LongType} * {@link Img} to store the {@link PixelList} used in the components * generated {@link #createComponent(Type)}. * * @param maxValue * a value (e.g., grey-level) greater than any occurring in the * input image. * @param input * input image. * @param imgFactory * used to create PixelList image. */ public MserComponentGenerator( final T maxValue, final RandomAccessibleInterval< T > input, final ImgFactory< LongType > imgFactory ) { this.maxValue = maxValue; dimensions = new long[ input.numDimensions() ]; input.dimensions( dimensions ); linkedList = imgFactory.create( dimensions, new LongType() ); }
/** * According to the dimensions of the input image, create a {@link LongType} * {@link Img} to store the {@link PixelList} used in the components * generated {@link #createComponent(Type)}. * * @param maxValue * a value (e.g., grey-level) greater than any occurring in the * input image. * @param input * input image. * @param imgFactory * used to create PixelList image. */ PixelListComponentGenerator( final T maxValue, final RandomAccessibleInterval< T > input, final ImgFactory< LongType > imgFactory ) { this.maxValue = maxValue; dimensions = new long[ input.numDimensions() ]; input.dimensions( dimensions ); linkedList = imgFactory.create( dimensions, new LongType() ); }
@Override public RandomAccessibleInterval<? extends RealType<?>> xyPlane( final RandomAccessibleInterval<? extends RealType<?>> inputInterval) { RandomAccessibleInterval<? extends RealType<?>> interval = inputInterval; final long[] min = new long[interval.numDimensions()]; final long[] max = new long[interval.numDimensions()]; interval.dimensions(max); for (int i = 0; i < 2; i++) max[i]--; for (int i = 2; i < interval.numDimensions(); i++) { min[i] = max[i] = getLongPosition(i); } interval = Views.interval(interval, min, max); return interval; }
@Override public RandomAccessibleInterval<BitType> createOutput( final RandomAccessibleInterval<BitType> input) { final long[] dims = new long[input.numDimensions()]; input.dimensions(dims); final FinalDimensions dimensions = new FinalDimensions(dims); return ops().create().img(dimensions, new BitType()); }
@Override public RandomAccessibleInterval<BitType> createOutput( final RandomAccessibleInterval<B> input, final Boolean input2) { final long[] dims = new long[input.numDimensions()]; input.dimensions(dims); final FinalDimensions dimensions = new FinalDimensions(dims); return ops().create().img(dimensions, new BitType()); }
public void initialize(RandomAccessibleInterval<T> yk_iterated) { if (yk_prediction == null) { long[] temp = new long[yk_iterated.numDimensions()]; yk_iterated.dimensions(temp); FinalDimensions dims = new FinalDimensions(temp); yk_prediction = create.calculate(dims); xkm1_previous = create.calculate(dims); yk_prediction = create.calculate(dims); gk = create.calculate(dims); hk_vector = create.calculate(dims); } }
public static < T extends Type< T > > Img< T > copyImgNoTranslation( final RandomAccessibleInterval< T > input, final ImgFactory< T > factory, final T type, final ExecutorService service, final boolean showProgress ) { final RandomAccessibleInterval< T > in; if ( Views.isZeroMin( input ) ) in = input; else in = Views.zeroMin( input ); final long[] dim = new long[ in.numDimensions() ]; in.dimensions( dim ); final Img< T > tImg = factory.create( dim, type ); // copy the virtual construct into an actual image copyImg( in, tImg, service, showProgress ); return tImg; }
static class LoopBackImageLoader extends Hdf5ImageLoader { private LoopBackImageLoader( final IHDF5Reader existingHdf5Reader, final AbstractSequenceDescription< ?, ?, ? > sequenceDescription ) { super( null, existingHdf5Reader, null, sequenceDescription, false ); } static LoopBackImageLoader create( final IHDF5Reader existingHdf5Reader, final int timepointIdPartition, final int setupIdPartition, final Dimensions imageDimensions ) { final HashMap< Integer, TimePoint > timepoints = new HashMap<>(); timepoints.put( timepointIdPartition, new TimePoint( timepointIdPartition ) ); final HashMap< Integer, BasicViewSetup > setups = new HashMap<>(); setups.put( setupIdPartition, new BasicViewSetup( setupIdPartition, null, imageDimensions, null ) ); final SequenceDescriptionMinimal seq = new SequenceDescriptionMinimal( new TimePoints( timepoints ), setups, null, null ); return new LoopBackImageLoader( existingHdf5Reader, seq ); } }