@Override public int getIntPosition( final int d ) { return c.getIntPosition( d ); }
@Override public int getIntPosition( int d ) { return cursor.getIntPosition( d ); }
/** * {@inheritDoc} */ @Override public int getIntPosition( final int d ) { assert d < n; return s.getIntPosition( sourceComponent[ d ] ); }
@Override public void localize( int[] position ) { for ( int d = 0; d < numPlaneDims; d++ ) { position[ d ] = cursor.getIntPosition( d ); } }
@Override public int getIntPosition( final int d ) { return source.getIntPosition( d ); }
@Override public int getIntPosition( final int d ) { return source.getIntPosition( d ); }
/** * {@inheritDoc} */ @Override public int getIntPosition( final int d ) { assert d < n; return s.getIntPosition( sourceComponent[ d ] ); }
@Override public int getIntPosition( int d ) { return cursor.getIntPosition( d ); }
@Override public void localize( int[] position ) { for ( int d = 0; d < numPlaneDims; d++ ) { position[ d ] = cursor.getIntPosition( d ); } }
@Override public int getIntPosition(int arg0) { return cursor.getIntPosition(arg0); }
@Override public int getIntPosition(int d) { return cursor.getIntPosition(d); }
private static final void iterate( final Cursor< FloatType > c0, final FloatProcessor fp, final int minX, final int minY ) { c0.fwd(); fp.setf( c0.getIntPosition( 0 ) - minX, c0.getIntPosition( 1 ) - minY, c0.get().get() ); }
public static final < T extends RealType< T > > void readBytes( final byte[] b, final Cursor< T > cursor, final int width ) { while( cursor.hasNext() ) { cursor.fwd(); // otherwise the position is off below cursor.get().setReal( b[ cursor.getIntPosition( 0 ) + cursor.getIntPosition( 1 ) * width ] & 0xff ); } }
public static final < T extends RealType< T > > void readUnsignedInts( final byte[] b, final Cursor< T > cursor, final int width, final boolean isLittleEndian ) { while( cursor.hasNext() ) { cursor.fwd(); cursor.get().setReal( LegacyStackImgLoaderLOCI.getIntValue( b, ( cursor.getIntPosition( 0 ) + cursor.getIntPosition( 1 ) * width ) * 4, isLittleEndian ) ); } }
public static final < T extends RealType< T > > void readUnsignedShorts( final byte[] b, final Cursor< T > cursor, final int width, final boolean isLittleEndian ) { while( cursor.hasNext() ) { cursor.fwd(); cursor.get().setReal( LegacyStackImgLoaderLOCI.getShortValueInt( b, ( cursor.getIntPosition( 0 ) + cursor.getIntPosition( 1 ) * width ) * 2, isLittleEndian ) ); } }
public static final < T extends RealType< T > > void readSignedShorts( final byte[] b, final Cursor< T > cursor, final int width, final boolean isLittleEndian ) { while( cursor.hasNext() ) { cursor.fwd(); cursor.get().setReal( LegacyStackImgLoaderLOCI.getShortValue( b, ( cursor.getIntPosition( 0 ) + cursor.getIntPosition( 1 ) * width ) * 2, isLittleEndian ) ); } }
public static final < T extends RealType< T > > void readFloats( final byte[] b, final Cursor< T > cursor, final int width, final boolean isLittleEndian ) { while( cursor.hasNext() ) { cursor.fwd(); cursor.get().setReal( LegacyStackImgLoaderLOCI.getFloatValue( b, ( cursor.getIntPosition( 0 ) + cursor.getIntPosition( 1 ) * width ) * 4, isLittleEndian ) ); } }
@Before public void setUp() { final long[] dimension = new long[] { 10, 10, 10 }; img = new ArrayImgFactory<>( new UnsignedByteType() ).create( dimension ); final Cursor< UnsignedByteType > inCursor = img.localizingCursor(); while ( inCursor.hasNext() ) { // set with plane position inCursor.next().set( inCursor.getIntPosition( 2 ) ); } }
@Test public void testXYCropping() { // selected interval XY final int[] xyAxis = new int[] { 0, 1 }; ops.run(SliceRAI2RAI.class, out, in, new DummyOp(), xyAxis); for (final Cursor<ByteType> cur = out.cursor(); cur.hasNext();) { cur.fwd(); assertEquals(cur.getIntPosition(2), cur.get().getRealDouble(), 0); } }
@Override @Before public void setUp() { context = new Context(OpService.class); ops = context.service(OpService.class); in = ArrayImgs.bytes(20, 20, 21); out = ArrayImgs.bytes(20, 20, 21); // fill array img with values (plane position = value in px); for (final Cursor<ByteType> cur = in.cursor(); cur.hasNext();) { cur.fwd(); cur.get().set((byte) cur.getIntPosition(2)); } }