Csharp [c#] wrappings for ITK (and Plastimatch)

Hi , I want to use itk from C# application. So far, I know simple itk works with c# but I am interested in using the plastimatch library which is simply heavily built on ITK.
Plastimatch documentation — Plastimatch 1.9.4 documentation

So far, I have made a c++ DLL (PLMGamma) linked to both ITK and plastimatch.

#pragma once
#include <itkImage.h>
#include “gamma_dose_comparison.h”

#define PLMGAMMA_API __declspec(dllexport)
#define PLMGAMMA_API __declspec(dllimport)
void Compare(FloatImageType::Pointer float_image1, FloatImageType::Pointer float_image2);


Where FloatImageType defined in \include\plastimatch\itk_image_type.h as:

typedef itk::Image < float, 3 > FloatImageType;

My Question, is how do I wrap this PLMGamma class for use in c# ? I am ok to dabble with Swig or manually writing c++ wrapper functions but I need some help please.



FloatImageType::Pointer is an alias for itk::SmartPointer<FloatImageType>. Smart pointers are problematic for wrapping, that’s why we avoid them in public interfaces in ITK. Passing images via plain pointers (FloatImageType *) should be quite easy to wrap with SWIG.

Do note that ITK currently only properly wraps for Python. C# wrappings were broken for years, before being removed recently (this year or the last). So you would need to wrap all the things you want exposed in C#, including any ITK class found in your public interface.