[Insight-users] Output index of ExtractImageFilter

Luis Ibanez luis.ibanez at kitware.com
Mon Jun 23 22:13:53 EDT 2008


Hi Jeroen,

Thanks for the clarification.

Other than with a NearestNeighborhood interpolation, it is hard
to see how a single slice can be interpolated to extract 3 slices...

What should be the "correct" behavior of a linear interpolator
for producing 3 data points out of a single one ?

e.g.
we could assume that the rest of the domain is filled with
zeros and the do something like:

    Input:        0  0   0   v   0   0   0
    Output:       0  0  v/2  v  v/2  0   0


but this will have (at least) two problems:


a) Theoretical: It will not conserve the energy
                 in the image (the signal)

b) Practical:   The two additional slices will have
                 half the intensity of the original slice


Any suggestions of a definition of 'correct behavior'
are welcome.


    Regards,


       Luis


--------------------------
J.S.Wijnhout at lumc.nl wrote:
> 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