[Insight-users] A problem with ResampleImageFilter - All zero output

Nuwan Nanayakkara nnanayak at imaging.robarts.ca
Mon Nov 22 14:55:39 EST 2004


Hi All,

 

I'm trying to use the itkResampleImageFilter with itkAffineTransform.

This itk pipeline is connected to vtk pipelines using
itkVTKImageToITKImageFilter and itkImageToVTKImageFilter in insight
applications.

My internal pixel type is float and its 3D.

I'm getting an all zero output from the filter (I'm using the Identity
transform for testing).

The connection between vtk->itk->vtk worked well without the resampling
filter.

 

Am I missing a configuration step?

 

Thanks,

Nuwan

 

p.s. I paste the code segments here in case if you need it.

 

//============ itk pipeline begins =============

            typedef itk::ResampleImageFilter<ImageType, ImageType>
FilterType; // resample image filter

            FilterType::Pointer filter = FilterType::New();

 

            typedef itk::AffineTransform< double, Dimension >
TransformType;     // transform

            TransformType::Pointer transform = TransformType::New();

            filter->SetTransform( transform );

 

            typedef itk::LinearInterpolateImageFunction<ImageType, double >
InterpolatorType;

            InterpolatorType::Pointer interpolator =
InterpolatorType::New();          // interpolator

            filter->SetInterpolator( interpolator );

 

            filter->SetDefaultPixelValue( 0 );                       //
setup

            const ImageType::SpacingType& spacing =
VTKToITKFilter->GetOutput()->GetSpacing();

            const ImageType::PointType& origin  =
VTKToITKFilter->GetOutput()->GetOrigin();

            ImageType::SizeType size =
VTKToITKFilter->GetOutput()->GetLargestPossibleRegion().GetSize();

            filter->SetOutputOrigin( origin );

            filter->SetOutputSpacing( spacing );

            filter->SetSize( size );

 

            transform->SetIdentity();

 

            filter->SetInput( VTKToITKFilter->GetOutput() );

            

            ImageType::ConstPointer itkImageOut = filter->GetOutput();
// itk image

            try

            {

                        filter->Update();

            }

            catch (itk::ExceptionObject & excep)

            {

                        std::cerr << excep << std::endl;

            }

            //============ itk pipeline ends ===============

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20041122/ab5c6ca9/attachment.htm


More information about the Insight-users mailing list