[Insight-users] Resampling: defining the output size at 'runtime' (Update-time) relative to the input size

Vaaksiainen vaaksiainen at gmail.com
Wed Oct 16 10:42:56 EDT 2013


Thanks for your quick reply, really appreciate.

I could well be using itk::ScaleTransform but I use simply resampling over
hand written spacing. I think my problem is in fact in pipelining:

void ResampleImageFilterEx<TInputImage,TOutputImage>::GenerateData()
{
    //....
    typename TInputImage::RegionType roi =
this->GetOutput()->GetRequestedRegion();
    typename TInputImage::SpacingType spacing =
this->GetInput()->GetSpacing();
    typename TInputImage::SizeType size = roi.GetSize();

    for ( unsigned int i = 0; i < TInputImage::ImageDimension; ++i)
    {
        spacing[i] /= m_Decimation;
        size[i] = (unsigned int)( (double)size[i] * m_Decimation );
    }
    itk::ResampleImageFilter<TInputImage,TOutputImage>::Pointer resampler =
        itk::ResampleImageFilter<TInputImage,TOutputImage>::New();

    resampler->SetOutputSpacing( inputSpacing );
    resampler->SetSize( inputSize );
    resampler->SetInput( this->GetInput() );

    resampler->GraftOutput( this->GetOutput() );
    resampler->Update();
    resampler->GraftOutput( pyrup->GetOutput() );
}

but if m_Decimation (or scale parameter) is given as parameter and input
yet unknown, I can't get regions propagating correctly. Because eventually
I want to call Update only for the tail filter.

Best,
-Vaaksiainen



2013/10/16 Mike Chinander <chinander at gmail.com>

> Check out the following example:
> http://www.itk.org/Wiki/ITK/Examples/ImageProcessing/ScaleTransform
>
>
> On Wed, Oct 16, 2013 at 9:10 AM, Vaaksiainen <vaaksiainen at gmail.com>wrote:
>
>> Hi folks,
>>
>> itk::ResampleImageFilter requires size being set before Update() so far
>> that I've understood it.
>>
>> That being said, I'd wish to implement resize image filter (derivative
>> for before mentioned) which samples the image based on scaling parameter
>> relative to its input size e.g.
>>
>> newWidth = scaling * oldWidth
>>
>> which I figure out at GenerateData() and yet, I'd wish to be able to put
>> this filter in the pipeline not knowing the size of the input image, e.g.
>>
>> Reader -> Filter#1 -> ResampleImageFilterEx -> Filter#2 -> Writer
>>
>> How PropagateRequestedRegion() works and how its implemented in
>> itk::ResampleImageFilter I'm not sure if I can do this at all.
>>
>> Please, any advice?
>>
>> Best,
>> -Vaaksiainen
>>
>>
>>
>>
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.php
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20131016/ba62f1cc/attachment.htm>


More information about the Insight-users mailing list