Looking for a little advice

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
christoff
Posts: 5
Joined: Mon, 2006-06-19, 19:24

Looking for a little advice

#1 Post by christoff »

Hello,

First off, let me say that I am not an experienced coder. I am a web designer that has had the luck of being assigned an application development project, due to the fact that I'm the only person in the company that deals with any code at all (read: web geek working for a system/network builder).

A little background on the program that we are writing: the application is an autofeed interface for a Rimage server that will watch a network folder for eFilm studies sent from workstations across the facility. These studies are merely the export directories from eFilm 2.0. The application then prepares a Rimage order and sends the study to burn.

The problem comes when we are trying to extract the information for the cd label. With eFilm 2.0, the patient information we need to get for the label (Patient Name, Study Id, Study Description & Study Creation Date) is stored in the DICOMDIR file.

Now, I've already downloaded the pre-compiled binaries from this site and I was able to use the dcm2xml.exe application to output the parsed contents of this file to an xml file on the drive, so I know that somehow this toolkit can be used for what we are looking to do. Unfortunately, I lack the experience and knowledge to make complete sense out of a lot of the documentation. I'm hoping that someone more experienced in coding as well as more familiar with this toolkit (not to mention very kind-hearted) can possibly assist me with finding a quicker way to the information that I need to get than me having to bang my head against the wall reading and trying to understand all of these docs (not a knock against the developers, I'm sure your documentation is fine...I just really don't know all the lingo).

So, for any of those experienced, knowledgable and kind-hearted people out there, here's the details:

I'm building this application in VS 2005, in C#. The application itself is almost done, this is the last thing that needs to be coded before serious testing can start. I've already compiled the source for DCMTK, but all I see are EXE files, not DLL files.

I need something that I can call in my code, and get the returned value in xml. I'm assuming that the dcm2xml will work, but I have no clue how to call that from my code and get the value returned to my application if it's an EXE file.

Again, I apologize in advance for sounding like a such a newbie, but honestly....I am a newbie. I thank anyone in advance for any assistance they can offer.

Christoff
NESG

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1445
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#2 Post by Marco Eichelberg »

What you need is actually not completely trivial. DCMTK creates C++ libraries, not .NET libraries. If you want to call any DCMTK code from .NET (without actually calling an executable), you will have to create a .NET C++ project that provides a .NET library and internally calls DCMTK code. This would be compiled into a DLL that you could call from C#. This "glue code" would have to be written in C++/CLI, which is a C++ language extension developed by Microsoft and provided as part of VS 2005 that allows C++ programs to create and use .NET classes, which have slightly different semantics than C++ classes.

Michael Onken
DCMTK Developer
Posts: 2051
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#3 Post by Michael Onken »

Hi Christoff,

perhaps you could only use the binaries without diving into the code. If you call one of the DCMTK applications like dcm2xml you always have the possibility to direct all generated output to a file.

For dcm2xml, you can only do something like "dcm2xml DICOMFILE XMLFILE". I am not sure, how you continue processing of the XML, but I guess you have some kind of XML API in your C# code you work with. If this API is able to open XML files, then you could load the generated XML file into your C# code.

Another "easy" possibility to access the data like PatientsName etc is the use of dcmdump.
You can call it "dcmdump DICOMFILE > outputfile" and it will dump the contents of the file to a textfile named "outputfile". You could use another trick to access only specific data, just do "dcmdump +P PatientsName DICOMFILE > outputfile" to have only the tag (in the example PatientsName) dumped. The output of dcmdump should be parsable, too (text).

Regards,
Michael

christoff
Posts: 5
Joined: Mon, 2006-06-19, 19:24

#4 Post by christoff »

Hey guys, thanks for the replies..

I figured out a makeshift solution that works for now. I ended up trying to use the dcm2xml binary as a process in my code (from a suggestion in another post on these boards related to a different dcmtk utility app) and it works fine. With the dcm2xml.exe binary, I could actually pull the xml output back into my application and it worked beautifully. C# has inherent classes to parse through xml, so from there it was easy. I don't know if this is the optimal way to do it, but it works for now and I can start my testing.

However, with the experiences that I've had on this project so far, I'm thinking that I need to start learning some C++ alongside the C# that I'm learning now. Does anyone have any recommendations on a good starting book for learning C++, as well as any recommendations on a good and free C++ IDE?

Thanks again for your replies, btw, I appreciate the info.

Christoff
NESG

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 1 guest