[Insight-users] itk::Transform<double, 3u, 3u>’ is not a direct base of ...

Luis Ibanez luis.ibanez at kitware.com
Tue Feb 23 17:09:39 EST 2010


Motes,

It is likely that your class is missing the New macro.

Make sure that you have something like:

               itkNewMacro( Self );

in the header file.

    Regards,


           Luis


------------------------------------------------------------------------------
On Sun, Feb 21, 2010 at 4:03 AM, motes motes <mort.motes at gmail.com> wrote:
> The error:
>
> error: type ‘itk::Transform<double, 3u, 3u>’ is not a direct base of
> ‘itk::MyTransform<double, 3u, 3u>’
>
>  is related to this (the constructor in MyTransform):
>
> // Constructor with default arguments
> template<class TScalarType, unsigned int NDimensions, unsigned int VSplineOrder>
> MyTransform<TScalarType, NDimensions, VSplineOrder>
> ::MyTransform():Superclass(SpaceDimension,0) // This line gives the
> base class error!
> {
>
>
>
>
> I guess it has something to do with the following structure which
> happens when I subclass BSplineDeformableTransform:
>
>
> Transform
>   --> BSplineDeformableTransform
>             --> MyTransform
>
> From this I can see that 'Transform' is not a direct base class of
> 'MyTransform' but why is that an error?
>
>
>
>
>
>
>
>
>
>
> On Sun, Feb 21, 2010 at 9:52 AM, motes motes <mort.motes at gmail.com> wrote:
>> Ah sorry! I have now changed to (VSplineOrder):
>>
>>  TScalarType, NDimensions, VSplineOrder >
>>
>> but I still get the same error. Any ideas are most welcome!
>>
>>
>>
>> On Sun, Feb 21, 2010 at 5:32 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>>> Try:
>>> namespace itk
>>> {
>>>
>>> template <
>>>   class TScalarType = double,          // Data type for scalars
>>>   unsigned int NDimensions = 3,        // Number of dimensions
>>>   unsigned int VSplineOrder = 3 >      // Spline order
>>>
>>> class ITK_EXPORT  MyTransform : public BSplineDeformableTransform<
>>> TScalarType, NDimensions, VSplineOrder >
>>> {
>>> public:
>>>
>>>
>>> On Sat, Feb 20, 2010 at 7:33 PM, motes motes <mort.motes at gmail.com> wrote:
>>>> I am trying to subclass the BSplineDeformableTransform:
>>>>
>>>>
>>>> #include <iostream>
>>>> #include "itkTransform.h"
>>>> #include "itkImage.h"
>>>> #include "itkImageRegion.h"
>>>> #include "itkBSplineDeformableTransform.h"
>>>> #include "itkBSplineInterpolationWeightFunction.h"
>>>>
>>>> namespace itk
>>>> {
>>>>
>>>> template <
>>>>    class TScalarType = double,          // Data type for scalars
>>>>    unsigned int NDimensions = 3,        // Number of dimensions
>>>>    unsigned int VSplineOrder = 3 >      // Spline order
>>>>
>>>> class ITK_EXPORT  MyTransform : public BSplineDeformableTransform<
>>>> TScalarType, NDimensions, NDimensions >
>>>> {
>>>> public:
>>>>
>>>>
>>>> But when I create the MyTransform:
>>>>
>>>> #include "MyTransform.h"
>>>> int main(){
>>>>
>>>>  typedef itk::MyTransform<double,3,3>                 Transform;
>>>>  Transform::Pointer transform = Transform::New();
>>>> return 0;
>>>> }
>>>>
>>>> I get the error:
>>>> error: type ‘itk::Transform<double, 3u, 3u>’ is not a direct base of
>>>> ‘itk::MyTransform<double, 3u, 3u>’
>>>>
>>>>
>>>> Is it not possible to subclass eg. BSplineDeformableTransform like this?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> I have tried to subclass Transform instead and it works:
>>>>
>>>> namespace itk
>>>> {
>>>>
>>>> template <
>>>>    class TScalarType = double,          // Data type for scalars
>>>>    unsigned int NDimensions = 3,        // Number of dimensions
>>>>    unsigned int VSplineOrder = 3 >      // Spline order
>>>>
>>>> class ITK_EXPORT  MyTransform : public Transform< TScalarType,
>>>> NDimensions, NDimensions >
>>>> {
>>>> public:
>>>>
>>>>
>>>> But then I need to copy almost all the functions from the
>>>> BSplineDeformableTransform which seems pretty bad. Any ideas?
>>>> _____________________________________
>>>> 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.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-users
>>>>
>>>
>>
> _____________________________________
> 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.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-users
>


More information about the Insight-users mailing list