PDA

View Full Version : [QtDcm] Library compile failure, why?



Mr_Cloud
10th July 2012, 04:59
Hello everyone,

I am trying to implement DICOM support in my Qt project, but I can't seem to be able to successfully compile the QtDcm library. Since this library is dependent on both DCMTK and ITK, they must be compiled first in order to get QtDcm.

I can compile both DCMTK and ITK without a problem, however when it gets to QtDcm, I get compile errors coming from file QtDcmConvert.cpp line 24, #include <itkOrientedImage.h> - no such file or directory.

I searched for the file and found it in \ITK\include\InsightToolkit\Common. What could I be missing?


Thank you.


Regards,
Mr_Cloud


Edit: Could this be a CMake-related error?

high_flyer
10th July 2012, 09:45
I searched for the file and found it in \ITK\include\InsightToolkit\Common. What could I be missing?

Did you make sure this path is in the include search path of your QtDcm build?

Mr_Cloud
11th July 2012, 02:49
How would I do that, high_flyer? I've tried adding CMAKE_INCLUDE_PATH before generating the makefile, but the manually specified variable wasn't used in the project.

high_flyer
11th July 2012, 10:28
How would I do that, high_flyer?
Look at the pro file?

Mr_Cloud
11th July 2012, 10:55
CMake doesn't generate pro files, only Makefile.

high_flyer
11th July 2012, 10:57
Isn't QtDcm a Qt project?
If it is, it has a pro file.

Charvi
11th July 2012, 11:25
Open the Makefile and add the INCLUDEPATH (\ITK\include\InsightToolkit\Common) in that variable. Run make after this.
Do same for the other library whose dependency is there.

high_flyer
11th July 2012, 11:27
This might work, but if this is a Qt project on which qmake is calles to generate the makefile, the changes you make to the makefile will be overwritten by qmake the next time it is called.

Charvi
11th July 2012, 11:39
That's correct. But I thought as Mr_Cloud is compiling a library it will not be soon he needs to run qmake again.
But I agree the correct approach would be to add the path in the INCLUDE variable in the pro file as soon as he finds one. ;)

Mr_Cloud
12th July 2012, 02:37
I got it working. High_flyer and Charvi, Cmake doesn't generate a pro file, only a Makefile. And QtDcm is available only as a CMake project. Therefore all the modifications must be done within CMake. And when I tried adding a custom includepath, it would ignore it.

Anyway I got it to work. For future reference under windows, there are three things needed to get QtDcm compiled: DCMTK, ITK and libtiff.a in \mingw\lib. First, generate the proper files using CMake for both DCMTK and ITK, open cmd and hit make install. By default, it should output to Program Files (x86). Then, when generating QtDcm, it will ask for DCMTK folderpath, then ITK CMake config folderpath. Note, this is NOT the same path as the root of the install. Therefore, in the ITK_DIR, the correct folderpath is \ITK\lib\InsightToolkit. This should ensure you get the right dependencies.

Finally, change build type to release for QtDcm, build shared libs, then make install. It should also output to Program Files.


Thanks for your suggestions guys.


Edit: The only problem I have now is that ui_qtdcm.h is not found when I #include <QtDcm.h>
Edit 2: Found the ui files, but now I get undefined reference errors when I try to declare an instance of QtDcm. This is mildly frustrating.

lvtingyang88
8th April 2013, 02:32
neng jia yi xia 471921964