From 7f5f66f57c85e30920d807612d32a65800cb1df0 Mon Sep 17 00:00:00 2001 From: regrain Date: Mon, 6 Dec 2004 11:37:36 +0000 Subject: [PATCH] * Example/Volume2Dicom.cxx : comment unused variables * Test/PrintDicomDir.cxx : comment unused variables * Test/BuildUpDicomDir.cxx : remove dbg.Verbose. Remove the FIXME. * src/SQItem.[h|cxx] : remove the PtagHT variable. Remove the AddDocEntry method that is redondant with AddEntry. * src/gdcmDocEntrySet.h : add pure virtual methods common to ElementSet and SQItem -- BeNours --- ChangeLog | 9 +++++++ Example/Volume2Dicom.cxx | 8 +++--- src/gdcmDicomDir.cxx | 8 +++--- src/gdcmDicomDirMeta.cxx | 13 +++++----- src/gdcmDicomDirObject.cxx | 6 ++--- src/gdcmDocEntrySet.h | 8 +++--- src/gdcmDocument.cxx | 5 ++-- src/gdcmSQItem.cxx | 53 +++++++++++++------------------------- src/gdcmSQItem.h | 10 +++---- 9 files changed, 55 insertions(+), 65 deletions(-) diff --git a/ChangeLog b/ChangeLog index fd48dd6d..85b2c664 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-12-06 Benoit Regrain + * Example/Volume2Dicom.cxx : comment unused variables + * Test/PrintDicomDir.cxx : comment unused variables + * Test/BuildUpDicomDir.cxx : remove dbg.Verbose. Remove the FIXME. + * src/SQItem.[h|cxx] : remove the PtagHT variable. Remove the AddDocEntry + method that is redondant with AddEntry. + * src/gdcmDocEntrySet.h : add pure virtual methods common to ElementSet and + SQItem + 2004-12-04 Benoit Regrain * Bug fix due my last commit (compilation under Windows). * Example/Volume2Dicom : bug fix in the file and reformatting source code diff --git a/Example/Volume2Dicom.cxx b/Example/Volume2Dicom.cxx index 05eeeb84..96010e81 100644 --- a/Example/Volume2Dicom.cxx +++ b/Example/Volume2Dicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: Volume2Dicom.cxx,v $ Language: C++ - Date: $Date: 2004/12/04 08:57:19 $ - Version: $Revision: 1.2 $ + Date: $Date: 2004/12/06 11:37:37 $ + Version: $Revision: 1.3 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -87,8 +87,8 @@ int main( int argc, char * argv[] ) if (val < min) min = val; } - float wcenter = (max+min) / 2.; - float wwidth = (max-min)>0 ? (max-min) : 1.; + //float wcenter = (max+min) / 2.; + //float wwidth = (max-min)>0 ? (max-min) : 1.; //////////////////////////////////////////////////////////// // Get file date and time // diff --git a/src/gdcmDicomDir.cxx b/src/gdcmDicomDir.cxx index 6716aec7..1f668e97 100644 --- a/src/gdcmDicomDir.cxx +++ b/src/gdcmDicomDir.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDir.cxx,v $ Language: C++ - Date: $Date: 2004/12/04 08:57:20 $ - Version: $Revision: 1.86 $ + Date: $Date: 2004/12/06 11:37:38 $ + 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 @@ -482,7 +482,7 @@ DicomDirMeta * DicomDir::NewMeta() cc != lastOneButSequence; ++cc) { - m->AddDocEntry( cc->second ); + m->AddEntry( cc->second ); } } else // after root directory parsing @@ -541,7 +541,7 @@ DicomDirPatient * DicomDir::NewPatient() { entry->SetLength( entry->GetValue().length() ); } - p->AddDocEntry( entry ); + p->AddEntry( entry ); } Patients.push_front( p ); diff --git a/src/gdcmDicomDirMeta.cxx b/src/gdcmDicomDirMeta.cxx index cadbc216..3942ee83 100644 --- a/src/gdcmDicomDirMeta.cxx +++ b/src/gdcmDicomDirMeta.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirMeta.cxx,v $ Language: C++ - Date: $Date: 2004/12/03 20:16:57 $ - Version: $Revision: 1.17 $ + Date: $Date: 2004/12/06 11:37:38 $ + Version: $Revision: 1.18 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -33,7 +33,6 @@ namespace gdcm DicomDirMeta::DicomDirMeta(): DicomDirObject() { - } /** @@ -42,7 +41,6 @@ DicomDirMeta::DicomDirMeta(): */ DicomDirMeta::~DicomDirMeta() { - } //----------------------------------------------------------------------------- @@ -54,10 +52,13 @@ void DicomDirMeta::Print(std::ostream& os) { os << "META" << std::endl; // warning : META doesn't behave exactly like a Objet - for (ListDocEntry::iterator i = DocEntries.begin(); + for (ListDocEntry::iterator i = DocEntries.begin(); i != DocEntries.end(); ++i) - (*i)->Print(); + { + (*i)->Print(); + os << std::endl; + } } diff --git a/src/gdcmDicomDirObject.cxx b/src/gdcmDicomDirObject.cxx index 245f9901..11dfd84c 100644 --- a/src/gdcmDicomDirObject.cxx +++ b/src/gdcmDicomDirObject.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirObject.cxx,v $ Language: C++ - Date: $Date: 2004/12/03 20:16:57 $ - Version: $Revision: 1.9 $ + Date: $Date: 2004/12/06 11:37:38 $ + Version: $Revision: 1.10 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -121,7 +121,7 @@ void DicomDirObject::FillObject(ListDicomDirMetaElem const & elemList) { entry->SetLength(entry->GetValue().length()); } - AddDocEntry(entry); + AddEntry(entry); } } } // end namespace gdcm diff --git a/src/gdcmDocEntrySet.h b/src/gdcmDocEntrySet.h index b1465abb..cdca610c 100644 --- a/src/gdcmDocEntrySet.h +++ b/src/gdcmDocEntrySet.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocEntrySet.h,v $ Language: C++ - Date: $Date: 2004/12/03 20:43:37 $ - Version: $Revision: 1.26 $ + Date: $Date: 2004/12/06 11:37:38 $ + Version: $Revision: 1.27 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -63,7 +63,9 @@ public: /// \brief adds any type of entry to the entry set (pure vitual) virtual bool AddEntry(DocEntry *Entry) = 0; // pure virtual - + virtual bool RemoveEntry(DocEntry *EntryToRemove)=0; // pure virtual + virtual bool RemoveEntryNoDestroy(DocEntry *EntryToRemove)=0; // pure virtual + /// \brief prints any type of entry to the entry set (pure vitual) virtual void Print (std::ostream & os = std::cout) = 0;// pure virtual diff --git a/src/gdcmDocument.cxx b/src/gdcmDocument.cxx index 0570d454..2a91d1c2 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/12/03 20:16:58 $ - Version: $Revision: 1.146 $ + Date: $Date: 2004/12/06 11:37:38 $ + Version: $Revision: 1.147 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -925,7 +925,6 @@ bool Document::SetEntryByNumber(std::string const& content, valEntry->SetValue(finalContent); // Integers have a special treatement for their length: - l = finalContent.length(); if ( l != 0) // To avoid to be cheated by 'zero length' integers { diff --git a/src/gdcmSQItem.cxx b/src/gdcmSQItem.cxx index a9c1ed5e..13af2367 100644 --- a/src/gdcmSQItem.cxx +++ b/src/gdcmSQItem.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSQItem.cxx,v $ Language: C++ - Date: $Date: 2004/12/03 20:16:58 $ - Version: $Revision: 1.40 $ + Date: $Date: 2004/12/06 11:37:38 $ + Version: $Revision: 1.41 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -60,9 +60,8 @@ SQItem::~SQItem() /* * \brief canonical Printer */ - void SQItem::Print(std::ostream& os) - { - os << "S "; +void SQItem::Print(std::ostream& os) +{ std::ostringstream s; if (SQDepthLevel > 0) @@ -180,7 +179,7 @@ bool SQItem::SetEntryByNumber(std::string const & val, uint16_t group, continue; } - if ( ( group < (*i)->GetGroup() ) + if ( ( group < (*i)->GetGroup() ) ||( group == (*i)->GetGroup() && element < (*i)->GetElement()) ) { // instead of ReplaceOrCreateByNumber @@ -188,36 +187,20 @@ bool SQItem::SetEntryByNumber(std::string const & val, uint16_t group, ValEntry* entry = 0; TagKey key = DictEntry::TranslateToKey(group, element); - if ( ! PtagHT->count(key)) - { - // we assume a Public Dictionnary *is* loaded - Dict *pubDict = Global::GetDicts()->GetDefaultPubDict(); - // if the invoked (group,elem) doesn't exist inside the Dictionary - // we create a VirtualDictEntry - DictEntry *dictEntry = pubDict->GetDictEntryByNumber(group, element); - if (dictEntry == NULL) - { - dictEntry = - Global::GetDicts()->NewVirtualDictEntry(group, element, - "UN", "??", "??"); - } - // we assume the constructor didn't fail - entry = new ValEntry(dictEntry); - /// \todo - /// ---- - /// better we don't assume too much ! - /// SQItem is now used to describe any DICOMDIR related object - } - else + // we assume a Public Dictionnary *is* loaded + Dict *pubDict = Global::GetDicts()->GetDefaultPubDict(); + // if the invoked (group,elem) doesn't exist inside the Dictionary + // we create a VirtualDictEntry + DictEntry *dictEntry = pubDict->GetDictEntryByNumber(group, element); + if (dictEntry == NULL) { - DocEntry* foundEntry = PtagHT->find(key)->second; - entry = dynamic_cast(foundEntry); - if (!entry) - { - dbg.Verbose(0, "SQItem::SetEntryByNumber: docEntries" - " contains non ValEntry occurences"); - } - } + dictEntry = + Global::GetDicts()->NewVirtualDictEntry(group, element, + "UN", "??", "??"); + } + // we assume the constructor didn't fail + entry = new ValEntry(dictEntry); + if (entry) { entry->SetValue(val); diff --git a/src/gdcmSQItem.h b/src/gdcmSQItem.h index e1ba7a52..ea771ed2 100644 --- a/src/gdcmSQItem.h +++ b/src/gdcmSQItem.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSQItem.h,v $ Language: C++ - Date: $Date: 2004/12/03 17:13:18 $ - Version: $Revision: 1.25 $ + Date: $Date: 2004/12/06 11:37:38 $ + Version: $Revision: 1.26 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -45,8 +45,6 @@ public: /// \brief adds the passed DocEntry to the DocEntry chained List for /// this SQ Item. - void AddDocEntry(DocEntry *e) { DocEntries.push_back(e); }; - bool AddEntry(DocEntry *Entry); // add to the List bool RemoveEntry(DocEntry *EntryToRemove); bool RemoveEntryNoDestroy(DocEntry *EntryToRemove); @@ -91,7 +89,7 @@ protected: ///\brief pointer to the HTable of the Document, /// (because we don't know it within any DicomDirObject nor any SQItem) - TagDocEntryHT *PtagHT; + // TagDocEntryHT *PtagHT; private: @@ -106,10 +104,8 @@ private: /// with this BaseTagKey. BaseTagKey BaseTagKeyNested; - /// \brief SQ Item ordinal number int SQItemNumber; - }; } // end namespace gdcm //----------------------------------------------------------------------------- -- 2.48.1