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

Tobias Pietzsch pietzsch at mpi-cbg.de
Fri May 20 08:16:15 CDT 2011


Hi,
I think this is a good idea. Go ahead and push it.
Tobias



On 05/20/2011 02:09 PM, 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





More information about the ImageJ-devel mailing list