[Insight-users] ITK run-time error from DLL

Luis Ibanez luis.ibanez at kitware.com
Wed Mar 2 21:02:33 EST 2005


Hi Abhishek,

Please add a try/catch block around the invokation of


       ImageType::Pointer image =  ImageType::New()

and print out the error message returned by the exception.


For examples on how to use try/catch blocks please look
at the ITK Software Guide:


      http://www.itk.org/ItkSoftwareGuide.pdf



    Regards,


        Luis



-----------------------
Abhishek wrote:

> Hello All,
> 
>  
> 
> I am calling ITK functions from my Windows Control Library (.net) 
> project which produces a COM DLL and uses Managed Extensions. I only 
> have two ITK code lines:
> 
>  
> 
> typedef itk::Image< unsigned short, 3 > ImageType;
> 
> ImageType::Pointer image = ImageType::New();
> 
>  
> 
> I get “An unhandled exception of type 'System.NullReferenceException' 
> occurred in aktimporter.dll Additional information: Object reference not 
> set to an instance of an object.” If I make VTK calls it works fine. My 
> guess is this has something to do because of templates. I am clueless so 
> any pointers would be deeply appreciated.
> 
>  
> 
> Note: I manually added the ITK setting for the project such as 
> Additional Include Directories, Library Directories, Dependencies, the 
> /GR option to enable exceptions in C/C++ command line options, the /MLd 
> option for Multi-Threaded Debug DLL. I did not use CMake because I did 
> not want to loose the project options for my existing DLL project.  
> 
>  
> 
> Thanks in advance,
> 
> Abhishek
> 
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users





More information about the Insight-users mailing list