Installing DCMTK 3.6.2. for Visual Studio 2017 Community

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Christoph Graebner
Posts: 7
Joined: Fri, 2017-09-22, 13:38

Installing DCMTK 3.6.2. for Visual Studio 2017 Community

#1 Post by Christoph Graebner »

Hello everyone,

first I need to say, that I'm quite new to programming with C++ in Visual Studio and I'm not very good at using VS2017 yet.
My only experience with VS was once in a lecture for C# on VS2015.

But now I want to tell you about my problem...

I want to install DCMTK 3.6.2 for Visual Studio that I can handle DICOM files for my master thesis.

So I downloaded it and tried to follow the instructions in the INSTALL file. On my machine I run the following:
- Windows 10 Enterprise 2016 LTSB - 64-bit
- Visual Studio Community 2017 version 15.3.5
- CMake 3.8.2 - as in the INSTALL file recommended
(Are this information too specific?)

As I am not a computer scientist I failed once or twice, but finally I got everything right with CMake and created a folder, where the ALL_BUILD and INSTALL projects for VS are stored. Then I ran the ALL_BUILD in VS. That worked well, but at the end of it there was an error, that there was no project for the builds.
Then I tried to run the INSTALL project, but in VS only the ALL_BUILD project was opened and running it again brought me to the same result.

So now I'm wondering how I can complete the installation of the DCMTK libraries.

I hope you can help me. For better understanding I also took some screenshots and hope it can help.

https://picload.org/view/dgaoagol/vs_taskbar.jpg.html
This is how my taskbar in VS looks like. With this I ran the file

https://picload.org/view/dgaoagow/vs_error.jpg.html
This is the error at the end of running the ALL_BUILD

https://picload.org/view/dgaoagoi/vs_1strun.jpg.html
This is the end of the VS Output Window after running the ALL_BUILD the first time

https://picload.org/view/dgaoaglr/vs_2ndrun.jpg.html
This is the end of the VS Output Window after running the ALL_BUILD a second time

I'm looking forward to an answer and want to say thank you just right now! Have a nice weekend!

Best greetings,
Chris

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

Re: Installing DCMTK 3.6.2. for Visual Studio 2017 Community

#2 Post by Michael Onken »

Hi Chris,

there is something fishy with your setup. Maybe you can check whether you roughly followed this guide? Note that it is a bit outdated (so newer CMake options are not explained or the version number is not correct), but the general approach is completely the same.

Best,
Michael

Christoph Graebner
Posts: 7
Joined: Fri, 2017-09-22, 13:38

Re: Installing DCMTK 3.6.2. for Visual Studio 2017 Community

#3 Post by Christoph Graebner »

Michael Onken wrote: Maybe you can check whether you roughly followed this guide?
Hello Michael,

thanks for your answer. I tried to open the guide you linked for me. But I cannot open it. There is an proxy error
Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /redmine/projects/dcmtk/wiki/Howto_CMakeConfiguration.

Reason: Error reading from remote server
Can I find this guide anywhere else?

Thanks for answers. Greetings, Chris

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: Installing DCMTK 3.6.2. for Visual Studio 2017 Community

#4 Post by Jan Schlamelcher »

Hi Chris,

we had a problem with the server the wiki is running on. It is currently rebooting and should be back in a few minutes (hopefully).

Best
Jan

Christoph Graebner
Posts: 7
Joined: Fri, 2017-09-22, 13:38

Re: Installing DCMTK 3.6.2. for Visual Studio 2017 Community

#5 Post by Christoph Graebner »

Good morning guys,
I hope you are all fine =)

because I had some other issues and a free day, I just came to check your way this morning.

Well, I checked and followed your page for the CMake Configuration and did as the guide told me.
Then I ran Visual Studio, opened the project and tried to build the ALL_BUILD, as in this picture.

It ran for a while and finally got me this message. So far so good. So then I tried to handle the same way with the INSTALL project and got an error that I had to do this as an administrator.
So I did and got this result.

I'm still not sure this had to be the result allthough I think on the other handside it looks quite good.
But when I checked the succes of the installation with an example I found online, it didn't work because the libraries cannot be opened, see this.

I hope you can help me again. Thank you and have a good day!

Greetings, Chris

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

Re: Installing DCMTK 3.6.2. for Visual Studio 2017 Community

#6 Post by Michael Onken »

Hi,

good news, the build and installation went fine now :)

