@Override public Cursor< T > cursor() { return new RandomAccessibleIntervalCursor< T >( sourceInterval ); }
@Override public RandomAccessibleIntervalCursor< T > copyCursor() { return copy(); }
public < I extends RandomAccessible< T > & Interval > RandomAccessibleIntervalCursor( final I interval ) { super( interval ); randomAccess = interval.randomAccess(); dimensions = new long[ n ]; dimensions( dimensions ); tmp = new long[ n ]; long size = dimensions[ 0 ]; for ( int d = 1; d < n; ++d ) size *= dimensions[ d ]; maxIndex = size - 1; reset(); }
public void setMinMax ( final RandomAccessibleInterval< S > source, final Converter< S, FloatType > converter ) { final RandomAccessibleIntervalCursor< S > cursor = new RandomAccessibleIntervalCursor< S >( Views.isZeroMin( source ) ? source : Views.zeroMin( source ) ); final FloatType t = new FloatType(); if ( cursor.hasNext() ) { converter.convert( cursor.next(), t ); float min = t.get(); float max = min; while ( cursor.hasNext() ) { converter.convert( cursor.next(), t ); final float value = t.get(); if ( value < min ) min = value; if ( value > max ) max = value; } System.out.println("fmax = " + max ); System.out.println("fmin = " + min ); imageProcessor.setMinAndMax( min, max ); } } }
protected static <T extends RealType<T>> LabelRegion<String> createLabelRegion( final RandomAccessibleInterval<T> interval, final float min, final float max, long... dims) { if (dims == null || dims.length == 0) { dims = new long[interval.numDimensions()]; interval.dimensions(dims); } final ImgLabeling<String, IntType> labeling = new ImgLabeling<>(ArrayImgs.ints(dims)); final RandomAccess<LabelingType<String>> ra = labeling.randomAccess(); final RandomAccessibleIntervalCursor<T> c = new RandomAccessibleIntervalCursor<>(interval); final long[] pos = new long[labeling.numDimensions()]; while (c.hasNext()) { final T item = c.next(); final float value = item.getRealFloat(); if (value >= min && value <= max) { c.localize(pos); ra.setPosition(pos); ra.get().add("1"); } } final LabelRegions<String> labelRegions = new LabelRegions<>(labeling); return labelRegions.getLabelRegion("1"); } }
@Override public Cursor< T > cursor() { return new RandomAccessibleIntervalCursor< T >( sourceInterval ); }
public < I extends RandomAccessible< T > & Interval > RandomAccessibleIntervalCursor( final I interval ) { super( interval ); randomAccess = interval.randomAccess(); dimensions = new long[ n ]; dimensions( dimensions ); tmp = new long[ n ]; long size = dimensions[ 0 ]; for ( int d = 1; d < n; ++d ) size *= dimensions[ d ]; maxIndex = size - 1; reset(); }
@Override public RandomAccessibleIntervalCursor< T > copyCursor() { return copy(); }
@Override public RandomAccessibleIntervalCursor< T > copy() { return new RandomAccessibleIntervalCursor< T >( this ); }
@Override public RandomAccessibleIntervalCursor< T > copy() { return new RandomAccessibleIntervalCursor< T >( this ); }
@Override public Cursor<T> cursor() { return new RandomAccessibleIntervalCursor<T>(Views.interval(rai, new long[dims.length], dims)); }
@Override public void run() { copy( b.array1.cursor(), new RandomAccessibleIntervalCursor< IntType >( b.array2 ) ); } } );
@Test public void testArrayCopy() { copy( array1.cursor(), new RandomAccessibleIntervalCursor< IntType >( array2 ) ); assertArrayEquals( intData, getImgAsInts( array2 ) ); }
@Test public void testArrayCopy2() { copy( new RandomAccessibleIntervalCursor< IntType >( array1 ), array2.cursor() ); assertArrayEquals( intData, getImgAsInts( array2 ) ); }
@Test public void testCellCopy() { copy( array1.cursor(), new RandomAccessibleIntervalCursor< IntType >( cell ) ); assertArrayEquals( intData, getImgAsInts( cell ) ); } }
final Cursor<T> roiCursor1 = new RandomAccessibleIntervalCursor<T>( Views.interval(image1, offsetImage1, endImage1)); final Cursor<S> roiCursor2 = new RandomAccessibleIntervalCursor<S>( Views.interval(image2, offsetImage2, endImage2));
@Test public void testJumpFwd() { final Cursor< IntType > c1 = array1.cursor(); final Cursor< IntType > c2 = new RandomAccessibleIntervalCursor< IntType >( array1 ); c1.fwd(); c2.fwd(); assertEquals( c1.get().get(), c2.get().get() ); for ( int i = 0; i < 10; ++i ) c1.fwd(); c2.jumpFwd( 10 ); assertEquals( c1.get().get(), c2.get().get() ); c1.jumpFwd( 713 ); c2.jumpFwd( 713 ); assertEquals( c1.get().get(), c2.get().get() ); }