简体   繁体   中英

C# wrapper for DCMTK library using SWIG

I want to create C# wrapper for DCMTK library (which is written in C++) using SWIG. I have full source code of DCMTK , but I have one problem I can't solve...

My script for SWIG looks like this:

#ifndef WRAPPER_SWIG_I
# define WRAPPER_SWIG_I
%{ 
%}

%include "include/dcmtk/dcmjpeg/ddpiimpl.h"
%include "include/dcmtk/dcmjpeg/dipijpeg.h"
%include "include/dcmtk/dcmjpeg/djcodecd.h"
#endif

Then I run SWIG from command line:

swig -includeall -Wall -c++ -csharp -outdir $(SolutionDir)\dcmjpegcsharp\ -module dcmjpeg -namespace dcmjpeg dcmjpeg.i

... and it throws many errors that it is unable to find headers files (which are included inside these listed in the script). For example, header file "include/dcmtk/dcmjpeg/ddpiimpl.h" is including file "dcmtk/config/osconfig.h" which is in completely different location.

The problem is that the C++ headers files in DCMTK library's source code are scattered across multiple folders, and they "don't see each other". Is there a simple solution for that? Maybe to force SWIG to automatically and recursively search for headers files in some root directory of DCMTK source?

Also, check out FO-DICOM (formerly mDCM), and the ClearCanvas API (built on mDCM). I've found them much easier to work with than DCMTk wrapped for C#.

I know you asked specifically about DCMTK, so there could be very good reasons for that choice, however this info may be useful for you or others:

The other major Dicom tookit ( GDCM ) already has a C# wrapper, created using SWIG. GDCM is a mature Dicom library used in large products for Dicom IO, eg ITK ..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM