[Insight-users] Image format
Luis Ibanez
luis.ibanez at kitware.com
Tue Jul 12 11:27:38 EDT 2005
Hi Dan,
The pixel order that you are using is the one that ITK is
expecting (X is the most rapidly changing index... and so on).
For a full description of the memory organization of the ITK
images, please read the ITK Software Guide
http://www.itk.org/ItkSoftwareGuide.pdf
In particular the "Data Representation" Chapter.
----
BTW:
Why are you using ASCII to write the data ?
shouldn't you use a binary representation ?
Note that there is an initial effort facilitating the conversion
of ITK images into Python arrays, but it has not been finished.
Would you like to volunteer ?
The relavant files are in:
Insight/
Wrapping/
CSwig/
CommonA/
itkPyBuffer.h
itkPyBuffer.cxx
Please let us know,
Thanks
Luis
---------------------------
Einstein, Daniel R wrote:
> Hello friends,
>
> I am just getting started with ITK so here is my stupid question. I
> intend to interface with the ITK filters via Python. We have a
> segmentation and visualization code (_http://www.compgeomco.com/_), that
> permits Python scripting. All of the wrapping has been already done (and
> it works!). However, I need to figure out how to interface the two. Our
> code reads in images and creates (usually) a 3D array that contains
> (usually) 8-bit unsigned data. The data structure of this array is:
>
> for ( z = 0; z < zmax; z++ ) {
> for ( y = 0; y < ymax; y++ ) {
> for ( x = 0; x < xmax; x++ ) {
> (ASCII_write(data(x,y,z));
> }
> }
> }
>
> What is the data structure that ITK expects? Do I have to reshape my
> array before messing with it?
>
> Dan
>
> Daniel R Einstein, PhD
> Biological Monitoring and Modeling
> Pacific Northwest National Laboratory
> P.O. Box 999; MSIN P7-59
> Richland, WA 99352
> Tel: 509/ 376-2924
> Fax: 509/376-9064
> _daniel.einstein at pnl.gov_ <mailto:daniel.einstein at pnl.gov>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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