[Insight-users] ExtractImageFilter
salah
salah at gris . uni-tuebingen . de
Wed, 28 May 2003 14:48:04 +0200
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=20
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=20
typedef itk::ExtractImageFilter<InputImageType, InputImageType > =
ExtractImageFilterType;
typedef InputImageType::IndexType IndexType;
typedef InputImageType::SizeType SizeType;
ExtractImageFilterType::Pointer m_ExtractImageFilter =3D =
ExtractImageFilterType::New();=20
IndexType start;
SizeType size;
=20
start[0] =3D static_cast<IndexType::IndexValueType>( (int)xStart );
start[1] =3D static_cast<IndexType::IndexValueType>( (int)yStart );
start[2] =3D static_cast<IndexType::IndexValueType>( (int)zStart );
size[0] =3D static_cast<SizeType::SizeValueType>( (int)xEnd - =
start[0] +1);
size[1] =3D static_cast<SizeType::SizeValueType>( (int)yEnd - =
start[1] +1);
size[2] =3D 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 =3D m_ExtractImageFilter->GetOutput();