[Insight-users] indices and iterators
Luis Ibanez
luis.ibanez at kitware.com
Wed Feb 4 09:33:50 EST 2009
Hi David,
A) There are no ITK iterators that provide I,J,K access to pixel data.
You could use the GetPixel( index ) method, which internally
performs a computation very similar to what you are showing below
in your code example. It is inefficient.. but it should work.
B) You could certainly use the code in your example below, that should
work fine. Note however, that if you are planning to visit all the
pixels sequentially, then you can as well use the ImageRegion
iterator.
C) It may not be a bad idea to create an IJK iterator class for ITK,
it will simply become one iterator more, and you can find tune it
for 3D images. It will be very useful for other ITK users who
integrate ITK with other libraries. We will be happy to advice
you on how to write such class, and of course we will strongly
encourage you to contribute it to the Insight Journal :-)
D) Could you describe the type of walk that you are planning to make
through the image pixels ? It may be that there are existing
ITK iterators that provide that kind of sequence.
Regards,
Luis
---------------------
David Fuentes wrote:
>
> I know this goes against the ITK philosophy, but I am interfacing
> ITK w/ Petsc's Structured grid solvers. Are there any iterator classes
> that provide i,j,k access to an ITK pixel buffer?
>
> if not,
>
> would I be able to use something like
>
> data = Image->GetBufferPointer();
>
> data[i+nwidth*j+(nwidth*nheight)*k] = ...
>
>
> ?
>
>
> thanks,
> df
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
More information about the Insight-users
mailing list