[Insight-users] ResamplingFilter problem

Alessandro notinmyhead at gmail.com
Tue Oct 2 06:56:45 EDT 2012


Hi,

you're right... I look at the example and I tried this way... with no luck:

ImageVolumeType::Pointer VolumeRetriever::applyResamplingFromImage (ImageVolumeType::Pointer img, ImageVolumeType::Pointer ref) {

    typedef itk::IdentityTransform<double, 3> TransformType;
    typedef itk::ResampleImageFilter<ImageVolumeType, ImageVolumeType> ResampleImageFilterType;
    typedef itk::BSplineInterpolateImageFunction<ImageVolumeType, double, double> InterpolatorType;

    ResampleImageFilterType::Pointer resample = ResampleImageFilterType::New();
    TransformType::Pointer pTransform = TransformType::New();
    pTransform->SetIdentity();

    InterpolatorType::Pointer pInterpolator = InterpolatorType::New();
    pInterpolator->SetSplineOrder(3);

    resample->SetInput(img);
    resample->UseReferenceImageOn();
    resample->SetReferenceImage(ref);
    resample->SetTransform(pTransform);
    resample->SetInterpolator(pInterpolator);
    resample->UpdateLargestPossibleRegion();

    resample->Update();

    return resample->GetOutput();
}


Il giorno 02/ott/2012, alle ore 12.47, alex Dowson ha scritto:

> 
> 
> Hi
> 
> You didn’t set the Transformation anywhere. Can you show me code again with correction .
> 
> 
> -----Original Message----- From: Alessandro
> Sent: Tuesday, October 02, 2012 4:15 PM
> To: Insight User
> Subject: Re: [Insight-users] ResamplingFilter problem
> 
> Hi,
> 
> I tried but still nothing seems to come out...
> 
> Ale
> 
> Il giorno 02/ott/2012, alle ore 12.39, alex Dowson ha scritto:
> 
>> 
>> Hi
>> 
>> 
>> Try calling the resample->Update() before the resample->GetOutput()
>> 
>> 
>> 
>> 
>> -----Original Message----- From: Alessandro
>> Sent: Tuesday, October 02, 2012 4:07 PM
>> To: Insight User
>> Subject: [Insight-users] ResamplingFilter problem
>> 
>> Hello,
>> 
>> I tried to Resample a 3d Slice Volume using a reference image. I wrote the following function (inside a class) to perform the task:
>> 
>> ImageVolumeType::Pointer VolumeRetriever::applyResamplingFromImage (ImageVolumeType::Pointer img, ImageVolumeType::Pointer ref) {
>> 
>>  typedef itk::IdentityTransform<double, 3> TransformType;
>>  typedef itk::ResampleImageFilter<ImageVolumeType, ImageVolumeType> ResampleImageFilterType;
>> 
>>  ResampleImageFilterType::Pointer resample = ResampleImageFilterType::New();
>> 
>>  resample->SetInput(img);
>>  resample->UseReferenceImageOn();
>>  resample->SetReferenceImage(ref);
>>  resample->UpdateLargestPossibleRegion();
>> 
>>  return resample->GetOutput();
>> }
>> 
>> where ImageVolumeType is  typedef itk::Image< InputPixelType, 3 > ImageVolumeType;
>> 
>> Problem is: when I run it the return is a NULL pointer...
>> 
>> What am I missing?
>> 
>> Thanks,
>> Ale
>> 
>> _____________________________________
>> 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 



More information about the Insight-users mailing list