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

Lee Kamentsky leek at broadinstitute.org
Fri May 20 07:15:09 CDT 2011


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/d0f437df/attachment.html>


More information about the ImageJ-devel mailing list