LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to share functions of a DLL (DicomToolkit Library-dcmtk.dll) which contains C++ classes and methods in LabVIEW.

With LabVIEW and Vision I have developed an application for reading and analyzing medical Images (DICOM file format) from a CT scanner. DICOM supports a lot of different file formats i.e. compressed images and multiframe images. To read all these different formats also directly from a Picture Archiving System (PACS) I want to use the DCMTK - DICOM-Toolkit (Offis Instituion Oldenburg, http://dicom.offis.de/index.php.de). I have created a single DCMTK.DLL and want to call its functions from LabVIEW.

 

Unfortunately most of the public functions are C++ classes and methods i.e. the loadFile function in DCMFileFormat Class (attached image).

I read in LabVIEW Wiki (http://labviewwiki.org/DLL/shared_library) the following text:

"...However, since LabVIEW only can call DLLs written in plain C, a wrapper must be made that "translates" the C++ classes to ordinary C function calls..."

 

I am "only" a LabVIEW programmer and dont know how to write a wrapper in C language. I had thought that I can solve all problems with LabVIEW. Now I have to learn C??

Its a pity! I have no chance to use the functions of this amazing (and also free) DICOM Toolkit in LabVIEW?

 

I need help. How can I develop a wrapper without any knowledge of C? Has anyone an idea?

 

Thanks a lot for your help!

 

 loadFile function in DCMFileFormat Class

 

 

0 Kudos
Message 1 of 4
(3,819 Views)

Hi PietH,

 

have you tried calling the functions from LabVIEW yet? Some of the dlls written in C++ have their interface developed so that C functions can comunicate with them, those can work with LabVIEW without developing a wrapper.

 

Regards,

Frank

0 Kudos
Message 2 of 4
(3,793 Views)

You definitely need a wrapper here. The loadFile method is a virtual method of the C++ class DcmFileFormat . There is no way to call it directly. I'm afraid you either have to learn C/C++ (you have to know C++ to do something useful with a C++ API and you have to know the differences between C++ and C to write a wrapper that exports functions to be callable from LV) or find someone who does this for you. All exported functions in the wrapper must be extern C functions because extern C is the only binary interface that is standardized. Binary code generated by C++ compilers is always compiler specific so it's technically impossible for LV to support loading C++ classes directly - LV would have to know the specifics of the particular compiler used for building the C++ library in order to do something useful with that library.

 

As an alternative I suggest you to find another DICOM library, something based on .NET might be a good choice.

 

0 Kudos
Message 3 of 4
(3,775 Views)

@candidus wrote:

... LV would have to know the specifics of the particular compiler used for building the C++ library in order to do something useful with that library...


The dcmtk Project is a CMake Project, so I can decide which C++ compiler should be used to create a C++ Project. If LabVIEW would support a particular compiler (i.e. MSVC++ 2009), it would be technically possible? I know that NI and Microsoft cooperate very well with each other. Maybe it should be possible in future versions of LabVIEW? Are there any plans from NI to do this? Because a lot of Open Source projects are CMake projects where you could select your C++ compiler.

 

 


@candidus wrote:

 ... As an alternative I suggest you to find another DICOM library, something based on .NET might be a good choice...

 


Unfortunately, good and freely available DICOM libraries are very rare. The DCMTK is probably the world's best and fastest Library and is considered the "de facto" standard! Smiley Indifferent



0 Kudos
Message 4 of 4
(3,752 Views)