]> Creatis software - gdcm.git/commitdiff
Adding :
authorjpr <jpr>
Thu, 26 Jun 2003 13:07:01 +0000 (13:07 +0000)
committerjpr <jpr>
Thu, 26 Jun 2003 13:07:01 +0000 (13:07 +0000)
std::string TranslateToKey(guint16 group, guint16 element);
(because a tag key may not be associated to a dictionary)

int gdcmHeader::CheckIfExistByNumber(guint16 Group, guint16 Elem);
(we need to know if we want to build a kosher Dicom Header)

int gdcmElValSet::CheckIfExistByNumber(guint16 Group, guint16 Elem);
Well .... private fields *do* exist in C++

src/gdcmElValSet.cxx
src/gdcmElValSet.h
src/gdcmException.h
src/gdcmHeader.cxx
src/gdcmHeader.h
src/gdcmUtil.cxx
src/gdcmUtil.h

index 2d15a17..db65110 100644 (file)
@@ -34,6 +34,19 @@ void gdcmElValSet::Add(gdcmElValue * newElValue) {
        NameHt[newElValue->GetName()] = newElValue;
 }
 
+
+/**
+ * \ingroup gdcmElValSet
+ * \brief   Checks if a given Dicom element exists
+ * \        within a ElValSet
+ * @param     
+ * @return  
+ */
+int gdcmElValSet::CheckIfExistByNumber(guint16 Group, guint16 Elem ) {
+       string key = TranslateToKey(Group, Elem );
+       return (tagHt.count(key));
+}
+
 /**
  * \ingroup gdcmElValSet
  * \brief   
index aa5be34..37283f1 100644 (file)
@@ -1,4 +1,4 @@
-// $Header: /cvs/public/gdcm/src/Attic/gdcmElValSet.h,v 1.14 2003/06/17 17:44:48 jpr Exp $
+// $Header: /cvs/public/gdcm/src/Attic/gdcmElValSet.h,v 1.15 2003/06/26 13:07:01 jpr Exp $
 
 #ifndef GDCMELVALSET_H
 #define GDCMELVALSET_H
@@ -42,6 +42,7 @@ public:
    int SetElValueLengthByName  (guint32 l, std::string TagName);
 
    guint32 GenerateFreeTagKeyInGroup(guint16 group);
+   int CheckIfExistByNumber(guint16 Group, guint16 Elem );
        
 private:
    void UpdateGroupLength(bool SkipSequence = false, FileType type = ImplicitVR);
index 250fb60..73710ae 100644 (file)
@@ -1,4 +1,4 @@
-// gdcm.h
+// gdcmExeption.h
 
 // gdcmlib Intro:  
 // * gdcmlib is a library dedicated to reading and writing dicom files.
index 0618691..3e87463 100644 (file)
@@ -1,4 +1,4 @@
-// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.cxx,v 1.70 2003/06/20 14:17:47 jpr Exp $
+// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.cxx,v 1.71 2003/06/26 13:07:01 jpr Exp $
 
 #include <stdio.h>
 #include <cerrno>
@@ -647,7 +647,7 @@ void gdcmHeader::FixFoundLength(gdcmElValue * ElVal, guint32 FoundLength) {
    guint16 length16;
    if( (element == 0x0010) && (group == 0x7fe0) ) {// JPR
  
-      dbg.SetDebug(1);
+      dbg.SetDebug(10);
       dbg.Verbose(2, "gdcmHeader::FindLength: ", // JPR
                      "on est sur 7fe0 0010");
    }   
@@ -1063,7 +1063,19 @@ int gdcmHeader::ReplaceOrCreateByNumber(char* Value, guint16 Group, guint16 Elem
        string v = Value;       
        PubElValSet.SetElValueByNumber(v, Group, Elem);
        return(1);
-}   
+}  
+
+/**
+ * \ingroup gdcmHeader
+ * \brief   TODO
+ * @param   
+ */
+ 
+ int gdcmHeader::CheckIfExistByNumber(guint16 Group, guint16 Elem ) {
+       return (PubElValSet.CheckIfExistByNumber(Group, Elem));
+ }
+ 
+ 
 /**
  * \ingroup gdcmHeader
  * \brief   Build a new Element Value from all the low level arguments. 
index 2ad7805..7d0249c 100644 (file)
@@ -1,4 +1,4 @@
-// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.h,v 1.28 2003/06/20 14:17:47 jpr Exp $
+// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.h,v 1.29 2003/06/26 13:07:01 jpr Exp $
 
 #ifndef GDCMHEADER_H
 #define GDCMHEADER_H
@@ -105,6 +105,7 @@ protected:
    FileType filetype;
    
    gdcmElValue * GetElValueByNumber(guint16 group, guint16 element);
+   int CheckIfExistByNumber(guint16 Group, guint16 Elem );
 
    guint16 SwapShort(guint16); // needed by gdcmFile
    guint32 SwapLong(guint32);  // for JPEG Files :-(
index bc1d3bd..f8d5144 100644 (file)
@@ -1,4 +1,4 @@
-// $Header: /cvs/public/gdcm/src/gdcmUtil.cxx,v 1.12 2003/06/17 17:44:48 jpr Exp $
+// $Header: /cvs/public/gdcm/src/gdcmUtil.cxx,v 1.13 2003/06/26 13:07:01 jpr Exp $
 
 #include <stdio.h>
 #include <ctype.h>   // For isspace
@@ -152,3 +152,20 @@ char * _CreateCleanString(string s) {
    return d;
 }
 
+///////////////////////////////////////////////////////////////////////////
+//
+// because it may not be associated to a dictionary ...
+
+std::string TranslateToKey(guint16 group, guint16 element) {
+       char trash[10];
+       string key;
+       // CLEAN ME: better call the iostream<< with the hex manipulator on.
+       // This requires some reading of the stdlibC++ sources to make the
+       // proper call (or copy).
+       sprintf(trash, "%04x|%04x", group , element);
+       key = trash;  // Convertion through assignement
+       return key;
+}
+
+
+
index 2b6feba..d50b1e4 100644 (file)
@@ -1,4 +1,4 @@
-// $Header: /cvs/public/gdcm/src/gdcmUtil.h,v 1.11 2003/06/17 17:44:48 jpr Exp $
+// $Header: /cvs/public/gdcm/src/gdcmUtil.h,v 1.12 2003/06/26 13:07:01 jpr Exp $
 
 #ifndef GDCMUTIL_H
 #define GDCMUTIL_H
@@ -48,5 +48,7 @@ extern gdcmDebug dbg;
 char * _cleanString(char *v);
 char * _CreateCleanString(string s);
 
+std::string TranslateToKey(guint16 group, guint16 element);
+
 #endif