+2005-01-13 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
+ * src/gdcmDictSet.h : set the default output to the os variable
+ * src/gdcmDictEntry.[h|cxx] : add the Print method
+ * gdcmPython/demo/ : add a new test
+
2005-01-13 Jean-Pierre Roux <jpr@creatis.univ-lyon1.fr>
* merging of Test/PrintDicomDir and Test/TestDicomDir
* removal of now redundant Test/PrintDicomDir
${EXE_DIR}/${CMAKE_CFG_INTDIR}/_gdcm${CMAKE_SHARED_LIBRARY_SUFFIX}
)
- # Remove temporary (lib)pygdcm(.so .dll) library:
-# ADD_CUSTOM_COMMAND(
-# TARGET pygdcm
-# POST_BUILD
-# COMMAND ${CMAKE_COMMAND}
-# ARGS -E remove ${LIB_DIR}/${CMAKE_CFG_INTDIR}/${LIB_NAME}
-# )
-
- # where are library stored ?
-# SET(GDCM_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
-# ADD_CUSTOM_COMMAND(
-# TARGET pygdcm
-# POST_BUILD
-# COMMAND ${CMAKE_COMMAND}
-# ARGS -E copy
-# ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/${MY_LIB_NAME}${CMAKE_SHLIB_SUFFIX}
-# ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/vtkXY.pvm
-# TARGET vtkXY
-# )
-
ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.9)
MARK_AS_ADVANCED(PYTHON_EXECUTABLE)
IF(PYTHON_EXECUTABLE)
+ ADD_TEST(Python-PrintDict ${PYTHON_EXECUTABLE}
+ ${GDCM_BINARY_DIR}/gdcmPython/demo/PrintDict.py
+ )
ADD_TEST(Python-PrintHeader ${PYTHON_EXECUTABLE}
${GDCM_BINARY_DIR}/gdcmPython/demo/PrintHeader.py
)
${GDCM_BINARY_DIR}/gdcmPython/demo/PrintDicomDir.py
)
+CONFIGURE_FILE(
+ ${GDCM_SOURCE_DIR}/gdcmPython/demo/PrintDict.py.in
+ ${GDCM_BINARY_DIR}/gdcmPython/demo/PrintDict.py
+)
--- /dev/null
+import sys
+import os
+
+sys.path.append('${GDCM_BINARY_DIR}')
+if os.name == 'posix':
+ sys.path.append('${GDCM_BINARY_DIR}/bin')
+else:
+ sys.path.append('${GDCM_BINARY_DIR}/bin/Release')
+ sys.path.append('${GDCM_BINARY_DIR}/bin/Debug')
+
+from gdcmPython.core import *
+
+print "#####################################################################"
+# Print the DictSet
+dicts=gdcm.Global.GetDicts()
+if(not isinstance(dicts,gdcm.DictSet)):
+ raise RuntimeError,"The DictSet hasn't the good type (%s)" % type(dicts)
+print "DictSet content :"
+dicts.Print()
+
+print "#####################################################################"
+# Print the Dict (public)
+pubDict=dicts.GetDefaultPubDict()
+if(not isinstance(pubDict,gdcm.Dict)):
+ raise RuntimeError,"The public Dict hasn't the good type (%s)" % type(dict)
+print "Public Dict content :"
+pubDict.Print()
+
+print "#####################################################################"
+# Print the DictEntry (0010|0020)
+ENTRY_GR = 0x10
+ENTRY_EL = 0x20
+entry=pubDict.GetDictEntry(ENTRY_GR,ENTRY_EL)
+if(not isinstance(entry,gdcm.DictEntry)):
+ raise RuntimeError,"The entry (%04x|%04x) hasn't the good type (%s)" % \
+ (ENTRY_GR,ENTRY_EL,type(entry))
+print "Entry (%04x|%04x) content :" % (ENTRY_GR,ENTRY_EL)
+entry.Print()
+
+# Print the DictEntry (0010|0010)
+ENTRY_GR = 0x10
+ENTRY_EL = 0x10
+entry=pubDict.GetDictEntry(ENTRY_GR,ENTRY_EL)
+if(not isinstance(entry,gdcm.DictEntry)):
+ raise RuntimeError,"The entry (%04x|%04x) hasn't the good type (%s)" % \
+ (ENTRY_GR,ENTRY_EL,type(entry))
+print "Entry (%04x|%04x) content :" % (ENTRY_GR,ENTRY_EL)
+entry.Print()
+
Program: gdcm
Module: $RCSfile: gdcmDictEntry.cxx,v $
Language: C++
- Date: $Date: 2005/01/10 17:17:52 $
- Version: $Revision: 1.38 $
+ Date: $Date: 2005/01/13 16:35:37 $
+ Version: $Revision: 1.39 $
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 "gdcmUtil.h"
+#include <iomanip> // for std::ios::left, ...
+#include <fstream>
+
namespace gdcm
{
//-----------------------------------------------------------------------------
// Print
+void DictEntry::Print(std::ostream &os)
+{
+ std::string vr;
+ std::ostringstream s;
+
+ vr = GetVR();
+ if(vr==GDCM_UNKNOWN)
+ vr=" ";
+
+ s << DictEntry::TranslateToKey(GetGroup(),GetElement());
+ s << " [" << vr << "] ";
+
+ if (PrintLevel >= 1)
+ {
+ s.setf(std::ios::left);
+ s << std::setw(66-GetName().length()) << " ";
+ }
+
+ s << "[" << GetName()<< "]";
+ os << s.str();
+}
//-----------------------------------------------------------------------------
// Public
Program: gdcm
Module: $RCSfile: gdcmDictEntry.h,v $
Language: C++
- Date: $Date: 2005/01/11 15:15:38 $
- Version: $Revision: 1.28 $
+ Date: $Date: 2005/01/13 16:35:37 $
+ Version: $Revision: 1.29 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
TagName const &vm = GDCM_UNKNOWN,
TagName const &name = GDCM_UNKNOWN);
+// Print
+ void Print(std::ostream &os = std::cout);
+
+// Key creation
static TagKey TranslateToKey(uint16_t group, uint16_t element);
+// Content of DictEntry
void SetVR(TagName const &vr);
void SetVM(TagName const &vm);
Program: gdcm
Module: $RCSfile: gdcmDictSet.h,v $
Language: C++
- Date: $Date: 2005/01/11 15:15:38 $
- Version: $Revision: 1.34 $
+ Date: $Date: 2005/01/13 16:35:37 $
+ Version: $Revision: 1.35 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
DictSet();
~DictSet();
- void Print(std::ostream &os);
+ void Print(std::ostream &os = std::cout);
// Probabely useless !
//EntryNamesList *GetPubDictEntryNames();