]> 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 2d15a1793801eaed1367ae58766cbe35e135664a..db65110c41e5fc6839227524b0794e84d7248394 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 aa5be34e5dfbc44702e26cfba5e8129b3a4c26d4..37283f1334d5fd37b5680e3e5f30dd2d68cdcb2a 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 250fb60533a19b1e020f4e1520788d0f329e1d2c..73710ae0528848b72310deca78366c5accfaea61 100644 (file)
@@ -1,4 +1,4 @@
-// gdcm.h
+// gdcmExeption.h
 
 // gdcmlib Intro:  
 // * gdcmlib is a library dedicated to reading and writing dicom files.
index 06186911e0e01d2595173583733db241d81b4456..3e87463304fe5c84868e8f5cd717836a32ad1b81 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 2ad78057816677f7b428910537e2bded92137654..7d0249c261a699e6e33f357fbc2c9f3c61d2045f 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 bc1d3bdae546ce772c25bf53f3d867116920dceb..f8d5144f36f22015767a223902e5329cd81fa625 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 2b6febaa9965cbd76b9273936ea9a5b4515f19d3..d50b1e416c09fb8ace7328325210031aa102a94a 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