In order to ensure that Visual Studio finds the DCMTK header files, you have to add the include path of your DCMTK installation, i.e. the path
c:\Program Files (X86)\DCMTK\include (hope I copied it correctly from your screenshot). Google if you do not know, how to add an include path, e.g. this answer could help (did not check thoroughly).

Best,
Michael

Christoph Graebner
Posts: 7
Joined: Fri, 2017-09-22, 13:38

Re: Installing DCMTK 3.6.2. for Visual Studio 2017 Community

#7 Post by Christoph Graebner »

Hi Michael,

thanks for the information. I'm very glad to see this.

So I tried to handle path changing in Visual Studio and got beaten, but I found out that it works with including the whole path.

Thanks a lot for your help!!!

Best,
Chris

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

Re: Installing DCMTK 3.6.2. for Visual Studio 2017 Community

#8 Post by Michael Onken »

Sure, you're welcome :)

Christoph Graebner
Posts: 7
Joined: Fri, 2017-09-22, 13:38

Re: Installing DCMTK 3.6.2. for Visual Studio 2017 Community

#9 Post by Christoph Graebner »

Good morning everybody,

after a review of the answer, the link and what I've done I finally can tell you that I got the problem fixed.

So again I want to thank you for your great help.

EDIT:
After some tries writing code I finally found out VS tries to tell me that the whole libraries are full of errors???
I dunno how this can be, but most of the over 700 errors while trying to get sequence items with your example code from here are called "variable ... is not a type name".
Did there still something go wrong? Or is something with my VS setting creepy?
EDIT End

And I have another question allthough I know it doesn't belong to this forum area, but maybe you can tell me anyway.
In the DCMTK Wiki the DCMTK Primer doesn't work. Where can I find it?

Thanks again and have a nice day!

Best, Chris

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

Re: Installing DCMTK 3.6.2. for Visual Studio 2017 Community

#10 Post by Michael Onken »

Hi,

the primer just has not been written yet ;)

What is the exact error in the other example you tried to compile? It compiles for me on my linux system; it should also work on Windows. Probably you should paste the compiler log (or upload it somewhere and paste a link).

Best,
Michael

Christoph Graebner
Posts: 7
Joined: Fri, 2017-09-22, 13:38

Re: Installing DCMTK 3.6.2. for Visual Studio 2017 Community

#11 Post by Christoph Graebner »

Hi Michael,

thanks for your fast answer. Well, this is the code:

Code: Select all

#include <dcmtk/config/osconfig.h> 
#include <dcmtk/dcmdata/dctk.h>

int main(int argc, char *argv[])
{
	DcmFileFormat fileformat;
	if (fileformat.loadFile("C:\00_Mein Ordner\00_Studium\Master\Plan_Test.dcm").good())
	{
		DcmItem *item = NULL;
		DcmDataset *dataset = fileformat.getDataset();
		if (dataset->findAndGetSequenceItem(DCM_ProcedureCodeSequence, item, 0 /* first item */).good())
		{
			OFString codeMeaning;
			if (item->findAndGetOFString(DCM_CodeMeaning, codeMeaning).good())
			{
				COUT << codeMeaning; /* output value of "codeMeaning" or do something else with this information */
			}
		}
	}
	return 0;
}
It was copied as in the mentioned example, but I changed the output command.
After restarting VS it didn't recognize any errors as before. But running the code didn't work and I got an error list with 13 points, you can check out here.

All those errors doesn't tell me anything, but I may be not smart enough for that :|

But I hope you are able to tell me what to do =)

Thanks a lot.
Best, Chris

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

Re: Installing DCMTK 3.6.2. for Visual Studio 2017 Community

#12 Post by Michael Onken »

Hi,

read about compiling c and c++ code in general. You need to tell Visual Studio which libraries it should link to your executable.

Every c/c++ file is compiled as such, and in the end they are linked together into an executable. If you link "dynamically" (as you seem to do) then the compiler looks for the libraries during runtime (i.e. for the DCMTK DLLs that you probably have on your hard disk the moment you installed DCMTK).

As a simple solution you could try to copy all DCMTK-related DLLs (just search your DCMTK install folder) to the folder where the binary exists.

I think we are leaving the area of DCMTK-related questions and you definitely should work through some C++ tutorials!

Best,
Michael

Christoph Graebner
Posts: 7
Joined: Fri, 2017-09-22, 13:38

Re: Installing DCMTK 3.6.2. for Visual Studio 2017 Community

#13 Post by Christoph Graebner »

Hey,

thanks for your answer and your advice.
I'll go and check it out :)

Best,
Chris

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest