Cannot find DCMTK_BASE_DIR from DICOM example

I work with Geant4.10.5.p01 and I installed DCMTK on an Ubuntu 20.04 machine using sudo apt install dcmtk as shown on its website https://dicom.offis.de/dcmtk.php.en POST EDIT: changed Geant4 VERSION

The whole installation tree can be found in this link https://packages.ubuntu.com/focal/amd64/dcmtk/filelist
The dcmrt package (necessary according to the DICOM/README) is missing or perhaps renamed to dcmqrti?

Anyway, the example needs the environment variable DCMTK_BASE_DIR="dcmtk installation directory"/lib but I cannot find that directory. whereis dcmtk returns dcmtk: /etc/dcmtk /usr/share/dcmtk, Cmake is not happy if I set DCMTK_BASE_DIR to either those directories or the /usr/bin/

How can I start fixing that? Am I better off using python/pydicom to convert the .dcm to .txt files?

Full log below

– The C compiler identification is GNU 9.3.0
– The CXX compiler identification is GNU 9.3.0
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– DICOM: Using DCMTK
– Trying to find DCMTK expecting DCMTKConfig.cmake
– Trying to find DCMTK expecting DCMTKConfig.cmake - failed
– Trying to find DCMTK relying on FindDCMTK.cmake
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Please set DCMTK_DIR and re-run configure (missing:
DCMTK_config_INCLUDE_DIR DCMTK_dcmdata_INCLUDE_DIR
DCMTK_dcmimage_INCLUDE_DIR DCMTK_dcmimgle_INCLUDE_DIR
DCMTK_dcmjpeg_INCLUDE_DIR DCMTK_dcmjpls_INCLUDE_DIR
DCMTK_dcmnet_INCLUDE_DIR DCMTK_dcmpstat_INCLUDE_DIR
DCMTK_dcmqrdb_INCLUDE_DIR DCMTK_dcmsign_INCLUDE_DIR DCMTK_dcmsr_INCLUDE_DIR
DCMTK_dcmtls_INCLUDE_DIR DCMTK_ofstd_INCLUDE_DIR DCMTK_oflog_INCLUDE_DIR
DCMTK_LIBRARIES)
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.16/Modules/FindDCMTK.cmake:305 (find_package_handle_standard_args)
CMakeLists.txt:53 (find_package)

– Configuring incomplete, errors occurred!

I could not find where the libraries and binaries were with that installation method so the solution I used was to sudo apt remove dcmtk and build it instead from source using cmake. Everything now works.

Special care to build with shared libraries and after that to set the environment library DCMDICTPATH to the full path of the dicom.dic file. see here

Hi Thomas, I am having the same problem, but don’t easily have control over install on the machine (also Ubuntu 20.04). Are you or anyone else aware of adding the dcmrt package without needing to install from source? Just an extra ubuntu package? Thanks, Steve

I was able to figure it out. Installing the package libdcmtk-dev on Ubuntu also installs the dcmrt package for cmake to find the DCMTK lib path.

1 Like

Hello, I would like to ask you if your problem is solved, I installed DCMTK the same way as you also use sudo apt install dcmtk, I don’t know how to make this example to link DCMTK library when I run DICOM example, then I added a sentence in cmakelist.txt: set(DICOM_USE _DCMTK ON), and then there is the same error as yours, I would like to ask if your problem is solved, and if so I would like to ask you here how to solve it.
Thank you very much for your answer.

Translated with DeepL Translate: The world's most accurate translator (free version)

Also I would like to ask which dcmtk source file you downloaded, I downloaded the dcmtk-3.6.6.tar.gz zip file from the official website, but I didn’t find the source file folder in it, did I find the wrong place? Thank you for your answer!

Hi Jodie, I had solved this problem and included the solution here.

The path to dicom.dic after you untar dcmtk-3.6.6.tar.gz is

\dcmtk-3.6.6\dcmtk-3.6.6\dcmdata\data\dicom.dic

and make sure you build with shared libraries. Is this enough to solve your issue?

I really appreciate your answer, just a few simple words have helped me a lot, I really appreciate it, I will try the method you said.

Hi, I know my question sounds stupid, but please forgive me. I have compiled the DCMTK library using cmake and then I also found the dicom.dic file under \dcmtk-3.6.6\dcmtk-3.6.6\dcmdata\data\dicom.dic path. But I would like to ask how to configure the environment variables to run the DICOM instance? If I want to change the image in the instance to another .dcm image to model how do I do it.
I know my question is stupid and it’s a lot of trouble to answer but I really hope you can give me some guidance and help.
I wish you well every day from somewhere in the world.

Translated with DeepL Translate: The world's most accurate translator (free version)

I am glad that you were able to find some answers here.

Regarding your further questions, these are are not related to this post. So, please have a look on the other threads for answers or create a new thread specifically about environment variables or specifically about changing .dcm files. This way people in the future will find these answers more easily.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.