From 8dc4fc4a660215b85d92ae1f64730eac9226a5b2 Mon Sep 17 00:00:00 2001 From: malaterre Date: Fri, 29 Oct 2004 19:16:47 +0000 Subject: [PATCH] ENH: Firs step to have the dicom dict as resource --- Dicts/CMakeLists.txt | 90 +++++++++++++++++++------------------- Dicts/gdcmDefaultDict.h.in | 1 + 2 files changed, 45 insertions(+), 46 deletions(-) create mode 100644 Dicts/gdcmDefaultDict.h.in diff --git a/Dicts/CMakeLists.txt b/Dicts/CMakeLists.txt index a2611547..c45f284a 100644 --- a/Dicts/CMakeLists.txt +++ b/Dicts/CMakeLists.txt @@ -1,46 +1,44 @@ -#----------------------------------------------------------------------------- -# DICOM dictionary stuff - - -INSTALL_FILES(${GDCM_DATA_DIR} FILES - dicomV3.dic - dicomVR.dic - dicomTS.dic - DicomDir.dic -) - -# Nice trick to avoid creating a .h file each time we compile gdcm -# Since CONFIGURE_FILE do a 'copy if different' -# We have to write the file here since is contains 'DICOM_DICTIONARY' -# Which is a variable afterward... -#FILE(WRITE "/tmp/output.h.in" "@DICOM_DICTIONARY@" ) - -# Following code contributing by Andy Cedilnik -SET(INFILE "dicomV3.dic") - -FILE(READ "${INFILE}" ENT) - -STRING(REGEX REPLACE "\n" ";" ENT "${ENT}") -SET(DICOM_DICTIONARY -"// -#include \"gdcmDicomDictionaryEntry.h\" - -static gdcmDicomDictionaryEntry[] = -{") - -FOREACH(line ${ENT}) - STRING(REGEX REPLACE - "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ([0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ([A-Z]+) ([A-Z]+) (.*)([ \(RET\)]*)$" - " { \\1, \\2, \"\\3\" , \"\\4\" , \"\\5\", \"\\6\"}," nline "${line}") - SET(DICOM_DICTIONARY "${DICOM_DICTIONARY}\n${nline}") -ENDFOREACH(line) - -SET(DICOM_DICTIONARY "${DICOM_DICTIONARY} - 0 -};") - -# See above -#CONFIGURE_FILE("/tmp/output.h.in" "/tmp/output.h") - -#MESSAGE("${DICOM_DICTIONARY}") - +#----------------------------------------------------------------------------- +# DICOM dictionary stuff + + +INSTALL_FILES(${GDCM_DATA_DIR} FILES + dicomV3.dic + dicomVR.dic + dicomTS.dic + DicomDir.dic +) + +# Nice trick to avoid creating a .h file each time we compile gdcm +# Since CONFIGURE_FILE do a 'copy if different' +# We have to write the file here since is contains 'DICOM_DICTIONARY' +# Which is a variable afterward... +#FILE(WRITE "/tmp/output.h.in" "@DICOM_DICTIONARY@" ) + +# Following code contributing by Andy Cedilnik +SET(INFILE "dicomV3.dic") + +FILE(READ "${INFILE}" ENT) + +STRING(REGEX REPLACE "\n" ";" ENT "${ENT}") +SET(DICOM_DICTIONARY + "void FillDefault()\n{" +) + +FOREACH(line ${ENT}) + STRING(REGEX REPLACE +# "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ([0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ([A-Z]+) ([A-Z]+) (.*)([ \(RET\)]*)$" + "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ([0-9a-f][0-9a-f][0-9a-f][0-9a-f]) ([A-Z]+) ([A-Z?]+) (.*)$" +# " { \\1, \\2, \"\\3\" , \"\\4\" , \"\\5\", \"\\6\"}," nline "${line}") +# " { \\1, \\2, \"\\3\" , \"\\4\" , \"\\5\"}," nline "${line}") + " AddNewEntry( DictEntry ( 0x\\1, 0x\\2, \"\\3\" , \"\\4\" , \"\\5\"));" nline "${line}") + SET(DICOM_DICTIONARY "${DICOM_DICTIONARY}\n${nline}") +ENDFOREACH(line) + +SET(DICOM_DICTIONARY "${DICOM_DICTIONARY} \n }") + +# See above +CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/gdcmDefaultDict.h.in" "${GDCM_BINARY_DIR}/gdcmDefaultDict.h") + +#MESSAGE("${DICOM_DICTIONARY}") + diff --git a/Dicts/gdcmDefaultDict.h.in b/Dicts/gdcmDefaultDict.h.in new file mode 100644 index 00000000..083dee8b --- /dev/null +++ b/Dicts/gdcmDefaultDict.h.in @@ -0,0 +1 @@ +@DICOM_DICTIONARY@ -- 2.46.2