[Insight-developers] "itkSyNImageRegistrationMethod" cannot return its metric's transform properly

Johnson, Hans J hans-johnson at uiowa.edu
Sun Dec 2 11:34:31 EST 2012


Ali,

You original e-mail is vague in its description of how you deterred that the displacement field has all zero's at every iteration.
-- Where you using a debugger?
-- How many zero values were listed?

Why do you need the const_cast in this code?  Could that change the behavior?

The use of const_cast is an indication that you are tyring to do something that is not supported.  Either ITK is deficient in not providing a const version of that member function, or you are trying to do something that has been explicitly prohibited.

Due to the ambiguity in your original posting, it is hard to figure out what your problem is.  You know that the the overall program produces a good result at the end, but you are trying to interrogate the process at every iteration, and for that you need to get the moving transform at each iteration.

***  I think that the problem you are having is exposing the current transform at each iteration to the observer.  ***

The response from Nick does not seem to address your real problem.

Please make a more thorough and very clearly stated problem, and then post enough information so that an external developer can replicate your error on their machine QUICKLY and EASILY.

Keep these facts in mind when requesting help from the ITK developer community:
1) We are almost all volunteers.  We help out of kindness not financial gain.
2)  If we can not replicate your error on my computer, we can not fix it.
3) Our time is valuable, if we need to guess, work, hard, or decipher code to determine how to replicate your problem, we will not have the time or energy even to get started
4) Provide both a) A description of the problem, b) description of how to replicate the problem, *** c) a description of how you believe the code should behave ***, and d) a proposed solution


Hans

PS: Nick Thanks for trying to address this request.  The original request was not very clear, and your effort showed that the end result is good (that was never in doubt).  The problem is interrogating for the current transform at every iteration.


From: Nick Tustison <ntustison at gmail.com<mailto:ntustison at gmail.com>>
Date: Saturday, December 1, 2012 8:24 PM
To: Ali Ghayoor <ali-ghayoor at uiowa.edu<mailto:ali-ghayoor at uiowa.edu>>
Cc: ITK <insight-developers at itk.org<mailto:insight-developers at itk.org>>
Subject: Re: [Insight-developers] "itkSyNImageRegistrationMethod" cannot return its metric's transform properly

Hi Ali,

I don't think that there's a deficiency.  I just ran the itkSyNImageRegistrationTest
and added the following snippet to write the displacement field to disk starting
at line 275.

  typedef itk::ImageFileWriter<DisplacementFieldType> WriterType2;
  typename WriterType2::Pointer writer2 = WriterType2::New();
  writer2->SetFileName( "/Users/ntustison/Desktop/testDisplacementField.nii.gz" );
  writer2->SetInput( outputTransform->GetDisplacementField() );
  writer2->Update();

The result was a non-zero displacement field that looked reasonable based
on the parameters specified by the test.

Nick


On Dec 1, 2012, at 8:30 PM, "Ghayoor, Ali" <ali-ghayoor at uiowa.edu<mailto:ali-ghayoor at uiowa.edu>> wrote:

Hello Developers,

In a registration framework, at each iteration, I get the current moving transform from the metric of the "itkSyNImageRegistrationMethod" filter; however, the returned moving transform has a displacement field with all zero values at every iteration.

To inspect this deficiency in ITK, I used "itkSyNImageRegistrationTest.cxx", and made some modifications in the test code for this purpose.
I added an iteration observer to the SyN registration stage:

    typedef CommandIterationUpdate<DisplacementFieldRegistrationType> DisplacementFieldCommandType;
    typename DisplacementFieldCommandType::Pointer DisplacementFieldObserver = DisplacementFieldCommandType::New();
    displacementFieldRegistration->AddObserver( itk::IterationEvent(), DisplacementFieldObserver );

Then, inside the observer class, I asked for the parameters of the moving transform at the current iteration:

   std::cout << " parameters: " << const_cast<TFilter *>( filter )->GetMetric()->GetMovingTransform()->GetParameters() << std::endl;
   std::cout << " fixed parameters " << const_cast<TFilter *>( filter )->GetMetric()->GetMovingTransform()->GetFixedParameters() << std::endl;

However, the Parameters of the moving transform is an all zero valued displacement field at each iteration.
Do you know why the registration filter does not return the right moving transform? Could you please help about this problem.

Thanks,
Ali
_______________________________________________
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://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-developers



________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20121202/3d09a3c6/attachment.htm>


More information about the Insight-developers mailing list