[ImageJ-devel] Local Neighborhood stuff

Jean-Yves Tinevez jeanyves.tinevez at gmail.com
Sat Aug 18 14:37:21 CDT 2012


Hi Tobias,

Congratulations on this very clever design!

I totally buy it, and just have basic questions.

>
> Cursor/RandomAccess< Neighborhood<T> >
> ==============================**==========
> To move a neighborhood around, we use standard accessor interfaces.
> Assume you have a RandomAccess<Neighborhood<T>> a.
> Using a.setPosition() you can position the center of the neighborhood.
> Using a.get() you obtain a Neighborhood<T> (which you can then iterate).
>
> In many ways, the Neighborhood is like a NativeType. It is just a
> reference into an underlying structure. If you have a Cursor<T> of
> a NativeType, then the result T t = cursor.get() will be invalidated
> when you advance the cursor. The same holds for Cursor<Neighborhood<T>>.
> When you move the cursor, the neighborhood Neighborhood<T> n =
> cursor.get() will be invalidated when you advance the cursor.
>
>
This is really clever, clearly in the lines of master Stephan. Every time I
ask a question, he tells me to focus on a new type.



>
> IterableInterval/**RandomAccessible< Neighborhood<T> >
> ==============================**======================
> Of course, once you have the Accessors, it's easy to put the into
> Accessibles and benefit from all the goodies that are in ImgLib already.
> For example, if you have implemented a RandomAccess<Neighborhood<T>>
> it is straightforward to wrap it into a RandomAccessible and use
> Views.iterable() to get a Cursor over Neighborhood<T>.
>
> This results is pure syntactic sugar and lets you write sexy code like
> this:
>   for ( Neighborhood<T> n : neighborhoods )
>       for ( T t : n )
>           ...
>

A basic question: how do we deal with out-of-bounds? Some strategies might
require to know whether you are outside bounds, or even specify the OOBS.
Example: an average filter wants to skip the pixels that are not inside the
image.

How do we get that with the neighborhood iterator?


> As you might have noticed, I have completely neclected the copyOn() and
> updateSource() methods we discussed before.  I don't really see the need
> for them in the above design.
>
> Ok, I hope you will have a look at the code
> (branch "tobias-neighborhood-**experiments") and tell me what you think.
>
> Will do!
Thanks!
jy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20120818/e50f2fe4/attachment.html>


More information about the ImageJ-devel mailing list