[Insight-users] Re: 答复: read series files

Luis Ibanez luis.ibanez@kitware.com
Thu, 27 Mar 2003 10:45:17 -0500


Hi Zhao,

Please read chapter 6 of the SoftwareGuide
http://www.itk.org/ItkSoftwareGuide.pdf

----------

You don't need to do any extra conversion
for getting an image from a file.


Just do something like


typedef itk::Image<char,3> ImageType;
typedef itk::ImageFileReader<ImageType> ReaderType;

ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( "image.mha");
reader->Update(); // <-- this reads the image

ImageType::Pointer imagePtr = reader->GetOutput();


At this point, the smart pointer "imagePtr"
gives you acces to the image that was read
from the file.


  Luis



------------------------------------------------
zhao yong qiang wrote:
> Hi Luis,
>   Sorry, It is my mistake. It is ITK, not VTK. 
> To the question 2, maybe I did not describe it clearly.
> If I read some image files, how I use these data to create 3D image
> data?
> 
> -----邮件原件-----
> 发件人: Luis Ibanez [mailto:luis.ibanez@kitware.com] 
> 发送时间: 2003年3月27日 21:54
> 收件人: zhao yong qiang
> 抄送: Insight-users@public.kitware.com
> 主题: Re: read series files
> 
> 
> Hi Zhao,
> 
> 
> zhao yong qiang wrote:
> 
>>Hi Luis,
>>   1.How to read  series DICOM or other type files in VTK?
> 
> 
> 1) You may want to send this question to the VTK mailing list.
>    VTK and ITK are separate toolkits. VTK is oriented to visualization,
>    ITK is oriented to image processing, with emphasis in segmentation
>    and registration.
> 
> If you want to read DICOM images with ITK the
> simplest way at this point is to use the
> MetaImageImporter application that will generate
> a MetaImage header for you.
> 
> 
> 
>>2. If I define the itk::image<pixel type, 3>,how I write the series
>>images data to the defined image type? I check that
>>itk::ImportImageFilter can import data from a standard C array into an
>>itk::Image  ,but I can not find how I set input data.
>>   Thanks!!! 
> 
> 
> 
> 
> 2) Examples on how to write data are availble in
> 
>     Insight/Code/IO
> 
>   and are described in the SoftwareGuide
>   http://www.itk.org/ItkSoftwareGuide.pdf
>   Chapter 6, pdf-page 157
> 
> 
>   By default, writers use the PixelType when writing
>   to the file. You can modify this if you directly
>   instantiate the ImageIO object and invoke its method
>   SetPixelType().
>   http://www.itk.org/Insight/Doxygen/html/classitk_1_1ImageIOBase.html
> 
>   Note that this will result in a C-style casting with no
>   effort for correcting the dynamic range of the intensities.
> 
> 
> 
> Regards,
> 
> 
>   Luis
> 
> 
> 
> 
> 
> 
>