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

geetha s120049 at e.ntu.edu.sg
Tue Sep 29 01:52:23 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

From: Matt McCormick-2 [via ITK Insight Users] [mailto:ml-node+s2283740n7587915h43 at n2.nabble.com]
Sent: Monday, September 28, 2015 11:30 PM
To: #CHILLA VENKATA NAGA GEETHA SOUJANYA#
Subject: Re: [ITK-users] Saving deformation field in vector container

Hello,

There does not seem to be enough information on the code that is
causing the problem or what the problem is. A short, self-contained,
compilable, example could help [1].

Thanks,
Matt

[1] http://www.sscce.org/

On Mon, Sep 28, 2015 at 12:56 AM, geetha <[hidden email]</user/SendEmail.jtp?type=node&node=7587915&i=0>> wrote:

> Hi,
>
>  I am registering images through diffeomorphic demons filter and tying to
> save the deformation field in vector containers. I saved registration
> transforms of other rigid registrations in vector containers and it was
> successful. However, trying to save deformation field in container always
> result in abrupt crashing of program. I was able to save deformation field,
> only transferring it into container is a problem. Unfortunately, even with
> catch I couldn't get any specifics of error. What am I missing?
>
> (My code for displacement field vector container and updating in container)
>
> const unsigned int                          Dimension = 3;
> typedef itk::Vector< float, Dimension >      VectorType;
> typedef itk::Image< VectorType, Dimension >  DisplacementFieldType;
> typedef
> itk::VectorContainer<double,DisplacementFieldType::Pointer>DFTransformContainerType;
> DFTransformContainerType::Pointer DeffieldContainer =
> DFTransformContainerType::New() ;
>
> //My output from registration stored in 'deffield'
> defField = ddfilter->GetDeformationField();
>
> DeffieldContainer->SetElement( inputId++ , defField );
>
>
>
> --
> View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Saving-deformation-field-in-vector-container-tp7587905.html
> Sent from the ITK Insight Users mailing list archive at Nabble.com.
> _____________________________________
> Powered by www.kitware.com<http://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
_____________________________________
Powered by www.kitware.com<http://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

________________________________
If you reply to this email, your message will be added to the discussion below:
http://itk-insight-users.2283740.n2.nabble.com/Saving-deformation-field-in-vector-container-tp7587905p7587915.html
To unsubscribe from Saving deformation field in vector container, click here<http://itk-insight-users.2283740.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7587905&code=czEyMDA0OUBlLm50dS5lZHUuc2d8NzU4NzkwNXwxOTQ5NjgzMzI5>.
NAML<http://itk-insight-users.2283740.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




-----
Thanks,
Geetha
--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Saving-deformation-field-in-vector-container-tp7587905p7587929.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