From: frog Date: Wed, 6 Oct 2004 13:12:41 +0000 (+0000) Subject: - src/gdcmDocument.[cxx|h] ::ParseDES and ::ParseSQ no longer bother X-Git-Tag: Version0.6.bp~131 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=259d893061b237f67812d3902008df85e562277f;p=gdcm.git - src/gdcmDocument.[cxx|h] ::ParseDES and ::ParseSQ no longer bother to return an unused length. --- diff --git a/ChangeLog b/ChangeLog index 790a23ba..e0bc940c 100644 --- 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 * Added documentation of vtkgdcmReader on Website: diff --git a/src/gdcmDocEntry.cxx b/src/gdcmDocEntry.cxx index 9f1ec618..4f3b2be0 100644 --- a/src/gdcmDocEntry.cxx +++ b/src/gdcmDocEntry.cxx @@ -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() { diff --git a/src/gdcmDocument.cxx b/src/gdcmDocument.cxx index 6e76b45c..d74901fd 100644 --- a/src/gdcmDocument.cxx +++ b/src/gdcmDocument.cxx @@ -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: diff --git a/src/gdcmDocument.h b/src/gdcmDocument.h index 8a56ecd2..57d62dc9 100644 --- a/src/gdcmDocument.h +++ b/src/gdcmDocument.h @@ -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 *);