[ImageJ-devel] Changes to the Interval and RealInterval interfaces

Stephan Preibisch preibisch at mpi-cbg.de
Fri May 20 08:01:18 CDT 2011


Hi Lee,

 

I did that already in all imglib2-core classes. The question also is if it
is necessary somewhere else, too..

 

Nice greetings,

Steffi

 

From: imagej-devel-bounces at imagejdev.org
[mailto:imagej-devel-bounces at imagejdev.org] On Behalf Of Lee Kamentsky
Sent: Friday, May 20, 2011 2:15 PM
To: imagej-devel at imagejdev.org
Subject: Re: [ImageJ-devel] Changes to the Interval and RealInterval
interfaces

 

Makes perfect sense, especially if you've updated all implementers of the
interfaces.

--Lee
On 5/20/2011 8:09 AM, Stephan Preibisch wrote: 

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

 
 
_______________________________________________
ImageJ-devel mailing list
ImageJ-devel at imagejdev.org
http://imagejdev.org/mailman/listinfo/imagej-devel

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20110520/be6399a6/attachment.html>


More information about the ImageJ-devel mailing list