[Insight-users] Problems with the InverseDeformationFieldImageFilter

Luis Ibanez luis.ibanez at kitware.com
Tue Mar 31 19:58:53 EDT 2009


Hi Marta,

It looks like you omitted to define many of the parameters of the filter.

For an example of how to use this filter, please look at:

                 Insight/Testing/Code/BasicFilters/
                    itkInverseDeformationFieldImageFilterTest.cxx


In particular, you are missing lines like:

  filter->SetOutputSpacing( spacing );
  filter->SetOutputOrigin( origin );
  filter->SetSize( size );
  filter->SetSubsamplingFactor( 16 );


In practice, these parameters define the grid of the image
representing the inverse deformation field.   It is a problem
similar to what the ResampleImageFilter must do in order
to fully define its output.


   Regards,


         Luis


------------------------------------------------
On Fri, Mar 27, 2009 at 12:34 PM, Marta Schmidt <t_s_80 at gmx.de> wrote:
> Hello,
>
> I have some trouble using the itkInverseDeformationFieldImageFilter. I'm
> using the BSplineWarping1.cxx example to generate a deformation field and it
> is working fine.
> I can show the deformation field in paraview and it has a size of 448KB. But
> now I need the inverse.
> So I tried to use the itkInverseDeformationFieldImageFilter:
>
> ..
> static const int Dimension = 2;
> typedef itk::Vector< float, Dimension > VectorImagePixelType;
> typedef itk::Image< VectorImagePixelType, Dimension > VectorImageType;
>
> //read the deformation field produced by BSplineWarping1.cxx
> typedef itk::ImageFileReader< VectorImageType > FieldReaderType;
> FieldReaderType::Pointer fieldReader = FieldReaderType::New( );
> fieldReader->SetFileName( "deformationField.vtk" );
>
> //create the inverse
> typedef itk::InverseDeformationFieldImageFilter< VectorImageType,
> VectorImageType > InverseDeformationFieldFilterType;
> InverseDeformationFieldFilterType::Pointer inverseDeformFilter =
> InverseDeformationFieldFilterType::New( );
> inverseDeformFilter->SetInput( fieldReader->GetOutput( ) );
>
> //save the inverse
> typedef itk::ImageFileWriter< VectorImageType > FieldWriterType;
> FieldWriterType::Pointer fieldWriter = FieldWriterType::New( );
> fieldWriter->SetFileName( "deformationFieldInverse.vtk" );
> fieldWriter->SetInput( inverseDeformFilter->GetOutput( ) );
> fieldWriter->Update( );
> ..
>
> But the resulting deformation field is empty if I use paraview to show it.
> The size is also just 4KB.
> Can somebody tell me what I did wrong?
>
> Best regards,
> Marta
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> 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