]> Creatis software - gdcm.git/commitdiff
- src/gdcmDocument.[cxx|h] ::ParseDES and ::ParseSQ no longer bother
authorfrog <frog>
Wed, 6 Oct 2004 13:12:41 +0000 (13:12 +0000)
committerfrog <frog>
Wed, 6 Oct 2004 13:12:41 +0000 (13:12 +0000)
      to return an unused length.

ChangeLog
src/gdcmDocEntry.cxx
src/gdcmDocument.cxx
src/gdcmDocument.h

index 790a23ba8c17f8b04aad616b205edb8eeafba2c0..e0bc940ce27d07af4724f32d3bbc47bd2d9cd6a6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,9 @@
     - src/gdcmRLEFramesInfo.[cxx|h], gdcmRLEFrame.h added
     - src/gdcmDocument.[cxx|h] ::Parse7FE0 now sets up the RLEInfo.
     - src/CMakeLists.txt: alphabetic order reodering + new entries.
+  * CLEANUP_ROUND (4) for gdcmPixelConvert
+    - src/gdcmDocument.[cxx|h] ::ParseDES and ::ParseSQ no longer bother
+      to return an unused length.
 
 2004-10-01 Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
   * Added documentation of vtkgdcmReader on Website:
index 9f1ec6182df0096be86ebda516a1694268b38849..4f3b2be0e8c3c7d1818e0c8e872e1f0483c3ab5d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/09/27 08:39:06 $
-  Version:   $Revision: 1.23 $
+  Date:      $Date: 2004/10/06 13:12:42 $
+  Version:   $Revision: 1.24 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -209,7 +209,8 @@ void gdcmDocEntry::Write(FILE* fp, FileType filetype)
 
 /**
  * \ingroup gdcmDocEntry
- * \brief   Gets the full length of the elementary DocEntry (not only value length)
+ * \brief   Gets the full length of the elementary DocEntry (not only value
+ *          length) depending on the VR.
  */
 uint32_t gdcmDocEntry::GetFullLength()
 {
index 6e76b45c55da304592282a2c7d446550a0256004..d74901fd6f317dcd5d389beb5095f4186dfc7d90 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/10/06 09:58:08 $
-  Version:   $Revision: 1.93 $
+  Date:      $Date: 2004/10/06 13:12:42 $
+  Version:   $Revision: 1.94 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -106,7 +106,7 @@ gdcmDocument::gdcmDocument( std::string const & filename )
    long beg = ftell(Fp);
    lgt -= beg;
    
-   (void)ParseDES( this, beg, lgt, false); // le Load sera fait a la volee
+   ParseDES( this, beg, lgt, false); // le Load sera fait a la volee
 
    rewind(Fp);
    
@@ -449,6 +449,22 @@ bool gdcmDocument::IsJPEG2000()
            || IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_91) );
 }
 
+/**
+ * \brief   Determines if the Transfer Syntax corresponds to encapsulated
+ *          of encoded Pixel Data (as opposed to native).
+ * @return  True when encapsulated. False when native.
+ */
+bool gdcmDocument::IsEncapsulateTransferSyntax()
+{
+   return (   IsJPEGBaseLineProcess1TransferSyntax()
+           || IsJPEGExtendedProcess2_4TransferSyntax()
+           || IsJPEGExtendedProcess3_5TransferSyntax()
+           || IsJPEGSpectralSelectionProcess6_8TransferSyntax()
+           || IsRLELossLessTransferSyntax()
+           || IsJPEGLossless()
+           || IsJPEG2000() );
+}
+
 /**
  * \brief   Predicate for dicom version 3 file.
  * @return  True when the file is a dicom version 3.
@@ -1361,14 +1377,12 @@ uint16_t gdcmDocument::UnswapShort(uint16_t a)
  * \brief   Parses a DocEntrySet (Zero-level DocEntries or SQ Item DocEntries)
  * @return  length of the parsed set. 
  */ 
