[Insight-users] ExtractImageFilter
Luis Ibanez
luis . ibanez at kitware . com
Wed, 28 May 2003 10:31:06 -0400
Hi Zein,
You are not calling "Update()" in the extract image filter.
The method "GenerateOutputInformation()" is called internally
as part of the update process.
Please call "Update()" instead of "GenerateOutputInformation()".
----
You may also want to try the RegionOfInterestImageFilter
instead of the ExtractImageFilter
http://www . itk . org/Insight/Doxygen/html/classitk_1_1RegionOfInterestImageFilter . html
The ExtractImageFilter is maintaining the
original settings for the LargestPossibleRegion
of the image, which tends to confuse filters
down the pipeline.
Please look at the example
Insight/Examples/IO/ImageReadExtractWrite.cxx
This is discussed in the SoftwareGuide
http://www . itk . org/ItkSoftwareGuide . pdf
Section 6.4 "Extracting regions", pdf-page 164.
Regards
Luis
----------------------
salah wrote:
> Hello everybody,
>
> I have used the ExtractImageFilter as shown in the piece of
> code bellow.
>
> I expect the "m_ExtractedImage" to be a new image with
> the new dimensions (new size). Actually, it is not. when
> I view it, it is jsut the original input image!!!!
>
> Could anybody please tell me if my code is principally correct???
>
> Thanks,
> Zein
>
> --------------------------------------------------------------------------------------------------
>
>
> /////// my code
> typedef itk::ExtractImageFilter<InputImageType, InputImageType > ExtractImageFilterType;
> typedef InputImageType::IndexType IndexType;
> typedef InputImageType::SizeType SizeType;
>
> ExtractImageFilterType::Pointer m_ExtractImageFilter = ExtractImageFilterType::New();
>
> IndexType start;
> SizeType size;
>
> start[0] = static_cast<IndexType::IndexValueType>( (int)xStart );
> start[1] = static_cast<IndexType::IndexValueType>( (int)yStart );
> start[2] = static_cast<IndexType::IndexValueType>( (int)zStart );
>
> size[0] = static_cast<SizeType::SizeValueType>( (int)xEnd - start[0] +1);
> size[1] = static_cast<SizeType::SizeValueType>( (int)yEnd - start[1] +1);
> size[2] = static_cast<SizeType::SizeValueType>( (int)zEnd - start[2] +1);
>
> InputImageType::RegionType region;
> region.SetIndex( start );
> region.SetSize( size );
>
> m_ExtractImageFilter->SetExtractionRegion( region );
> m_ExtractImageFilter->GenerateOutputInformation();
> m_ExtractedImage = m_ExtractImageFilter->GetOutput();
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at public . kitware . com
> http://public . kitware . com/mailman/listinfo/insight-users
>