[Insight-users] Exteding itkProcessObject

Alessandro notinmyhead at gmail.com
Mon Jul 1 04:35:54 EDT 2013


Hello,

I'm experiencing some issue trying to extend itk::ProcessObject class. Following some ITK example, I declared my new class as:

class myClass : public itk::ProcessObject
{
public:
    itkNewMacro(myClass)

    itkTypeMacro(myClass, itk::ProcessObject)

    myClass();
    ~myClass();

    std::string myExtraPublicMethod (std::string bla);
...
}

The first issue arise if I instantiate myClass this way: 

myClass myClass_instance; 

As soon as the program close, I get this WARNING:
 WARNING: In <path>/InsightToolkit-4.3.1/Modules/Core/Common/src/itkLightObject.cxx, line 274
LightObject (0x9434234): Trying to delete object with non-zero reference count.

So I figure out it could be some internal issue and I look for a dynamic allocation through smart pointers:

myClass::Pointer myclass_instance = myClass::New();

this way, at compilation time, no "extra" methods are recognized:  error: 'class itk::ProcessObject' has no member named 'myExtraPublicMethod'

What happened?

Alessandro










More information about the Insight-users mailing list