[Insight-users] Output index of ExtractImageFilter
J.S.Wijnhout at lumc.nl
J.S.Wijnhout at lumc.nl
Fri Jun 20 07:41:35 EDT 2008
Hi Luis,
Thanks for the tip, although the problems remains using the
RegionOfInterestImageFilter. The region I'm extracting has size
(256,256,1) and I want to resample them to three slices (i.e. size
(25,256,3)). However it seems that the interpolators can not deal with
dimensions of size less than three, is that correct?
Best,
Jeroen
-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
Sent: dinsdag 17 juni 2008 19:18
To: Wijnhout, J.S. (LKEB)
Cc: insight-users at itk.org
Subject: Re: [Insight-users] Output index of ExtractImageFilter
Hi Jeroen,
You may want to use the itkRegionOfInterestImageFilter as an alternative
to the ExtractImageFilter.
These two filters have different policies on how they compute the image
Origin and the Starting index of their region.
ExtractImageFilter:
* Preserves the Origin
* Use as Starting index of the output image the
starting index of the region to be extracted.
RegionOfInterestImageFilter:
* Use zeros in the starting index of the output
image region
* Computes the Origin of the output image as
InputImageOrigin + Spacing x StartingIndex
It seems that for your application you are expecting the
behavior of the RegionOfInterestImageFilter.
Regards,
Luis
---------------------------
J.S.Wijnhout at lumc.nl wrote:
> 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 () );
>
> }
>
>
>
------------------------------------------------------------------------
>
> _______________________________________________
> 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