From 8e7d7cb974953d9bc78b905451de7ca72887dc58 Mon Sep 17 00:00:00 2001 From: jpr Date: Wed, 29 Aug 2007 15:30:48 +0000 Subject: [PATCH] Jpeg writter is no longer confused by DataElements 7fe0|0010 inside a Sequence (e.g. : an icon inside Icom Image Sequence) Hope there is no compressed icons ! --- src/gdcmDataEntry.cxx | 8 ++++---- src/gdcmDataEntry.h | 6 +++--- src/gdcmDicomDir.cxx | 8 ++++---- src/gdcmDicomDirMeta.cxx | 10 +++++----- src/gdcmDicomDirMeta.h | 6 +++--- src/gdcmDicomDirPatient.cxx | 10 +++++----- src/gdcmDicomDirPatient.h | 6 +++--- src/gdcmDicomDirSerie.cxx | 12 ++++++------ src/gdcmDicomDirSerie.h | 7 ++++--- src/gdcmDicomDirStudy.cxx | 12 ++++++------ src/gdcmDicomDirStudy.h | 6 +++--- src/gdcmDocEntry.cxx | 13 +++++++------ src/gdcmDocEntry.h | 6 +++--- src/gdcmDocEntrySet.h | 6 +++--- src/gdcmDocument.cxx | 10 ++++++---- src/gdcmElementSet.cxx | 12 +++++++----- src/gdcmElementSet.h | 6 +++--- src/gdcmSQItem.cxx | 9 +++++---- src/gdcmSQItem.h | 7 ++++--- src/gdcmSeqEntry.cxx | 11 ++++++----- src/gdcmSeqEntry.h | 7 ++++--- 21 files changed, 94 insertions(+), 84 deletions(-) diff --git a/src/gdcmDataEntry.cxx b/src/gdcmDataEntry.cxx index 9e35cc59..3504fee1 100644 --- a/src/gdcmDataEntry.cxx +++ b/src/gdcmDataEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDataEntry.cxx,v $ Language: C++ - Date: $Date: 2007/08/27 16:14:47 $ - Version: $Revision: 1.46 $ + Date: $Date: 2007/08/29 15:30:48 $ + Version: $Revision: 1.47 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -550,10 +550,10 @@ void DataEntry::Copy(DocEntry *doc) * @param filetype type of the file (ACR, ImplicitVR, ExplicitVR, ...) */ void DataEntry::WriteContent(std::ofstream *fp, FileType filetype, - bool insideMetaElements) + bool insideMetaElements, bool insideSequence) { // writes the 'common part' - DocEntry::WriteContent(fp, filetype, insideMetaElements); + DocEntry::WriteContent(fp, filetype, insideMetaElements, insideSequence); if ( GetGroup() == 0xfffe ) { diff --git a/src/gdcmDataEntry.h b/src/gdcmDataEntry.h index 0fde3e63..d043126c 100644 --- a/src/gdcmDataEntry.h +++ b/src/gdcmDataEntry.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDataEntry.h,v $ Language: C++ - Date: $Date: 2007/08/22 16:14:03 $ - Version: $Revision: 1.19 $ + Date: $Date: 2007/08/29 15:30:48 $ + Version: $Revision: 1.20 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -52,7 +52,7 @@ public: // Write virtual void WriteContent(std::ofstream *fp, FileType filetype, - bool insideMetaElements ); + bool insideMetaElements, bool insideSequence); uint32_t ComputeFullLength(); // Set/Get data diff --git a/src/gdcmDicomDir.cxx b/src/gdcmDicomDir.cxx index a6aa0ad9..19794214 100644 --- a/src/gdcmDicomDir.cxx +++ b/src/gdcmDicomDir.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDir.cxx,v $ Language: C++ - Date: $Date: 2007/07/26 08:36:49 $ - Version: $Revision: 1.194 $ + Date: $Date: 2007/08/29 15:30:48 $ + Version: $Revision: 1.195 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -492,7 +492,7 @@ bool DicomDir::Write(std::string const &fileName) binary_write( *fp, "DICM"); DicomDirMeta *ptrMeta = GetMeta(); - ptrMeta->WriteContent(fp, ExplicitVR, true); + ptrMeta->WriteContent(fp, ExplicitVR, true, false); // force writing 0004|1220 [SQ ], that CANNOT exist within DicomDirMeta for(i=0;i<6;++i) @@ -504,7 +504,7 @@ bool DicomDir::Write(std::string const &fileName) cc != Patients.end(); ++cc ) { - (*cc)->WriteContent( fp, ExplicitVR, false ); + (*cc)->WriteContent( fp, ExplicitVR, false, true ); } // force writing Sequence Delimitation Item diff --git a/src/gdcmDicomDirMeta.cxx b/src/gdcmDicomDirMeta.cxx index 37c66051..0c98a59d 100644 --- a/src/gdcmDicomDirMeta.cxx +++ b/src/gdcmDicomDirMeta.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirMeta.cxx,v $ Language: C++ - Date: $Date: 2007/07/26 08:36:49 $ - Version: $Revision: 1.38 $ + Date: $Date: 2007/08/29 15:30:48 $ + Version: $Revision: 1.39 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -53,11 +53,11 @@ DicomDirMeta::~DicomDirMeta() /** * \brief Writes the Meta Elements * @param fp ofstream to write to - * @param filetype type of the file (ImplicitVR, ExplicitVR, ...) + * @param filetype type of the file (ImplicitVR, ExplicitVR, JPEG, JPEG2000 ...) * @return */ void DicomDirMeta::WriteContent(std::ofstream *fp, FileType filetype, - bool insideMetaElements) + bool dummy, bool dummy2) { // 'File Meta Information Version' @@ -86,7 +86,7 @@ void DicomDirMeta::WriteContent(std::ofstream *fp, FileType filetype, ++i) { // true : we are in MetaElements - (*i)->WriteContent(fp, filetype, true); + (*i)->WriteContent(fp, filetype, true, false); } } diff --git a/src/gdcmDicomDirMeta.h b/src/gdcmDicomDirMeta.h index ee793596..df2f87ba 100644 --- a/src/gdcmDicomDirMeta.h +++ b/src/gdcmDicomDirMeta.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirMeta.h,v $ Language: C++ - Date: $Date: 2007/08/22 16:14:03 $ - Version: $Revision: 1.24 $ + Date: $Date: 2007/08/29 15:30:48 $ + Version: $Revision: 1.25 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -37,7 +37,7 @@ public: static DicomDirMeta *New(bool empty=false) {return new DicomDirMeta(empty);} virtual void Print(std::ostream &os = std::cout, std::string const &indent = "" ); - virtual void WriteContent(std::ofstream *fp, FileType t, bool insideMetaElements); + virtual void WriteContent(std::ofstream *fp, FileType t, bool insideMetaElements, bool insideSequence); int ComputeGroup0002Length( ); protected: diff --git a/src/gdcmDicomDirPatient.cxx b/src/gdcmDicomDirPatient.cxx index 0e2e577a..33896dff 100644 --- a/src/gdcmDicomDirPatient.cxx +++ b/src/gdcmDicomDirPatient.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirPatient.cxx,v $ Language: C++ - Date: $Date: 2007/07/26 08:36:49 $ - Version: $Revision: 1.42 $ + Date: $Date: 2007/08/29 15:30:48 $ + Version: $Revision: 1.43 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -57,15 +57,15 @@ DicomDirPatient::~DicomDirPatient() * @param fp ofstream to write to * @param t Type of the File (explicit VR, implicitVR, ...) */ -void DicomDirPatient::WriteContent(std::ofstream *fp, FileType t, bool insideMetaElements) +void DicomDirPatient::WriteContent(std::ofstream *fp, FileType t, bool dummy, bool dummy2) { - DicomDirObject::WriteContent(fp, t, false); + DicomDirObject::WriteContent(fp, t, false, true); for(ListDicomDirStudy::iterator cc = Studies.begin(); cc!= Studies.end(); ++cc ) { - (*cc)->WriteContent( fp, t, false ); + (*cc)->WriteContent( fp, t, false, true ); } } diff --git a/src/gdcmDicomDirPatient.h b/src/gdcmDicomDirPatient.h index db8a955e..dd3a4dc1 100644 --- a/src/gdcmDicomDirPatient.h +++ b/src/gdcmDicomDirPatient.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirPatient.h,v $ Language: C++ - Date: $Date: 2007/08/22 16:14:03 $ - Version: $Revision: 1.34 $ + Date: $Date: 2007/08/29 15:30:48 $ + Version: $Revision: 1.35 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -42,7 +42,7 @@ public: static DicomDirPatient *New(bool empty=false) {return new DicomDirPatient(empty);} void Print(std::ostream &os = std::cout, std::string const &indent = "" ); - void WriteContent(std::ofstream *fp, FileType t, bool insideMetaElements); + void WriteContent(std::ofstream *fp, FileType t, bool insideMetaElements, bool insideSequence ); // Patient methods /// \brief Adds a new gdcm::DicomDirStudy to the Patient diff --git a/src/gdcmDicomDirSerie.cxx b/src/gdcmDicomDirSerie.cxx index 1fe41dc3..99a96c2d 100644 --- a/src/gdcmDicomDirSerie.cxx +++ b/src/gdcmDicomDirSerie.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirSerie.cxx,v $ Language: C++ - Date: $Date: 2007/07/26 08:36:49 $ - Version: $Revision: 1.44 $ + Date: $Date: 2007/08/29 15:30:49 $ + Version: $Revision: 1.45 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -58,21 +58,21 @@ DicomDirSerie::~DicomDirSerie() * @param fp ofstream to write to * @param t Type of the File (explicit VR, implicitVR, ...) */ -void DicomDirSerie::WriteContent(std::ofstream *fp, FileType t, bool insideMetaElements) +void DicomDirSerie::WriteContent(std::ofstream *fp, FileType t, bool dummy, bool dummy2) { - DicomDirObject::WriteContent(fp, t, false); + DicomDirObject::WriteContent(fp, t, false, true); for(ListDicomDirImage::iterator cc = Images.begin(); cc!= Images.end(); ++cc ) { - (*cc)->WriteContent( fp, t, false ); + (*cc)->WriteContent( fp, t, false, true ); } for(ListDicomDirPrivate::iterator cc2 = Privates.begin(); cc2!= Privates.end(); ++cc2 ) { - (*cc2)->WriteContent( fp, t, false); + (*cc2)->WriteContent( fp, t, false, true); } } diff --git a/src/gdcmDicomDirSerie.h b/src/gdcmDicomDirSerie.h index 199ae983..13065eb4 100644 --- a/src/gdcmDicomDirSerie.h +++ b/src/gdcmDicomDirSerie.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirSerie.h,v $ Language: C++ - Date: $Date: 2007/08/22 16:14:03 $ - Version: $Revision: 1.37 $ + Date: $Date: 2007/08/29 15:30:49 $ + Version: $Revision: 1.38 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -43,7 +43,8 @@ public: static DicomDirSerie *New(bool empty=false) {return new DicomDirSerie(empty);} void Print( std::ostream &os = std::cout, std::string const &indent = "" ); - void WriteContent( std::ofstream *fp, FileType t, bool insideMetaElements ); + void WriteContent( std::ofstream *fp, FileType t, bool insideMetaElements, + bool insideSequence ); // 'Image' methods DicomDirImage *NewImage(); diff --git a/src/gdcmDicomDirStudy.cxx b/src/gdcmDicomDirStudy.cxx index e7f5cef2..5c28eec9 100644 --- a/src/gdcmDicomDirStudy.cxx +++ b/src/gdcmDicomDirStudy.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirStudy.cxx,v $ Language: C++ - Date: $Date: 2007/07/26 08:36:49 $ - Version: $Revision: 1.44 $ + Date: $Date: 2007/08/29 15:30:49 $ + Version: $Revision: 1.45 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -58,22 +58,22 @@ DicomDirStudy::~DicomDirStudy() * @param t Type of the File (explicit VR, implicitVR, ...) * @return */ -void DicomDirStudy::WriteContent(std::ofstream *fp, FileType t, bool insideMetaElements) +void DicomDirStudy::WriteContent(std::ofstream *fp, FileType t, bool dummy, bool dummy2) { - DicomDirObject::WriteContent(fp, t, false); + DicomDirObject::WriteContent(fp, t, false, true); for(ListDicomDirSerie::iterator cc = Series.begin(); cc!= Series.end(); ++cc ) { - (*cc)->WriteContent( fp, t, false ); + (*cc)->WriteContent( fp, t, false, true ); } for(ListDicomDirVisit::iterator icc = Visits.begin(); icc!= Visits.end(); ++icc ) { - (*icc)->WriteContent( fp, t, false ); + (*icc)->WriteContent( fp, t, false, true ); } } diff --git a/src/gdcmDicomDirStudy.h b/src/gdcmDicomDirStudy.h index bdcdf624..4b4d12e6 100644 --- a/src/gdcmDicomDirStudy.h +++ b/src/gdcmDicomDirStudy.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirStudy.h,v $ Language: C++ - Date: $Date: 2007/08/22 16:14:03 $ - Version: $Revision: 1.36 $ + Date: $Date: 2007/08/29 15:30:49 $ + Version: $Revision: 1.37 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -49,7 +49,7 @@ public: static DicomDirStudy *New(bool empty=false) {return new DicomDirStudy(empty);} void Print(std::ostream &os = std::cout, std::string const &indent = "" ); - void WriteContent(std::ofstream *fp, FileType t, bool insideMetaElements); + void WriteContent(std::ofstream *fp, FileType t, bool insideMetaElements,bool insideSequence ); // 'Serie' methods DicomDirSerie *NewSerie(); diff --git a/src/gdcmDocEntry.cxx b/src/gdcmDocEntry.cxx index 4d7f80e7..8d5f308b 100644 --- a/src/gdcmDocEntry.cxx +++ b/src/gdcmDocEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocEntry.cxx,v $ Language: C++ - Date: $Date: 2007/08/28 09:29:26 $ - Version: $Revision: 1.92 $ + Date: $Date: 2007/08/29 15:30:49 $ + Version: $Revision: 1.93 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -71,7 +71,7 @@ DocEntry::~DocEntry() * @param fp already open ofstream pointer * @param filetype type of the file (ACR, ImplicitVR, ExplicitVR, JPEG, JPEG2000...) */ -void DocEntry::WriteContent(std::ofstream *fp, FileType filetype, bool insideMetaElements) +void DocEntry::WriteContent(std::ofstream *fp, FileType filetype, bool insideMetaElements, bool insideSequence) { uint32_t ffff = 0xffffffff; uint16_t group = GetGroup(); @@ -139,9 +139,10 @@ void DocEntry::WriteContent(std::ofstream *fp, FileType filetype, bool insideMet || (vr == "UN") || (vr == "UT") ) { binary_write(*fp, zero); - if ( (filetype == JPEG || filetype == JPEG2000) && group == 0x7fe0 && elem == 0x0010) - { - // gdcmAssertMacro( GetVR() == "OW" ); //?!? + + if ( (filetype == JPEG || filetype == JPEG2000) && group == 0x7fe0 && elem == 0x0010 && !insideSequence) + { + // Only the 'true' Pixel Element may be compressed (hope so!) binary_write(*fp, ffff); } else if (vr == "SQ") diff --git a/src/gdcmDocEntry.h b/src/gdcmDocEntry.h index 411fb108..d58b1c0b 100644 --- a/src/gdcmDocEntry.h +++ b/src/gdcmDocEntry.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocEntry.h,v $ Language: C++ - Date: $Date: 2007/08/22 16:14:04 $ - Version: $Revision: 1.69 $ + Date: $Date: 2007/08/29 15:30:49 $ + Version: $Revision: 1.70 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -42,7 +42,7 @@ class GDCM_EXPORT DocEntry : public RefCounter public: virtual void Print (std::ostream &os = std::cout, std::string const &indent = ""); virtual void WriteContent(std::ofstream *fp, FileType filetype, - bool insideMetaElements); + bool insideMetaElements, bool insideSequence); /// \brief Gets the DicEntry of the current Dicom entry /// @return The DicEntry of the current Dicom entry diff --git a/src/gdcmDocEntrySet.h b/src/gdcmDocEntrySet.h index 6f1930ce..5e82772c 100644 --- a/src/gdcmDocEntrySet.h +++ b/src/gdcmDocEntrySet.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocEntrySet.h,v $ Language: C++ - Date: $Date: 2007/08/22 16:14:04 $ - Version: $Revision: 1.71 $ + Date: $Date: 2007/08/29 15:30:49 $ + Version: $Revision: 1.72 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -65,7 +65,7 @@ class GDCM_EXPORT DocEntrySet : public RefCounter public: /// \brief write any type of entry to the entry set virtual void WriteContent (std::ofstream *fp, FileType filetype, - bool insideMetaElements) = 0; + bool insideMetaElements,bool insideSequence ) = 0; /// \brief Remove all Entry of the current set virtual void ClearEntry() = 0; diff --git a/src/gdcmDocument.cxx b/src/gdcmDocument.cxx index 3c63f3e8..72713e44 100644 --- a/src/gdcmDocument.cxx +++ b/src/gdcmDocument.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocument.cxx,v $ Language: C++ - Date: $Date: 2007/08/21 12:51:09 $ - Version: $Revision: 1.367 $ + Date: $Date: 2007/08/29 15:30:49 $ + Version: $Revision: 1.368 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -721,8 +721,10 @@ void Document::WriteContent(std::ofstream *fp, FileType filetype) * --> was too much tricky / we were [in a hurry / too lazy] * --> We don't write the element 0x0000 (group length) */ - - ElementSet::WriteContent(fp, filetype, false); // This one is recursive + // This one is recursive + // false : outside MetaElements + // false : outside Sequence + ElementSet::WriteContent(fp, filetype, false, false); } // ----------------------------------------- diff --git a/src/gdcmElementSet.cxx b/src/gdcmElementSet.cxx index a38db035..c476b0a5 100644 --- a/src/gdcmElementSet.cxx +++ b/src/gdcmElementSet.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmElementSet.cxx,v $ Language: C++ - Date: $Date: 2007/07/26 08:36:49 $ - Version: $Revision: 1.77 $ + Date: $Date: 2007/08/29 15:30:49 $ + Version: $Revision: 1.78 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -49,10 +49,11 @@ ElementSet::~ElementSet() * @param fp ofstream to write to * @param filetype ExplicitVR/ImplicitVR/ACR/ACR_LIBIDO/JPEG/JPEG2000/... */ -void ElementSet::WriteContent(std::ofstream *fp, FileType filetype, bool dummy) +void ElementSet::WriteContent(std::ofstream *fp, FileType filetype, bool dummy, bool dummy2) { bool insideMetaElements = false; bool yetOutsideMetaElements = false; + int countSQ =0; for (TagDocEntryHT::const_iterator i = TagHT.begin(); i != TagHT.end(); @@ -87,9 +88,10 @@ void ElementSet::WriteContent(std::ofstream *fp, FileType filetype, bool dummy) ( (i->second)->GetGroup() == 0x0002 ||( (filetype == ACR || filetype == ACR_LIBIDO ) && (i->second)->GetGroup() == 0x0008 ) ) ) - { + { // There are DocEntries, written recursively - i->second->WriteContent(fp, filetype, insideMetaElements ); + // false : we are outside any Sequence + i->second->WriteContent(fp, filetype, insideMetaElements, false ); } } } diff --git a/src/gdcmElementSet.h b/src/gdcmElementSet.h index 95550eaa..332ca84b 100644 --- a/src/gdcmElementSet.h +++ b/src/gdcmElementSet.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmElementSet.h,v $ Language: C++ - Date: $Date: 2007/08/22 16:14:04 $ - Version: $Revision: 1.57 $ + Date: $Date: 2007/08/29 15:30:49 $ + Version: $Revision: 1.58 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -46,7 +46,7 @@ public: std::string const &indent = "" ); void WriteContent(std::ofstream *fp, FileType filetype, - bool insideMetaElements); + bool insideMetaElements, bool insideSequence); bool AddEntry(DocEntry *Entry); bool RemoveEntry(DocEntry *EntryToRemove); diff --git a/src/gdcmSQItem.cxx b/src/gdcmSQItem.cxx index c93e630c..8a796aac 100644 --- a/src/gdcmSQItem.cxx +++ b/src/gdcmSQItem.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSQItem.cxx,v $ Language: C++ - Date: $Date: 2007/07/26 08:36:49 $ - Version: $Revision: 1.86 $ + Date: $Date: 2007/08/29 15:30:49 $ + Version: $Revision: 1.87 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -55,7 +55,7 @@ SQItem::~SQItem() * @param filetype type of the file (ACR, ImplicitVR, ExplicitVR, ...) */ void SQItem::WriteContent(std::ofstream *fp, FileType filetype, - bool insideMetaElements) + bool insideMetaElements, bool dummy2) { int j; uint16_t item[4] = { 0xfffe, 0xe000, 0xffff, 0xffff }; @@ -89,7 +89,8 @@ void SQItem::WriteContent(std::ofstream *fp, FileType filetype, // contains 'impossible tag' fffe|0000 in last position ! } // false : we are not in MetaElements - (*it)->WriteContent(fp, filetype, false); + // true : we are inside a Sequence + (*it)->WriteContent(fp, filetype, false, true); } //we force the writting of an 'Item Delimitation' item diff --git a/src/gdcmSQItem.h b/src/gdcmSQItem.h index ba147753..e45c2529 100644 --- a/src/gdcmSQItem.h +++ b/src/gdcmSQItem.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSQItem.h,v $ Language: C++ - Date: $Date: 2007/08/22 16:14:04 $ - Version: $Revision: 1.54 $ + Date: $Date: 2007/08/29 15:30:50 $ + Version: $Revision: 1.55 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -47,7 +47,8 @@ public: virtual void Print(std::ostream &os = std::cout, std::string const &indent = "" ); - void WriteContent(std::ofstream *fp, FileType filetype, bool insideMetaElements); + void WriteContent(std::ofstream *fp, FileType filetype, + bool insideMetaElements, bool insideSequence); uint32_t ComputeFullLength(); bool AddEntry(DocEntry *Entry); // add to the List diff --git a/src/gdcmSeqEntry.cxx b/src/gdcmSeqEntry.cxx index 0e18e40c..4957fe94 100644 --- a/src/gdcmSeqEntry.cxx +++ b/src/gdcmSeqEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSeqEntry.cxx,v $ Language: C++ - Date: $Date: 2007/07/26 08:36:49 $ - Version: $Revision: 1.69 $ + Date: $Date: 2007/08/29 15:30:50 $ + Version: $Revision: 1.70 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -80,7 +80,7 @@ SeqEntry::~SeqEntry() * @param fp pointer to an already open file * @param filetype type of the file (ACR, ImplicitVR, ExplicitVR, ...) */ -void SeqEntry::WriteContent(std::ofstream *fp, FileType filetype, bool dummy) +void SeqEntry::WriteContent(std::ofstream *fp, FileType filetype, bool dummy, bool dummy2) { uint16_t seq_term_gr = 0xfffe; uint16_t seq_term_el = 0xe0dd; @@ -90,12 +90,13 @@ void SeqEntry::WriteContent(std::ofstream *fp, FileType filetype, bool dummy) if ( GetReadLength() == 0 ) return; // false : we are not in MetaElements - DocEntry::WriteContent(fp, filetype, false); + // true : we are inside a Sequence + DocEntry::WriteContent(fp, filetype, false, true); for(ListSQItem::iterator cc = Items.begin(); cc != Items.end(); ++cc) { - (*cc)->WriteContent(fp, filetype, false); + (*cc)->WriteContent(fp, filetype, false, true); } // we force the writting of a Sequence Delimitation item diff --git a/src/gdcmSeqEntry.h b/src/gdcmSeqEntry.h index a0c167eb..e29f3fef 100644 --- a/src/gdcmSeqEntry.h +++ b/src/gdcmSeqEntry.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSeqEntry.h,v $ Language: C++ - Date: $Date: 2007/08/22 16:14:04 $ - Version: $Revision: 1.45 $ + Date: $Date: 2007/08/29 15:30:50 $ + 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 @@ -51,7 +51,8 @@ public: {return new SeqEntry(group,elem);} void Print(std::ostream &os = std::cout, std::string const &indent = "" ); - void WriteContent(std::ofstream *fp, FileType filetype, bool insideMetaElements); + void WriteContent(std::ofstream *fp, FileType filetype, + bool insideMetaElements, bool insideSequence); uint32_t ComputeFullLength(); void AddSQItem(SQItem *it, int itemNumber); -- 2.45.1