[Insight-users] Output index of ExtractImageFilter

J.S.Wijnhout at lumc.nl J.S.Wijnhout at lumc.nl
Tue Jun 24 02:56:48 EDT 2008


Hi,

I'm assuming that the slice, even with extent zero, still has a
thickness as given by the pixel spacing. In that case it is obvious, the
extracted slice will be duplicated three times with one third of the
spacing. I.e.:
Input: v1 v2 v3 spacing=1
       v4 v5 v6
       v7 v8 v9
Slice 2: v4 v5 v6 spacing=1
Interpolated: v4 v5 v6 spacing=1/3
              v4 v5 v6
              v4 v5 v6

I hope this clarifies it. If the interpolator does not take into account
the spacing and hence the finite thickness of a single slice, then I can
understand (and agree with) the behaviour of the interpolators.
Currently I'm solving the problem with duplicating the single slice
manually. However I would like to use (and understand) the default ITK
filters as much as possible.

Best,
Jeroen

-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com] 
Sent: dinsdag 24 juni 2008 4:14
To: Wijnhout, J.S. (LKEB)
Cc: insight-users at itk.org
Subject: Re: [Insight-users] Output index of ExtractImageFilter

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