[Insight-users] itkRegionOfInterestImageFilter question
Luis Ibanez
luis.ibanez at kitware.com
Wed Aug 10 15:20:25 EDT 2005
Hi Moti,
How are you "copying back" the result to an itkImage object ?
It may be that you are tampering with the mechanism of the
pipeline update.
Please let us know,
Thanks
Luis
-------------------------------
freiman at cs.huji.ac.il wrote:
> Hi Luis,
> i just forgot to copy it to the mail, of course i used this line in the
> right place.
> one more comment.
> right after used the filter i visualize the result using vtk, and it is as
> well as i want.
> then i copy it back to itkImage object, and then save it, then the problem
> ocuures.
> thanks again,
> moti
> Original Message:
> -----------------
> From: Luis Ibanez luis.ibanez at kitware.com
> Date: Wed, 10 Aug 2005 11:17:15 -0400
> To: freiman at cs.huji.ac.il, insight-users at itk.org
> Subject: Re: [Insight-users] itkRegionOfInterestImageFilter question
>
>
>
> Hi Moti,
>
>
> It seems that you never passed the "desiredRegion"
> to the itk::RegionOfInterestImageFilter ("_filter")
>
>
>
> Please look at the usage of this filter in the ITK
> Software Guide
>
> http://www.itk.org/ItkSoftwareGuide.pdf
>
> in Section 7.6, "Extracting Region", pdf-page 298.
>
>
>
>
> The source code of the example is available at
>
>
> Insight/Examples/IO/
> ImageReadRegionOfInterestWrite.cxx
>
>
>
> Regards,
>
>
> Luis
>
>
> ----------------------------
> freiman at cs.huji.ac.il wrote:
>
>>Hello!
>>I have the follwoing problem.
>>i read A 3D image, then extract a region of interest and save it.
>>when i try to read the extracted region again, i got a garbage image.
>>below is my code:
>>
>>//reading part
>> VoxIo::Pointer imageio = VoxIo::New();
>> imageio->SetFileDimensionality (3);
>> imageio->SetDimensions (0,dim_x);
>> imageio->SetDimensions (1,dim_y);
>> imageio->SetDimensions (2,dim_z);
>> imageio->SetByteOrderToLittleEndian();
>> imageio->SetSpacing (0, spacing_x);
>> imageio->SetSpacing (1, spacing_y);
>> imageio->SetSpacing (2, spacing_z);
>> imageio->SetOrigin (0,origin_x);
>> imageio->SetOrigin (1,origin_y);
>> imageio->SetOrigin (2,origin_z);
>> imageio->SetHeaderSize (512);
>> imageio->SetFileTypeToBinary();
>>
>> ReaderType::Pointer reader = ReaderType::New();
>> reader->SetFileName(volumeName.c_str());
>> reader->SetImageIO (imageio);
>> reader->Update();
>>
>>//extract roi part
>> ImageType::Pointer image = reader->GetOutput();
>> ImageType::IndexType start;
>> start[0] = min_x;
>> start[1] = min_y;
>> start[2] = min_z;
>>
>> ImageType::SizeType size;
>> size[0] = max_x - min_x;
>> size[1] = max_y - min_y;
>> size[2] = max_z - min_z;
>>
>> ImageType::RegionType desiredRegion;
>> desiredRegion.SetSize( size );
>> desiredRegion.SetIndex( start );
>>
>> ROIFilterType::Pointer _filter = ROIFilterType::New();
>>
>>
>> _filter->SetInput (reader->GetOutput());
>> _filter->Update();
>>
>>
>>//writing partwhere extent hold new image extent and spacing hold image
>>spacing
>>
>> VoxIo::Pointer imageio = VoxIo::New();
>> imageio->SetFileDimensionality (3);
>> imageio->SetDimensions (0,extent[1]-extent[0]);
>> imageio->SetDimensions (1,extent[3]-extent[2]);
>> imageio->SetDimensions (2,extent[5]-extent[4]);
>> imageio->SetByteOrderToLittleEndian();
>> imageio->SetSpacing (0, spacing[0]);
>> imageio->SetSpacing (1, spacing[1]);
>> imageio->SetSpacing (2, spacing[2]);
>> imageio->SetOrigin (0,extent[0]);
>> imageio->SetOrigin (1,extent[2]);
>> imageio->SetOrigin (2,extent[4]);
>> imageio->SetHeaderSize (512);
>> imageio->SetFileTypeToBinary();
>>
>>
>>
>>
>> WriterType::Pointer writer = WriterType::New();
>>
>> writer->SetInput (_filter->GetOutput());
>> writer->SetImageIO (imageio);
>> writer->SetFileName (filename.c_str());
>> writer->Update();
>>//////////////////////end/////////////////////////////////////
>>then when i try to read the region i saved before i got a garbage image,
>>thanks.
>>moti
>>__
>>Moti Freiman, Graduate Student.
>>Medical Image Processing and Computer-Assisted Surgery Laboratory.
>>School of Computer Science and Engineering.
>>The Hebrew University of Jerusalem Givat Ram, Jerusalem 91904, Israel
>>Phone: +(972)-2-658-5371 (laboratory)
>>E-mail: freiman at cs.huji.ac.il
>>WWW site: http://www.cs.huji.ac.il/~freiman
>>
>>
>>
>>--------------------------------------------------------------------
>>mail2web - Check your email from the web at
>>http://mail2web.com/ .
>>
>>
>>_______________________________________________
>>Insight-users mailing list
>>Insight-users at itk.org
>>http://www.itk.org/mailman/listinfo/insight-users
>>
>>
>
>
>
>
> --------------------------------------------------------------------
> mail2web - Check your email from the web at
> http://mail2web.com/ .
>
>
> _______________________________________________
> 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