[Insight-users] Re: About ITK IO problem
Luis Ibanez
luis.ibanez at kitware.com
Sun Oct 10 16:41:05 EDT 2004
Hi zhuyiyang16,
The best way of reading and writing .raw images
is by using the MetaImage approach. If you need
to read a raw image, you must create for it a
header file with extension .mhd. Please follow
the instructions in the Data web page
http://www.itk.org/HTML/Data.htm
regarding how to write a MetaImage header.
This is a text file that can be created with
any simple text editor.
The content of a typical header file will look like:
NDims = 3
DimSize = 181 217 181
ElementType = MET_UCHAR
ElementSpacing = 1.2 1.2 3.4
Offset = 13.4 27.5 43.2
ElementByteOrderMSB = False
ElementDataFile = myImage.raw
Writing a .raw image is extremly simple.
Just pass a file name with extension ".mhd" to
the ImageFileWriter. It will create the header
file with extension ".mhd" and a raw file with
extension ".raw".
You *DONT NEED* to deal with the ImportPointer
in order to read RAW image.
Please read the IO chapter of the software guide
http://www.itk.org/ItkSoftwareGuide.pdf
Chapter 7, pdf-page 219-240.
Regards,
Luis
----------------
?? ? wrote:
> Hello Luis !
>
> I met a problem .How to read and write *.raw image ? I have tried with
> the way with a ImageIO class explicitly ,but I failed.So how to solve
> the problem?
>
> Othermore,when you use a function concering with IO ,that is
> void SetImportPointer (PixelType *ptr, Dimension long num, bool
> LetFilterManageMemory) ,
> if I use a void* pITKBuffer here, and when to call the
> SetImportPointer() function, cast void* pITKBuffer to PixelType*
> pITKBuffer to fit in the parameter, and then I set
> LetFilterManageMemory true,it means ITK do the delete buffer task,so
> problem comes,I should have delete the buffer as
> delete[](PixelType*)pITKBuffer,but can ITK do this with a cast to delete
> the void pointer?
>
> ¡¡¡¡¡¡¡¡¡¡¡¡Thank you!
>
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail
>
>
>
More information about the Insight-users
mailing list