<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Tobias, <div><br></div><div>great! </div><div><br></div><div>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? </div><div><br></div><div>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.</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(119, 119, 119); ">@Override</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span style="color: #7f2a67">public</span> Object iterationOrder()</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">{</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-style-span"><span class="Apple-tab-span" style="white-space:pre">        </span>if ( </span><span class="Apple-style-span" style="color: rgb(27, 42, 201); ">iterationOrder</span><span class="Apple-style-span"> == null )</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span><span class="Apple-style-span" style="color: rgb(27, 42, 201); ">iterationOrder</span> = <span style="color: #7f2a67">new</span> FlatIterationOrder( <span style="color: #7f2a67">this</span> );</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(27, 42, 201); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #7f2a67">return</span><span style="color: #000000"> </span>iterationOrder<span style="color: #000000">;</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">}</div></div><div><br></div><div>Steffi</div><div><br><div><div>On Mar 21, 2012, at 13:27 , Tobias Pietzsch wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi,<br><br>I cleaned up the "equal iteration order" mechanism.<br><br><br>In the end, I did not use an interface "FlatIterationOrder".<br>The reason was that this interface can not be propagated through wrapper<br>classes (like ImgPlus). Even though ImgPlus.equalIterationOrder( f )<br>propagates to its wrapped img like<br><br> return img.equalIterationOrder( f );<br><br>this breaks when you try to compare the iteration orders of two ImgPlus<br>for instance. The first solution to this would be to<br><br> return f.equalIterationOrder( img );<br><br>and assume f does the same and you propagate alternately down to the<br>un-wrapped IterableIntervals. However, you would have to be super<br>careful not to provoke infinite loops in this way.<br><br><br><br>So instead of this, I introduced a new method in the<br>IterableRealInterval interface:<br><br> public Object iterationOrder()<br><br>It is supposed to return an Object that represents the particular<br>iteration order. Comparison of iteration orders is via Object.equals().<br>That is, if you want to find whether IterableIntervals A and B have<br>equal iteration order, you ask whether<br><br> A.iterationOrder().equals(B.iterationOrder()).<br><br>equalIterationOrder() is deprecated. I still changed it everywhere to<br>have it still work but some day we should remove it to keep the<br>IterableRealInterval interface as small as possible.<br><br>So, FlatIterationOrder is a class now. If you support flat iteration<br>order, then your iterationOrder() method should return a<br>FlatIterationOrder instance constructed with your Interval.<br><br><br>best regards,<br>Tobias<br><br>On 03/13/2012 02:40 PM, Albert Cardona wrote:<br><blockquote type="cite">El 13 de març de 2012 9:39, Albert Cardona<<a href="mailto:sapristi@gmail.com">sapristi@gmail.com</a>> ha escrit:<br></blockquote><blockquote type="cite"><blockquote type="cite">ImgLib2'ers:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Instead of this:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> ( IterableRandomAccessibleInterval.class.isInstance( f ) ||<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">ArrayImg.class.isInstance( f ) || ListImg.class.isInstance( f ) ) )<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Why not create the empty interface EqualIterationOrder and make all<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">the above classes implement it? This way code will be future-proof,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">and flexible to user-defined new Img classes.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Albert<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Too early in the morning. I meant a new interface "FlatIterationOrder".<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Albert<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><br><br>_______________________________________________<br>ImageJ-devel mailing list<br><a href="mailto:ImageJ-devel@imagej.net">ImageJ-devel@imagej.net</a><br>http://imagej.net/mailman/listinfo/imagej-devel<br></div></blockquote></div><br></div></body></html>