[Insight-developers] Number of parameters in itk::IdentityTransform is not 0

Cory Quammen cquammen at cs.unc.edu
Thu Apr 29 15:30:53 EDT 2010


Hi Luis,

Thanks for pointing out the problem with template arguments of 0 in
Borland and Visual Studio 6.

A simple fix to get the expected behavior would be to override the
GetNumberOfParameters() method to return 0.

When I make this change and run the tests again, everything passes
except a test for itkNonUniformBSplineTest, which is failing on mine
and other Macs because of a compilation problem (see my Experimental
build here): http://www.cdash.org/CDash/buildSummary.php?buildid=597870

By the way, the existing test for this class does not test the
GetNumberOfParameters() method. This seems like something that should
be added. I'd be happy to do it.

Thanks,
Cory

On Thu, Apr 29, 2010 at 12:01 PM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>
> Hi Cory,
>
> I agree with you in that the Identity
> transform should have zero parameters.
>
> Unfortunately the Borland compiler and Visual Studio 6
> will not let you instantiate templates whose numerical
> argument is zero (as far as I recall).
>
> This is one of those cases were we were forced to
> compromise to do something that is "formally" wrong,
> in order to maintain support for multiple platforms.
>
>
>      Luis
>
>
> ---------------------------------------------------------------------------------
> On Thu, Apr 29, 2010 at 10:28 AM, Cory Quammen <cquammen at cs.unc.edu> wrote:
>>
>> Looking at the source of itk::IdentityTransform, I see that it is
>> initialized so that the m_Parameters member variable has size 1. Thus,
>> the result from GetNumberOfParameters() is 1. Similarly, the
>> m_Jacobian member variable is initialized to have size (image
>> dimensions, 1).
>>
>> It seems to me that the IdentityTransform should have 0 parameters.
>> The SetParameters() method does nothing, after all.
>>
>> I've tested changing the constructor in IdentityTransform to declare 0
>> parameters and the Jacobian to have dimensions (image dimensions, 0)
>> and run 'make tests'. Every test passes except for
>> itkIdentityTransformTest, which segfaults when trying to access
>> elements in the now-empty Jacobian matrix retrieved from an
>> IdentityTransform. Unfortunately, there is no way to get the
>> dimensions of an itk::Array2D, so I've had to remove the Jacobian test
>> to make it pass instead of modifying it to check for the proper
>> Jacobian dimensions.
>>
>> Am I right in thinking that the IdentityTransform should have 0
>> parameters, or is there some subtlety in the registration framework
>> that requires this? I understand that it probably hasn't been tested
>> because who would try to optimize an IdentityTransform? For the
>> record, I'm adapting the registration framework to fit image intensity
>> models as well as spatial transforms, so getting an accurate number of
>> parameters from the chosen transform is essential.
>>
>> If there is no good reason to report the number of parameters as 1,
>> I'll report a bug in Mantis and follow the procedure for committing
>> the fix.
>>
>> Thanks,
>> Cory
>>
>> --
>> Cory Quammen
>> Center for Computer Integrated Systems for Microscopy and Manipulation
>> (CISMM)
>> Department of Computer Science
>> University of North Carolina at Chapel Hill
>> http://www.cs.unc.edu/~cquammen
>> _______________________________________________
>> 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://kitware.com/products/protraining.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-developers
>
>



-- 
Cory Quammen
Center for Computer Integrated Systems for Microscopy and Manipulation (CISMM)
Department of Computer Science
University of North Carolina at Chapel Hill
http://www.cs.unc.edu/~cquammen


More information about the Insight-developers mailing list