[ImageJ-devel] Changes to the Interval and RealInterval interfaces
Stephan Preibisch
preibisch at mpi-cbg.de
Fri May 20 07:09:09 CDT 2011
Hi guys,
I am just implementing algorithms and I noticed that it saves quite some
temporary arrays if Interval and RealInterval can set Positionables to their
min and max location.
The interface would look like (red just added):
/**
*
* @param d dimension
* @return minimum
*/
public long min( final int d );
/**
* Write the minimum of each dimension into long[].
*
* @param min
*/
public void min( long[] min );
/**
* Sets a {@link Positionable} to the minimum of this {@link
Interval}
*
* @param min
*/
public void min( Positionable min );
/**
*
* @param d dimension
* @return maximum
*/
public long max( final int d );
/**
* Write the minimum of each dimension into long[].
*
* @param max
*/
public void max( long[] max );
/**
* Sets a {@link Positionable} to the maximum of this {@link
Interval}
*
* @param max
*/
public void max( Positionable max );
/**
* Write the number of pixels in each dimension into long[].
*
* @param dimensions
*/
public void dimensions( long[] dimensions );
/**
* Get the number of pixels in a given dimension <em>d</em>.
*
* @param d
*/
public long dimension( int d );
Same applies to the RealInterval..
Now you could write:
interval.min( randomAccess );
instead of:
long[] tmp = new long[ numDimensions ];
interval.min( tmp );
randomAccess.setPosition( tmp );
or
for ( int d = 0; d < numDimensions; ++d )
randomAccess.setPosition( interval.min( d ), d );
which might be inefficient for the case that the input is a paged/compressed
cell container. Potentially, it would have to load a lot of unnecessary
cells on its way through the dimensions.
What do you think? Everything is already implemented and updated, I simply
have to push it..
Steffi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20110520/8f5047a3/attachment.html>
More information about the ImageJ-devel
mailing list