Accessing Stack voxels

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Accessing Stack voxels

John Dunsmuir
I would like to port a few 3D C/C++ codes to plugins.  The C codes treat 3D
images as 1D arrays and access pixels using x + y*width + z*width*height.
Is there a method to access a stack as a 1D array?

Thanks,

John Dunsmuir


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Accessing Stack voxels

Barry DeZonia
Hi John,

ImageJ stores planes of data in an ImageStack. As far as I can tell there
are no 1D access methods.

If you look at the ImageStack class you can see it has a
setVoxel(x,y,z,val) method and a getVoxel(x,y,z) method. This isn't exactly
what you need but might be helpful for your port.

Alternatively you could easily write your own 1D accessor methods that take
an ImageStack and given a 1D index set/get the associated value. How to do
so should be apparent when looking at ImageStack:getVoxel().


On Sun, Apr 14, 2013 at 8:48 PM, John <[hidden email]> wrote:

> I would like to port a few 3D C/C++ codes to plugins.  The C codes treat 3D
> images as 1D arrays and access pixels using x + y*width + z*width*height.
> Is there a method to access a stack as a 1D array?
>
> Thanks,
>
> John Dunsmuir
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Accessing Stack voxels

John Dunsmuir
In reply to this post by John Dunsmuir
Thanks Barry,
I'll be chipping away at porting a two relatively short codes over the next few days.  I'll try both access methods you suggested.  I'm concerned about the additional overhead of using IJK instead of just I.  I'll benchmark the plugin against the executable to see if I take a speed hit.

Regards

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html