Hi,
I have GEANT4 v11.2 and Ubunto 22.04
I installed DCMTK in this path /home/ihssane/DCMTK/dcmtk-3.6.8-install
After I executed this command : export DCMTK_BASE_DIR = /home/ihssane/DCMTK/dcmtk-3.6.8-install
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${DCMTK_BASE_DIR} /lib
echo $LD_LIBRARY_PATH
/home/ihssane/ROOT/root_v6.30.02.Linux-ubuntu22.04-x86_64-gcc11.4/root/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/home/ihssane/GEANT4/geant4-v11.2.0-install/lib:/home/ihssane/GEANT4/geant4-v11.2.0-install/lib:/usr/lib/x86_64-linux-gnu::/home/ihssane/DCMTK/dcmtk-3.6.8-install/lib
And In GNUmakefile I uncomment this line #DICOM_USE_DCMTK := true, but when I do the make in the DICOM example I get this error and I can’t find the solution.
If you want to use the GNUmake system (which is deprecated), then this requires sourcing the geant4make.sh` script present in the geant4 install first.
Otherwise, directly use the CMake system to find/generate the needed build scripts.
Thank you very much sir @bmorgan for your response.
These are the steps I followed, does this mean that the association of DCMTK with the DICOM example of GEANT4 was successful,
or I must continue the other steps mentioned in the README:
2c) CMake installation and inheriting from DICOM:
Set the CMAKE_INSTALL_PREFIX (typically use the same install prefix as the Geant4 distribution)
Install the project
Installation will install libraries + DICOMConfig.cmake + other config files
if DCMTK is enabled, will also install dicomReader library + icomReaderConfig.cmake and it’s other config files
In the new Geant4 application, add “find_package(DICOM REQUIRED)” to CMakeLists.txt
(optionally) add "set(DICOM_DIR ${Geant4_DIR} CACHE PATH “Path to DICOM installation config files”) to CMakeLists.txt
add "include_directories(${DICOM_INCLUDE_DIRS}) and link target to ${DICOM_LIBRARIES}
if DCMTK is enabled, DICOMConfig.cmake will include the DCMTK and dicomReader installations, i.e. there is not need for “find_package(dicomReader)” or “find_package(DCMTK)”
Right, I think you’ve run CMake and then make in the source directory of the example. That means it’s going to pick up the GNUmakefile not the generated Makefile. Try running:
But when i add this lignes :
find_package(DICOM REQUIRED)
include_directories(${DICOM_INCLUDE_DIRS})
target_link_libraries(DICOM DICOM::library ${Geant4_LIBRARIES} ${DICOM_READER_LIBRARY} ${DCMTK_LIBRARIES})
on CMakeLists.tkt as already mentioned in the README:
-In the new Geant4 application, add “find_package(DICOM REQUIRED)” to CMakeLists.txt
(optionally) add "set(DICOM_DIR ${Geant4_DIR} CACHE PATH “Path to DICOM installation config files”) to CMakeLists.txt
add "include_directories(${DICOM_INCLUDE_DIRS}) and link target to ${DICOM_LIBRARIES}
if DCMTK is enabled, DICOMConfig.cmake will include the DCMTK and dicomReader installations, i.e. there is not need for “find_package(dicomReader)” or “find_package(DCMTK)” Then I do the cmake…/ , i have this error : ihssane@ihssane-HP-EliteBook-840-G4:~/Bureau/DICOM$ cmake …/ CMake Error: The source directory “/home/ihssane/Bureau” does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI. ihssane@ihssane-HP-EliteBook-840-G4:~/Bureau/DICOM$
G4LEDATA pointing to the low energy data base, is the G4EMLOW8.5 folder which corresponds to the low energy data base? But when I do cmake…/ I would get errors :
I’m now a bit lost I’m afraid. Could you please try starting from scratch, so deleting the directory tree where you’ve copied the DICOM example (I assume DICOM and not DICOM2?). Re-copy it from the install area of Geant4 and do exactly the following. My comments are preceded by “#”, the commands you need to run follow the “$” sign.
# Let's assume that you've deleted and recopied DICOM to ~/Bureau/DICOM
$ cd ~/Bureau/DICOM
# double check there is NO CMakeCache.txt file is this directory, you should see the "No such message..."
$ ls CMakeCache.txt
ls: CMakeCache.txt: No such file or directory
# create a directory in which to do the build
$ mkdir build
# change into it
$ cd build
# Run CMake as follows:
$ cmake -DCMAKE_PREFIX_PATH="/home/ihssane/GEANT4/geant4-v11.2.0-install;/home/ihssane/DMCTK/dmctk-3.6.8-install" -DDICOM_USE_DMCTK=ON ..
# Build
$ make
Let’s see what that does first - please post the output here, but first please see the post on How to post code snippets
Screenshots aren’t optimal for helping with these types of issue.
Thank you very much sir for following up with me on my problem.
I followed the steps you mentioned as follows:
I copied the DICOM example again in my Office but when I do the cmake I would get the error:
@bmorgan But when I followed his steps I would get this result, does this mean that the association of DCMTK to DICOM was done successfully?
ihssane@ihssane-HP-EliteBook-840-G4:~$ cd Bureau/DICOM
ihssane@ihssane-HP-EliteBook-840-G4:~/Bureau/DICOM$ mkdir build
ihssane@ihssane-HP-EliteBook-840-G4:~/Bureau/DICOM$ cd build
ihssane@ihssane-HP-EliteBook-840-G4:~/Bureau/DICOM/build$ cmake -DGeant4_DIR=/home/ihssane/GEANT4/geant4-v11.2.0-install -DDICOM_USE_DCMTK=1 -DDCMTK_DIR=/home/ihssane/DCMTK/dcmtk-3.6.8-install /home/ihssane/Bureau/DICOM
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found EXPAT: /usr/lib/x86_64-linux-gnu/libexpat.so (found suitable version "2.4.7", minimum required is "2.4.7")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found XercesC: /usr/lib/x86_64-linux-gnu/libxerces-c.so (found suitable version "3.2.3", minimum required is "3.2.3")
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
-- Found Geant4: /home/ihssane/GEANT4/geant4-v11.2.0-install/lib/cmake/Geant4/Geant4Config.cmake (found version "11.2.0")
-- DICOM: Using DCMTK
-- Trying to find DCMTK expecting DCMTKConfig.cmake
-- Trying to find DCMTK expecting DCMTKConfig.cmake - ok
-- Trying to find DCMTK expecting DCMTKConfig.cmake
-- Trying to find DCMTK expecting DCMTKConfig.cmake - ok
-- DICOM settings:
- DICOM_USE_DCMTK: 1
- DICOM_USE_HEAD: OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ihssane/Bureau/DICOM/build
ihssane@ihssane-HP-EliteBook-840-G4:~/Bureau/DICOM/build$ make
[ 2%] Building CXX object dicomReader/CMakeFiles/dicomReader.dir/src/DicomBeam.cc.o
[ 5%] Building CXX object dicomReader/CMakeFiles/dicomReader.dir/src/DicomBeamBlock.cc.o
[ 8%] Building CXX object dicomReader/CMakeFiles/dicomReader.dir/src/DicomBeamCompensator.cc.o
[ 10%] Building CXX object dicomReader/CMakeFiles/dicomReader.dir/src/DicomBeamControlPoint.cc.o
[ 13%] Building CXX object dicomReader/CMakeFiles/dicomReader.dir/src/DicomBeamDevice.cc.o
[ 16%] Building CXX object dicomReader/CMakeFiles/dicomReader.dir/src/DicomBeamDevicePos.cc.o
[ 18%] Building CXX object dicomReader/CMakeFiles/dicomReader.dir/src/DicomBeamDeviceRef.cc.o
[ 21%] Building CXX object dicomReader/CMakeFiles/dicomReader.dir/src/DicomBeamWedge.cc.o
[ 24%] Building CXX object dicomReader/CMakeFiles/dicomReader.dir/src/DicomFileCT.cc.o
[ 27%] Building CXX object dicomReader/CMakeFiles/dicomReader.dir/src/DicomFileMgr.cc.o
[ 29%] Building CXX object dicomReader/CMakeFiles/dicomReader.dir/src/DicomFilePET.cc.o
[ 32%] Building CXX object dicomReader/CMakeFiles/dicomReader.dir/src/DicomFilePlan.cc.o
[ 35%] Building CXX object dicomReader/CMakeFiles/dicomReader.dir/src/DicomFileStructure.cc.o
[ 37%] Building CXX object dicomReader/CMakeFiles/dicomReader.dir/src/DicomROI.cc.o
[ 40%] Building CXX object dicomReader/CMakeFiles/dicomReader.dir/src/DicomROIContour.cc.o
[ 43%] Building CXX object dicomReader/CMakeFiles/dicomReader.dir/src/DicomVBeamDevice.cc.o
[ 45%] Building CXX object dicomReader/CMakeFiles/dicomReader.dir/src/DicomVFile.cc.o
[ 48%] Building CXX object dicomReader/CMakeFiles/dicomReader.dir/src/DicomVFileImage.cc.o
[ 51%] Linking CXX shared library libdicomReader.so
[ 51%] Built target dicomReader
[ 54%] Building CXX object CMakeFiles/DICOM-library.dir/src/DicomActionInitialization.cc.o
[ 56%] Building CXX object CMakeFiles/DICOM-library.dir/src/DicomDetectorConstruction.cc.o
[ 59%] Building CXX object CMakeFiles/DICOM-library.dir/src/DicomEventAction.cc.o
[ 62%] Building CXX object CMakeFiles/DICOM-library.dir/src/DicomHandler.cc.o
[ 64%] Building CXX object CMakeFiles/DICOM-library.dir/src/DicomIntersectVolume.cc.o
[ 67%] Building CXX object CMakeFiles/DICOM-library.dir/src/DicomNestedParamDetectorConstruction.cc.o
[ 70%] Building CXX object CMakeFiles/DICOM-library.dir/src/DicomNestedPhantomParameterisation.cc.o
[ 72%] Building CXX object CMakeFiles/DICOM-library.dir/src/DicomPartialDetectorConstruction.cc.o
[ 75%] Building CXX object CMakeFiles/DICOM-library.dir/src/DicomPhantomParameterisationColour.cc.o
[ 78%] Building CXX object CMakeFiles/DICOM-library.dir/src/DicomPhantomZSliceHeader.cc.o
[ 81%] Building CXX object CMakeFiles/DICOM-library.dir/src/DicomPhantomZSliceMerged.cc.o
[ 83%] Building CXX object CMakeFiles/DICOM-library.dir/src/DicomPrimaryGeneratorAction.cc.o
[ 86%] Building CXX object CMakeFiles/DICOM-library.dir/src/DicomRegularDetectorConstruction.cc.o
[ 89%] Building CXX object CMakeFiles/DICOM-library.dir/src/DicomRun.cc.o
[ 91%] Building CXX object CMakeFiles/DICOM-library.dir/src/DicomRunAction.cc.o
[ 94%] Linking CXX shared library libDICOM.so
[ 94%] Built target DICOM-library
[ 97%] Building CXX object CMakeFiles/DICOM.dir/DICOM.cc.o
[100%] Linking CXX executable DICOM
[100%] Built target DICOM
ihssane@ihssane-HP-EliteBook-840-G4:~/Bureau/DICOM/build$ ./DICOM
Thank you very much sir @bmorgan for your help. Should I stop here or continue these steps mentioned in the README section 2c).
2c) CMake installation and inheriting from DICOM
- Set the CMAKE_INSTALL_PREFIX (typically use the same install prefix as the Geant4 distribution)
- Install the project
- Installation will install libraries + DICOMConfig.cmake + other config files
- if DCMTK is enabled, will also install dicomReader library + icomReaderConfig.cmake and it's other config files
- In the new Geant4 application, add "find_package(DICOM REQUIRED)" to CMakeLists.txt
- (optionally) add "set(DICOM_DIR ${Geant4_DIR} CACHE PATH "Path to DICOM installation config files") to CMakeLists.txt
- add "include_directories(${DICOM_INCLUDE_DIRS}) and link target to ${DICOM_LIBRARIES}
There’s nothing more to do if you just want to run the example, explore its features, and/or modify it to your needs. Section 2c only applies if you wanted to develop a completely new, separate application that uses the DICOM reader. The “DICOM2” example is basically showing what to do in this case.