[ITK] [ITK-users] Saving deformation field in vector container

geetha s120049 at e.ntu.edu.sg
Tue Sep 29 02:31:50 EDT 2015


Hi Matt,

Here's a short compilable code for it. The deformation field I'm using can be accessed from here<https://www.dropbox.com/s/3lt059gssisg72m/deformation%20field.rar?dl=0>. It fails when updating the container.


#include <itkVectorContainer.h>
#include "itkImage.h"
#include "itkImageFileReader.h"

const unsigned int                          Dimension = 3;
typedef double CoordinateRepType;
typedef itk::Vector< float, Dimension >      VectorType;
typedef itk::Image< VectorType, Dimension >  DisplacementFieldType;
typedef itk::VectorContainer<double,DisplacementFieldType::Pointer>DFTransformContainerType;

int main( int argc, char *argv[] )
{
       int inputId = 1;
       typedef itk::ImageFileReader< DisplacementFieldType >  fieldReaderType;
       DFTransformContainerType::Pointer DeffieldContainer = DFTransformContainerType::New() ;
       fieldReaderType::Pointer deffield = fieldReaderType::New();
       deffield->SetFileName(  argv[1]);
       deffield->Update();

       std::cout<<"Updating container!"<<std::endl;
              try
              {
                     DeffieldContainer->SetElement( inputId++ , deffield->GetOutput() ); //Fails here
              }
              catch (itk::ExceptionObject &excp)
              {
              std::cerr << "Exception thrown while updating container" << std::endl;
              std::cerr << excp << std::endl;
              return EXIT_FAILURE;
              }
       std::cout<<"DONE!"<<std::endl;

}


Best Regards,
Geetha Soujanya





-----
Thanks,
Geetha
--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Saving-deformation-field-in-vector-container-tp7587905p7587931.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
_____________________________________
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://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list