)
# Set the place for the public dictionary, must be set before gdcmConfigure.h
-SET( GDCM_PUB_DICT_PATH "${CMAKE_INSTALL_PREFIX}${GDCM_DATA_DIR}")
+#SET( GDCM_PUB_DICT_PATH "${CMAKE_INSTALL_PREFIX}${GDCM_DATA_DIR}")
+FIND_PATH(GDCM_PUB_DICT_PATH dicomV3.dic
+ ${GDCM_SOURCE_DIR}/Dicts
+ $ENV{PUB_DICT_PATH}
+)
#-----------------------------------------------------------------------------
# SunOS + old gcc fixes:
+2005-04-05 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
+ * src/gdcmDictGroupName.[h|cxx] : add a correlation between a group (number)
+ and it's representation name (for the NIH)
+
2005-03-31 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
* src/gdcmPixelReadConvert.cxx : problems of around of double to uint8, when
conversion of YBR to RGB pixels. So, now, the conversion is made using
dicomVR
dicomTS
DicomDir
+ DictGroupName
)
# Nice trick to avoid creating a .h file each time we compile gdcm
SET(DICOM_DATA_DICTIONARY "${DICOM_DATA_DICTIONARY} \n {0,0,0,0,0}")
+#-----------------------------------------------------------------------------
+# ... for DicomTS file
FILE(READ "dicomTS.dic" ENT_TS)
STRING(REGEX REPLACE "\r?\n" ";" ENT_TS "${ENT_TS}")
SET(DICOM_TS_DICTIONARY "")
SET(DICOM_TS_DICTIONARY "${DICOM_TS_DICTIONARY}\n${nline}")
ENDFOREACH(line)
+#-----------------------------------------------------------------------------
+# ... for DicomVR file
FILE(READ "dicomVR.dic" ENT_VR)
STRING(REGEX REPLACE ";" "/" ENT_VR "${ENT_VR}") # CMake doesn't like ';'
STRING(REGEX REPLACE "\r?\n" ";" ENT_VR "${ENT_VR}")
SET(DICOM_VR_DICTIONARY "${DICOM_VR_DICTIONARY}\n${nline}")
ENDFOREACH(line)
+#-----------------------------------------------------------------------------
+# ... for DictGroupName file
+FILE(READ "DictGroupName.dic" ENT_TS)
+STRING(REGEX REPLACE "\r?\n" ";" ENT_TS "${ENT_TS}")
+SET(DICT_GROUP_NAME_DICTIONARY "")
+
+FOREACH(line ${ENT_TS})
+ STRING(REGEX REPLACE
+ "^([0-9a-f]+) +(.*)$"
+ " groupName[0x\\1] = \\2; " nline "${line}")
+ SET(DICT_GROUP_NAME_DICTIONARY "${DICT_GROUP_NAME_DICTIONARY}\n${nline}")
+ENDFOREACH(line)
+
+#-----------------------------------------------------------------------------
+# ... for DicomDir file
FILE(READ "DicomDir.dic" ENT_DIR)
STRING(REGEX REPLACE "\\\\" "\\\\\\\\" ENT_DIR "${ENT_DIR}")
STRING(REGEX REPLACE ";" "/" ENT_DIR "${ENT_DIR}") # CMake doesn't like ';'
SET(DICOM_DIR_DICTIONARY "${DICOM_DIR_DICTIONARY}\n${nline}")
ENDFOREACH(line)
+#-----------------------------------------------------------------------------
+# ... Set the dictionnary
SET(DICOM_DIR_DICTIONARY "${DICOM_DIR_DICTIONARY} \n {0,0,0,0}")
-# See above
-FOREACH(file dicomV3.dic dicomTS.dic dicomVR.dic DicomDir.dic)
+FOREACH(file dicomV3.dic dicomTS.dic dicomVR.dic DicomDir.dic DictGroupName.dic)
CONFIGURE_FILE("${GDCM_SOURCE_DIR}/Dicts/${file}"
"${GDCM_BINARY_DIR}/Dicts/${file}.out")
ENDFOREACH(file)
--- /dev/null
+0000 "Command"
+0002 "Meta Elements"
+0004 "Directory"
+0008 "Identifing"
+0010 "Patient"
+0012 "Clinical Trial"
+0018 "Acquisition"
+0020 "Relationship"
+0028 "Image Presentaion"
+0032 "Study"
+0038 "Visit"
+003a "Waveform"
+0040 "Procedure"
+0050 "Device"
+0054 "Nuclear Medicine"
+0060 "???"
+0070 "???"
+0088 "???"
+0100 "???"
+0400 "???"
+2000 "BFS"
+2010 "BFB"
+2020 "BAB"
+2040 "IOB"
+2100 "Print Job"
+2110 "Printer"
+3002 "Radio Therapy"
+3004 "DVH"
+3006 "SSET"
+300a "RT"
+300b "RT"
+300c "???"
+300e "Review"
+4000 "Text"
+4008 "Results"
+5000 "Curves"
+5002 "Curves"
+5004 "Curves"
+5006 "Curves"
+5008 "Curves"
+500a "Curves"
+500c "Curves"
+500e "Curves"
+5010 "Curves"
+5012 "Curves"
+5014 "Curves"
+5016 "Curves"
+5018 "Curves"
+501a "Curves"
+501c "Curves"
+501e "Curves"
+6000 "Overlays"
+6002 "Overlays"
+6004 "Overlays"
+6006 "Overlays"
+6008 "Overlays"
+600a "Overlays"
+600c "Overlays"
+600e "Overlays"
+6010 "Overlays"
+6012 "Overlays"
+6014 "Overlays"
+6016 "Overlays"
+6018 "Overlays"
+601a "Overlays"
+601c "Overlays"
+601e "Overlays"
+7fe0 "Pixels"
TestHash.cxx
TestTS.cxx
TestVR.cxx
+ TestDictGroupName.cxx
TestDict.cxx
TestWriteSimple.cxx
TestImageSet.cxx
--- /dev/null
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: TestDictGroupName.cxx,v $
+ Language: C++
+ Date: $Date: 2005/04/05 10:56:24 $
+ Version: $Revision: 1.1 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#include "gdcmDictGroupName.h"
+#include "gdcmGlobal.h"
+#include "gdcmCommon.h"
+
+int TestDictGroupName(int , char *[])
+{
+ gdcm::DictGroupName groupName;
+ groupName.Print( std::cout );
+
+ std::cout << std::endl;
+ std::cout << "Group : 0x0002 : " << groupName.GetName(0x0002) << " - "
+ << (bool)(groupName.GetName(0x0002)=="Meta Elements") << std::endl;
+ std::cout << "Group : 0x0007 : " << groupName.GetName(0x0007) << " - "
+ << (bool)(groupName.GetName(0x0007)==gdcm::GDCM_UNFOUND) << std::endl;
+
+ return groupName.GetName( 0x7fe0 ) != "";
+}
#include "gdcmValEntry.h"
#include "gdcmBinEntry.h"
#include "gdcmSeqEntry.h"
+#include "gdcmVR.h"
+#include "gdcmTS.h"
+#include "gdcmDictGroupName.h"
////////////////////////////////////////////////////////////////////////////
/// Refer (below) to the definition of multi-argument typemap
%include "gdcmValEntry.h"
%include "gdcmBinEntry.h"
%include "gdcmSeqEntry.h"
+%include "gdcmVR.h"
+%include "gdcmTS.h"
+%include "gdcmDictGroupName.h"
////////////////////////////////////////////////////////////////////////////
// Notes on swig and this file gdcm.i:
gdcmDicomDirStudy.cxx
gdcmDict.cxx
gdcmDictEntry.cxx
+ gdcmDictGroupName.cxx
gdcmDictSet.cxx
gdcmDirList.cxx
gdcmDocEntry.cxx
Program: gdcm
Module: $RCSfile: gdcmCommon.h,v $
Language: C++
- Date: $Date: 2005/02/11 15:22:18 $
- Version: $Revision: 1.62 $
+ Date: $Date: 2005/04/05 10:56:25 $
+ Version: $Revision: 1.63 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#define DICT_ELEM "DicomDir.dic"
#define DICT_TS "dicomTS.dic"
#define DICT_VR "dicomVR.dic"
+#define DICT_GROUP_NAME "DictGroupName.dic"
GDCM_EXPORT extern const std::string GDCM_UNKNOWN;
GDCM_EXPORT extern const std::string GDCM_UNFOUND;
/*=========================================================================
-
+
Program: gdcm
Module: $RCSfile: gdcmDefaultDicts.cxx.in,v $
Language: C++
- Date: $Date: 2005/02/09 21:37:11 $
- Version: $Revision: 1.8 $
-
+ Date: $Date: 2005/04/05 10:56:25 $
+ Version: $Revision: 1.9 $
+
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
-
+
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
-
+
=========================================================================*/
#ifndef GDCMDEFAULTDICTS_H
#include "gdcmDictEntry.h"
#include "gdcmTS.h"
#include "gdcmVR.h"
+#include "gdcmDictGroupName.h"
#include "gdcmDicomDirElement.h"
namespace gdcm
}
}
-void FillDefaultTSDict(TSHT & ts)
+void FillDefaultTSDict(TSHT &ts)
{
@DICOM_TS_DICTIONARY@
}
-void FillDefaultVRDict(VRHT & vr)
+void FillDefaultVRDict(VRHT &vr)
{
@DICOM_VR_DICTIONARY@
}
+void FillDefaultDictGroupName(DictGroupNameHT &groupName)
+{
+@DICT_GROUP_NAME_DICTIONARY@
+}
+
typedef struct
{
const char *type;
--- /dev/null
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: gdcmDictGroupName.cxx,v $
+ Language: C++
+ Date: $Date: 2005/04/05 10:56:25 $
+ Version: $Revision: 1.1 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "gdcmDictGroupName.h"
+#include "gdcmUtil.h"
+#include "gdcmDictSet.h"
+#include "gdcmDebug.h"
+
+#include <fstream>
+#include <iostream>
+
+namespace gdcm
+{
+//-----------------------------------------------------------------------------
+/// \brief auto generated function, to fill up the 'Value Representation'
+/// Dictionnary, if relevant file is not found on user's disk
+void FillDefaultDictGroupName(DictGroupNameHT &groupName);
+
+//-----------------------------------------------------------------------------
+// Constructor / Destructor
+/**
+ * \brief Constructor
+ */
+DictGroupName::DictGroupName()
+{
+ std::string filename = DictSet::BuildDictPath() + DICT_GROUP_NAME;
+ std::ifstream from(filename.c_str());
+ if(!from)
+ {
+ gdcmWarningMacro("Can't open dictionary" << filename.c_str());
+ FillDefaultDictGroupName(groupName);
+ }
+ else
+ {
+ char buff[1024];
+ uint16_t key;
+ GroupName value;
+
+ while (!from.eof())
+ {
+ from >> std::ws;
+ from >> std::hex;
+ from >> key;
+ from >> std::ws;
+ from.getline(buff, 1024, '"');
+ from.getline(buff, 1024, '"');
+ value = buff;
+ if(!from.eof())
+ groupName[key] = value;
+
+ from.getline(buff, 1024, '\n');
+ }
+ from.close();
+ }
+}
+
+/**
+ * \brief Destructor
+ */
+DictGroupName::~DictGroupName()
+{
+ groupName.clear();
+}
+
+//-----------------------------------------------------------------------------
+// Public
+const GroupName &DictGroupName::GetName(uint16_t group)
+{
+ DictGroupNameHT::const_iterator it = groupName.find(group);
+ if (it == groupName.end())
+ {
+ return GDCM_UNFOUND;
+ }
+ return it->second;
+}
+
+//-----------------------------------------------------------------------------
+// Protected
+
+//-----------------------------------------------------------------------------
+// Private
+
+//-----------------------------------------------------------------------------
+// Print
+/**
+ * \brief Print all
+ * @param os The output stream to be written to.
+ */
+void DictGroupName::Print(std::ostream &os)
+{
+ std::ostringstream s;
+
+ for (DictGroupNameHT::iterator it = groupName.begin(); it != groupName.end(); ++it)
+ {
+ s << "DictGroupName : " << std::hex << it->first << std::dec
+ << " = " << it->second << std::endl;
+ }
+ os << s.str();
+}
+
+//-----------------------------------------------------------------------------
+} // end namespace gdcm
--- /dev/null
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: gdcmDictGroupName.h,v $
+ Language: C++
+ Date: $Date: 2005/04/05 10:56:25 $
+ Version: $Revision: 1.1 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef GDCMDICTGROUPNAME_H
+#define GDCMDICTGROUPNAME_H
+
+#include "gdcmCommon.h"
+#include <map>
+#include <string>
+#include <iostream>
+
+namespace gdcm
+{
+
+//-----------------------------------------------------------------------------
+typedef std::string GroupName;
+/// Group Name Hash Table
+typedef std::map<uint16_t, GroupName> DictGroupNameHT;
+
+//-----------------------------------------------------------------------------
+/**
+ * \brief Container for dicom Value Representation Hash Table
+ * \note This is a singleton
+ */
+class GDCM_EXPORT DictGroupName
+{
+public:
+ DictGroupName(void);
+ ~DictGroupName();
+
+ void Print(std::ostream &os = std::cout);
+
+ const GroupName &GetName(uint16_t group);
+
+private:
+ DictGroupNameHT groupName;
+};
+} // end namespace gdcm
+
+//-----------------------------------------------------------------------------
+#endif
Program: gdcm
Module: $RCSfile: gdcmDictSet.cxx,v $
Language: C++
- Date: $Date: 2005/02/25 15:49:54 $
- Version: $Revision: 1.61 $
+ Date: $Date: 2005/04/05 10:56:25 $
+ Version: $Revision: 1.62 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
if (envPath && (strlen(envPath) != 0))
{
resultPath = envPath;
- if ( resultPath[resultPath.length()-1] != '/' )
- {
- resultPath += '/';
- }
gdcmWarningMacro( "Dictionary path set from environnement");
}
else
{
resultPath = PUB_DICT_PATH;
}
+ if ( resultPath[resultPath.length()-1] != '/' )
+ {
+ resultPath += '/';
+ }
return resultPath;
}
Program: gdcm
Module: $RCSfile: gdcmGlobal.cxx,v $
Language: C++
- Date: $Date: 2005/03/22 11:41:24 $
- Version: $Revision: 1.22 $
+ Date: $Date: 2005/04/05 10:56:25 $
+ Version: $Revision: 1.23 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDebug.h"
#include "gdcmVR.h"
#include "gdcmTS.h"
+#include "gdcmDictGroupName.h"
#include "gdcmDictSet.h"
#include "gdcmDicomDirElement.h"
const std::string GDCM_UNREAD = "gdcm::UnRead";
//-----------------------------------------------------------------------------
-DictSet *Global::Dicts = (DictSet *)0;
-VR *Global::ValRes = (VR *)0;
-TS *Global::TranSyn = (TS *)0;
-DicomDirElement *Global::ddElem = (DicomDirElement *)0;
+DictSet *Global::Dicts = (DictSet *)0;
+VR *Global::ValRes = (VR *)0;
+TS *Global::TranSyn = (TS *)0;
+DictGroupName *Global::GroupName = (DictGroupName *)0;
+DicomDirElement *Global::ddElem = (DicomDirElement *)0;
//-----------------------------------------------------------------------------
/**
gdcmWarningMacro( "VR or TS or Dicts already allocated");
return;
}
- Dicts = new DictSet();
- ValRes = new VR();
- TranSyn = new TS();
- ddElem = new DicomDirElement();
+ Dicts = new DictSet();
+ ValRes = new VR();
+ TranSyn = new TS();
+ GroupName = new DictGroupName();
+ ddElem = new DicomDirElement();
}
/**
delete Dicts;
delete ValRes;
delete TranSyn;
+ delete GroupName;
delete ddElem;
}
return TranSyn;
}
+/**
+ * \brief returns a pointer to the Group name correspondance table
+ */
+DictGroupName *Global::GetDictGroupName()
+{
+ return GroupName;
+}
+
/**
* \brief returns a pointer to the DicomDir related elements Table
*/
Program: gdcm
Module: $RCSfile: gdcmGlobal.h,v $
Language: C++
- Date: $Date: 2005/02/04 16:51:36 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2005/04/05 10:56:25 $
+ Version: $Revision: 1.8 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
class DictSet;
class VR;
class TS;
+class DictGroupName;
class DicomDirElement;
//-----------------------------------------------------------------------------
/**
static DictSet *GetDicts();
static VR *GetVR();
static TS *GetTS();
+ static DictGroupName *GetDictGroupName();
static DicomDirElement *GetDicomDirElements();
private:
/// \brief Pointer to a hash table containing the Transfer Syntax codes
/// and their english description
static TS *TranSyn;
+ /// \brief Pointer to a hash table containing the Group codes
+ /// and their english name (from NIH)
+ static DictGroupName *GroupName;
/// \brief Pointer to the hash table containing the Dicom Elements necessary
/// to describe each part of a DICOMDIR
static DicomDirElement *ddElem;