-
-long gdcmDocument::ParseDES(gdcmDocEntrySet *set,
+void gdcmDocument::ParseDES(gdcmDocEntrySet *set,
                             long offset,
                             long l_max,
                             bool delim_mode)
 {
    gdcmDocEntry *newDocEntry = 0;
-   unsigned long l = 0;
    
    while (true)
    { 
@@ -1466,20 +1480,18 @@ long gdcmDocument::ParseDES(gdcmDocEntrySet *set,
              else
              {
                 SkipToNextDocEntry(newDocEntry);
-                l = newDocEntry->GetFullLength(); 
              }
          }
          else
          {
              // to be sure we are at the beginning 
              SkipToNextDocEntry(newDocEntry);
-             l = newDocEntry->GetFullLength(); 
          }
       }
       else
       {
          // VR = "SQ"
-         l = newDocEntry->GetReadLength();            
+         unsigned long l = newDocEntry->GetReadLength();            
          if ( l != 0 ) // don't mess the delim_mode for zero-length sequence
          {
             if ( l == 0xffffffff )
@@ -1519,9 +1531,9 @@ long gdcmDocument::ParseDES(gdcmDocEntrySet *set,
 
          if ( l != 0 )
          {  // Don't try to parse zero-length sequences
-            (void)ParseSQ( newSeqEntry, 
-                           newDocEntry->GetOffset(),
-                           l, delim_mode);
+            ParseSQ( newSeqEntry, 
+                     newDocEntry->GetOffset(),
+                     l, delim_mode);
          }
          set->AddEntry( newSeqEntry );
          if ( !delim_mode && (ftell(Fp)-offset) >= l_max)
@@ -1531,14 +1543,13 @@ long gdcmDocument::ParseDES(gdcmDocEntrySet *set,
       }
       delete newDocEntry;
    }
-   return l; // Probably useless 
 }
 
 /**
  * \brief   Parses a Sequence ( SeqEntry after SeqEntry)
  * @return  parsed length for this level
  */ 
-long gdcmDocument::ParseSQ( gdcmSeqEntry* seqEntry,
+void gdcmDocument::ParseSQ( gdcmSeqEntry* seqEntry,
                             long offset, long l_max, bool delim_mode)
 {
    int SQItemNumber = 0;
@@ -1583,7 +1594,7 @@ long gdcmDocument::ParseSQ( gdcmSeqEntry* seqEntry,
          dlm_mod = false;
       }
    
-      (void)ParseDES(itemSQ, newDocEntry->GetOffset(), l, dlm_mod);
+      ParseDES(itemSQ, newDocEntry->GetOffset(), l, dlm_mod);
       
       seqEntry->AddEntry( itemSQ, SQItemNumber ); 
       SQItemNumber++;
@@ -1592,9 +1603,6 @@ long gdcmDocument::ParseSQ( gdcmSeqEntry* seqEntry,
          break;
       }
    }
-
-   int lgth = ftell(Fp) - offset;
-   return lgth;
 }
 
 /**
@@ -2829,14 +2837,6 @@ void gdcmDocument::Parse7FE0 ()
       return;
    }
       
-   if (   IsImplicitVRLittleEndianTransferSyntax()
-       || IsExplicitVRLittleEndianTransferSyntax()
-       || IsExplicitVRBigEndianTransferSyntax() /// \todo 1.2.2 ??? A verifier !
-       || IsDeflatedExplicitVRLittleEndianTransferSyntax() )
-   {
-      return;
-   }
-
    // Encoded pixel data: for the time being we are only concerned with
    // Jpeg or RLE Pixel data encodings.
    // As stated in ps-3.3, 8.2:
index 8a56ecd2448fa2cd0822c45ec67324f419f6de6d..57d62dc91a28b0bf4c8381003aa537c76acc0183 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.h,v $
   Language:  C++
-  Date:      $Date: 2004/10/06 09:58:08 $
-  Version:   $Revision: 1.45 $
+  Date:      $Date: 2004/10/06 13:12:42 $
+  Version:   $Revision: 1.46 $
  
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -124,6 +124,7 @@ public:
    bool IsRLELossLessTransferSyntax();
    bool IsJPEGLossless();
    bool IsJPEG2000();
+   bool IsEncapsulateTransferSyntax();
    bool IsDicomV3();
 
    FileType GetFileType();
@@ -164,7 +165,7 @@ protected:
    gdcmDocument( std::string const & filename );
    virtual ~gdcmDocument();
    
-   void Parse7FE0 ();   
+   void Parse7FE0();
    // Entry
    bool CheckIfEntryExistByNumber(uint16_t group, uint16_t elem );
 public:
@@ -202,9 +203,9 @@ public:
 
 private:
    // Read
-   long ParseDES(gdcmDocEntrySet *set,long offset, long l_max, bool delim_mode);
-   long ParseSQ (gdcmSeqEntry *seq,   long offset, long l_max, bool delim_mode); 
-   
+   void ParseDES(gdcmDocEntrySet *set,long offset, long l_max, bool delim_mode);
+   void ParseSQ (gdcmSeqEntry *seq,   long offset, long l_max, bool delim_mode);
+
    void LoadDocEntry      (gdcmDocEntry *);
    void FindDocEntryLength(gdcmDocEntry *) throw ( gdcmFormatError );
    void FindDocEntryVR    (gdcmDocEntry *);