[Insight-developers] ITKImageFunction dependecy in Transform
Matt McCormick
matt.mccormick at kitware.com
Thu Aug 18 14:09:00 EDT 2011
Hi Michael,
>
> This issue has popped up again, see below...
>
>>>>>> In rebasing the Transform changes patch set onto the latest
>>>>>itk master, I've
>>>>>> got a dependency problem. DeformationFieldTransform
>>>>>> includes itkVectorLinearInterpolateImageFunction.h, which is
>>>>>> in ITKImageFunction. But adding this to
>>>>>Transform/itk-module.cmake causes a
>>>>>> circular dependency. Any suggestions? I don't know how to
>>>>>handle this.
>>>>>
>>>>>That is a difficult problem. Moving DeformationFieldTransform to
>>>>>ITKImageFunction would probably not be appropriate. Is it
>>>possible to
>>>>>use a C++ forward declaration for
>>>>>VectorLinearInterpolateImageFunction? I assume that any module
>>>>>depending on ITKTransform is also likely to depend on
>>>ITKImageFunction
>>>>>anyway.
>>>>
>>>> OK, a forward declare works. Of course I have to declare
>>the template
>>>> parrameters along with the forward declaration so it's a
>>>little messy in
>>>> that it will need changing if the
>>>VectorLinearInterpolateImageFunction
>>>> template parameters change. Although if the class template
>>>pararmeters
>>>> change, lots of classes will change so I figure that's not a real
>>>> problem. So is forward-declaration like this ok in the ITK style?
>>>
>>>Great.
>>>
>>>ITK has very strong backwards compatibility, changes to the API like
>>>that will not take place after the ITKv4 release, and changes that
>>>break compatibility during ITKv4 need to have migration documents.
>>>http://www.vtk.org/Wiki/ITK_Release_4/Users_Migration_Guide
>>>
>>>Forward declaration is not typical ITK style. However, if it is
>>>documented with a comment in the code explaining the need to break
>>>circular dependency, it could be OK.
>>>
>
> It turns out this has worked only because the cxx files where
> itkDisplacementTransform.h is included also include
> itkVectorInterpolateImageFunction.h and
> itkVectorLinearIntepolateImageFunction.h. Of course these have to be
> included somewhere for the forward-declare to work, but this seems bad
> for the use to have to include these other two headers separately.
>
> Looking at Core/ImageFunction, the only class that includes Transform is
> RayCastInterpolateImageFunction. Would it make sense to move this to
> another module so that ImageFunction needn't depend on Transform?
>
Good detective work. Maybe move RayCastInterpolateImageFunction to
Core/Common instead of the forward declare?
Thanks,
Matt
More information about the Insight-developers
mailing list