[Insight-users] Cannot access LightObject functions in object instantiated in DLL

Gao Han lintworm2 at yahoo.co.uk
Tue May 11 09:35:41 EDT 2010


Dear all, 

I have been stuck for a while now, and any help would be greatly appreciated. This is the problem: 

I am creating a program for image analysis, and am using a 
combination of wxWidgets, VTK and ITK. For this, I have set up a 
platform in which functionality can be extended by means of DLL modules. The problem at the moment is that I am working on a image display. I 
use itk::ImageToVTKImageFilter for the connection between VTK and ITK. I am able to create the object alright, and am able to call all functions of the base-classes except for the classes from LightObject. The 
offending code: 

    typedef 
itk::ImageToVTKImageFilter<UnsignedCharITKImage2D> conRGBUChar; 

    conRGBUChar * filt = conRGBUChar::New(); 
    std::cout << "In the filter class : "; 
    std::cout << filt->tralalie() << "\n";           
// Fine.... 

    std::cout << "In itkProcessObject : "; 
    std::cout << filt->GetNumberOfOutputs() << "\n";   // Fine... 

    std::cout << "In itkObject : "; 
    std::cout << filt->GetDebug() << "\n";      // 
Fine... 

    std::cout << "In itkLightObject : "; 
    std::cout << filt->GetReferenceCount() << "\n";    // Crash with 0xc000000005 

Where the function tralalie a function is that I added to the 
code of itkImageToVTKImageFilter: 
    char * tralalie() {return "In itkImageToVTKImageFilter.h";} 

(BTW: In the original itkImageToVTKFilter.h is some code that I 
don't think should be there, the function tralala etc. but that's a 
different story). 

I have no clue where this error comes from, and any 
ideas/suggestions/pointers will be greatly appreciated. What I've done 
sofar: Rebuild ITK, switched to an older version (3.16.0), implemented 
in many different ways. 

Hoping on replies, 

Gao Han 


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100511/42312fe3/attachment.htm>


More information about the Insight-users mailing list