[Insight-users] ITK and managed C++ .NET

Nick Arini nick.arini at amersham.com
Wed Jul 7 04:26:05 EDT 2004


Hi John,

Is wrapping necessary for use with C#?

Thanks for your help.

Nick 




There's no need to wrap any of itk for use with .NET C++. Just create a
project, link against the itk libraries and set the include paths and
compile and run as usual. I've got itk/vtk and .Net forms happily working
and there's no special tricks required.

One thing we could do with is a managed C++ project template for cmake, 
then
we could SET_PROPERTIES on a target to MANAGED and get the makefile
generator to create a managed C++ project instead of a default dll type 
one.
I've tried doing this the hard way with compiler flags but couldn't get it
right. However setting a project up by hand is simple enough, so I gave up
on it. May have another go.

JB

----- Original Message ----- 
From: "Nick Arini" <nick.arini at amersham.com>
To: <insight-users at itk.org>
Sent: Tuesday, July 06, 2004 4:27 PM
Subject: [Insight-users] ITK and managed C++ .NET


> Dear ITK users,
>
> Has anyone successfully integrated ITK into a .NET application. It seems
> relatively straightforward to wrap unmanaged C++ objects such as ITK
> classes in managed wrappers for use in .NET apps (see simple example
> below). Has anyone tried this in anger with ITK? I usually rely on CMAKE
> to set up the properties of a project in Enterprise Architect VC++.NET 
for
> use with ITK. How do I do this with a Managed C++ application? Is there
> any scope for adding a .NET wrapping layer to the Tcl, Python and Java
> ones?
>
> Best regards,
>
> Nick
>
> <begin code>
>
> // This is an unmanaged class
> class MyClass
> {
> public:
>         int MyMethod( int x, int y )
>         {
>                 return x + y;
>         }
> };
>
>
> // Managed wrapper class
> __gc class MyManagedClass
> {
> public:
>         int Sum( int a, int b )
>         {
>                 MyClass *obj = new MyClass();
>                 return obj->MyMethod( a, b );
>         }
> };
>
>
> <end code>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>

_______________________________________________
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