]> Creatis software - gdcm.git/commitdiff
*ENH gdcmHeader constructor has one more parameter (default value : false)
authorjpr <jpr>
Wed, 12 Nov 2003 15:35:18 +0000 (15:35 +0000)
committerjpr <jpr>
Wed, 12 Nov 2003 15:35:18 +0000 (15:35 +0000)
           that allows the user to 'go inside' the SeQuences only
   if he wants to.
   gdcmElValSet:Print takes it into account

ChangeLog
src/gdcmElValSet.cxx
src/gdcmHeader.cxx
src/gdcmHeader.h

index b766669956ef3d301e93554f6294eb0b53c0ec84..2a3565947080001e1bb3d40f3253c570820fcab2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2003-11-12 Jean-Pierre Roux
+     *ENH  gdcmHeader constructor has one more parameter (default value : false)
+           that allows the user to 'go inside' the SeQuences only
+          if he wants to.
+          gdcmElValSet:Print takes it into account
+          
+2003-11-12  Mathieu Malaterre  <Mathieu.Malaterre@creatis.insa-lyon.fr>
+     *ENH: Update gdcmPython/CMakeLists
+     *FIX: (gdcmHeaderHelper) GetRescale and GetSlope
+     *FIX: (gdcmElValSet) char 'tag' was overiding private members (VC++)
+     
 2003-11-10 Jean-Pierre Roux
       *FIX : gdcmHeader::LoadElements is now based 
              on the ListTag listElem member, 
index 90860fae7dbf1f9ee1732ff12beaa076f39c4c7d..4d5a8713cd39b13456435ca59d886ab340d1ba19 100644 (file)
@@ -101,23 +101,25 @@ void gdcmElValSet::Print(std::ostream & os) {
    }
    
    std::cout << "------------ using listElem -----------------" << std::endl;
-   
-   //for (ListTag::iterator i = listElem.begin();
-   
+      
+  guint32 lgth;
   char greltag[9];  //group element tag
    
   for (std::list<gdcmElValue*>::iterator i = listElem.begin();  
           i != listElem.end();
           ++i){
-      sprintf(greltag,"%04x|%04x",(*i)->GetGroup(),(*i)->GetElement());
       g = (*i)->GetGroup();
       e = (*i)->GetElement();
+      sprintf(greltag,"%04x|%04x",g,e);      
       v = (*i)->GetValue();
       o = (*i)->GetOffset();
       d2 = _CreateCleanString(v);  // replace non printable characters by '.'
-      //os << std::hex <<g << "|" << e << std::dec << ": ";
-      os << greltag << " : ";
-      os << " lgr : " << (*i)->GetReadLength();
+      os << greltag << ": lgth : ";
+      lgth = (*i)->GetReadLength();
+      if ( lgth == 0xffffffff) 
+         os << std::hex << lgth << std::dec ;
+      else
+         os << lgth;
       os << ", Offset : " << o;
       os << " x(" << std::hex << o << std::dec << ") ";
       os << "\t[" << (*i)->GetVR()    << "]";
index 50af07229aa55cbed4118a5bb62b12111628a18e..ddfe7557fa01dd342c22fe941493d55ca987845f 100644 (file)
@@ -1,4 +1,4 @@
-// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.cxx,v 1.114 2003/11/12 14:06:34 malaterre Exp $
+// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.cxx,v 1.115 2003/11/12 15:35:19 jpr Exp $
 
 #include "gdcmHeader.h"
 
@@ -38,7 +38,14 @@ void gdcmHeader::Initialise(void) {
  * @param   InFilename
  * @param   exception_on_error
  */
-gdcmHeader::gdcmHeader(const char *InFilename, bool exception_on_error) {
+gdcmHeader::gdcmHeader(const char *InFilename, 
+                       bool exception_on_error,
+                      bool  enable_sequences ) {
+   if (enable_sequences)
+      enableSequences = 1;
+   else
+      enableSequences = 0;
+   
    SetMaxSizeLoadElementValue(_MaxSizeLoadElementValue_);
    filename = InFilename;
    Initialise();
@@ -629,9 +636,10 @@ bool gdcmHeader::IsDicomV3(void) {
 void gdcmHeader::FixFoundLength(gdcmElValue * ElVal, guint32 FoundLength) {
 
    ElVal->SetReadLength(FoundLength); // will be updated only if a bug is found
-   
-   if ( FoundLength == 0xffffffff)
+                    
+   if ( FoundLength == 0xffffffff) {  
       FoundLength = 0;
+   }
       
       // Sorry for the patch!  
       // XMedCom did the trick to read some nasty GE images ...
@@ -655,8 +663,9 @@ void gdcmHeader::FixFoundLength(gdcmElValue * ElVal, guint32 FoundLength) {
    } 
      // end of fix
         
-    // to try to 'go inside' SeQuences (with length), and not to ship them        
+    // to try to 'go inside' SeQuences (with length), and not to skip them        
     else if ( ElVal->GetVR() == "SQ") { 
+       if (enableSequences)    // only if the user does want to !
          FoundLength =0;        
     } 
     
index 98ff1ab1bbcd14da68e0a8f448ccf828f6ac43ed..9a88dd53c8c56b85f67fde782efff0c74f528638 100644 (file)
@@ -1,4 +1,4 @@
-// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.h,v 1.42 2003/11/10 09:21:40 jpr Exp $
+// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.h,v 1.43 2003/11/12 15:35:19 jpr Exp $
 
 #ifndef GDCMHEADER_H
 #define GDCMHEADER_H
@@ -56,7 +56,9 @@ private:
    gdcmElValSet ShaElValSet;
    /// Refering underlying filename.
    std::string filename; 
-   
+  
+   int enableSequences;
+     
    // FIXME sw should be an enum e.g.
    //enum EndianType {
       //LittleEndian, 
@@ -85,20 +87,20 @@ private:
    void SetMaxSizeLoadElementValue(long);
 
    gdcmDictEntry * GetDictEntryByNumber(guint16, guint16);
-   gdcmDictEntry * GetDictEntryByName(std::string Name);
+   gdcmDictEntry * GetDictEntryByName  (std::string Name);
 
    // ElValue related utilities
    gdcmElValue * ReadNextElement(void);
    gdcmElValue * NewElValueByNumber(guint16 group, guint16 element);
-   gdcmElValue * NewElValueByName(std::string Name);
+   gdcmElValue * NewElValueByName  (std::string Name);
 
-   void FindLength(gdcmElValue *);
-   void FindVR(gdcmElValue *);
-   void LoadElementValue(gdcmElValue *);
+   void FindLength          (gdcmElValue *);
+   void FindVR              (gdcmElValue *);
+   void LoadElementValue    (gdcmElValue *);
    void LoadElementValueSafe(gdcmElValue *);
-   void SkipElementValue(gdcmElValue *);
-   void FixFoundLength(gdcmElValue*, guint32);
-   bool IsAnInteger(gdcmElValue *);
+   void SkipElementValue    (gdcmElValue *);
+   void FixFoundLength      (gdcmElValue*, guint32);
+   bool IsAnInteger         (gdcmElValue *);
    void LoadElements(void);
    
 protected:
@@ -132,8 +134,12 @@ public:
       
    virtual void ParseHeader(bool exception_on_error = false)
      throw(gdcmFormatError);
-   gdcmHeader(const char *filename, bool exception_on_error = false);
+     
    gdcmHeader( bool exception_on_error = false);
+   gdcmHeader(const char *filename, 
+              bool  exception_on_error = false, 
+             bool  enable_sequences   = false);
+             
    virtual ~gdcmHeader();
 
    std::string GetFileName(void) {return filename;}