[Insight-users] Output index of ExtractImageFilter
J.S.Wijnhout at lumc.nl
J.S.Wijnhout at lumc.nl
Fri Jun 13 09:37:08 EDT 2008
Hi,
It seems I'm a bit confused about the ExtractImageFilter. I'm trying to
use it to extract a slice from a 3D image, so far so good. However when
I use the extracted slice as input for ResampleImageFilter I seem to be
getting into trouble (that is: garbage output).
After some debugging I got confused about the following: the
ExtractImageFilter does not recomputed the origin (apparently this is
intended) and consequently the image index is set to the index
corresponding to the extraction region. So if I want to extract slice 10
and use index=(0,0,10) then the index of the regions of the output image
is (0,0,10) as well. However, and this is the confusing part for me, the
size of the output image will be (256,256,1). That is, the index extends
beyond the maximum allowed image. How should I deal with this?
Best,
Jeroen
This is a code snippet where I'm trying to extract a slice and then
super-sample it:
void SlabExtractionFilter::GenerateData ()
{
const Image *inputImage = GetInput ();
m_Extracter->SetInput ( inputImage );
m_Extracter->SetExtractionRegion ( slabRegion ); // selects a slice
from the volume
m_Resampler->SetOutputDirection ( inputImage->GetDirection () );
m_Resampler->SetOutputOrigin ( outputOrigin ); // the origin
belonging to the extracted slice
m_Resampler->SetOutputSpacing ( outputSpacing ); // one-third of the
spacing in the z-dimension of the input image
m_Resampler->SetSize ( outputSize ); // 256,256,3
m_Resampler->SetInput ( m_Extracter->GetOutput () );
//m_Resampler->GraftOutput ( this->GetOutput () );
m_Resampler->Update ();
GraftOutput ( m_Resampler->GetOutput () );
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080613/79ebb952/attachment-0001.htm>
More information about the Insight-users
mailing list