[ImageJ-devel] [fiji-devel] Re: equal iteration order

Albert Cardona sapristi at gmail.com
Wed Mar 21 13:11:01 CDT 2012


El 21 de març de 2012 14:05, Tobias Pietzsch <pietzsch at mpi-cbg.de> ha escrit:
> Hi Steffi,
>
>
> On 03/21/2012 06:57 PM, Stephan Preibisch wrote:
>>
>> Hi Tobias,
>>
>> great!
>>
>> Just one question, should we always create the instance in each Img like
>> ArrayImg from the beginning or maybe just instantiate it once
>> equalIterationOrder is called the first time?
>>
>> This would reduce the initial overhead of each Img, just imagine you
>> have a lot of small ones ... Because I guess there are a lot of examples
>> where this method will never be called.
>
>
> Sure. That will work as well.
> You could also return a new instance everytime iterationOrder() is
> called, if you expect that to happen rarely or never.
>
> For now, I followed this conventions:
>
> * Imgs create their IterationOrder instance in the constructor.
> * IterableInterval that are basically not compatible to anything
>  else, e.g. KDTree, just return "this" (only compatible with
>  themselves.
> * wrapper classes propagate iterationOrder() to the wrapped class.
>
> best regards,
> Tobias


Tobias,

considering that most everyday images will use FlatIterationOrder, I
suggest making FlatIterationOrder a singleton and then the
equalIterationOrder of ArrayImg, ListImg, etc would return that
unique, shared instance.

I agree with Preibisch that this operation is done almost never. No
point in adding an extra object in there for nothing.

Albert
-- 
http://albert.rierol.net
http://www.ini.uzh.ch/~acardona/



More information about the ImageJ-devel mailing list