From 80c92fa39ae3f5a69f1a56f2ae6052802373b610 Mon Sep 17 00:00:00 2001 From: jpr Date: Tue, 12 Jul 2005 17:08:12 +0000 Subject: [PATCH] To speed up DicomDir, instead of copying -and removing the source afterwards- each entry of the SQItem (found after gdcm::Document parsing) towards the gdcm::Object belonging to the gdcm::DicomDir, we just copy the chained list itself. --- src/gdcmCommon.h | 6 +++--- src/gdcmDicomDir.cxx | 11 ++++++---- src/gdcmDicomDirElement.h | 44 +++++++++++++++++++------------------- src/gdcmDicomDirObject.cxx | 8 +++---- src/gdcmDicomDirObject.h | 5 +++-- src/gdcmDirList.h | 6 +++--- src/gdcmSQItem.cxx | 22 +++++++++++++++++-- src/gdcmSQItem.h | 6 ++++-- 8 files changed, 66 insertions(+), 42 deletions(-) diff --git a/src/gdcmCommon.h b/src/gdcmCommon.h index f4889a5d..4701be49 100644 --- a/src/gdcmCommon.h +++ b/src/gdcmCommon.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmCommon.h,v $ Language: C++ - Date: $Date: 2005/07/11 19:46:05 $ - Version: $Revision: 1.78 $ + Date: $Date: 2005/07/12 17:08:12 $ + Version: $Revision: 1.79 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -85,7 +85,7 @@ typedef unsigned int uint32_t; #endif #include -#define FASTTAGKEY 0 +#define FASTTAGKEY 1 // FIXME: Should rewrite this: #if FASTTAGKEY diff --git a/src/gdcmDicomDir.cxx b/src/gdcmDicomDir.cxx index 473a08b4..de32b953 100644 --- a/src/gdcmDicomDir.cxx +++ b/src/gdcmDicomDir.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDir.cxx,v $ Language: C++ - Date: $Date: 2005/07/12 14:58:26 $ - Version: $Revision: 1.147 $ + Date: $Date: 2005/07/12 17:08:12 $ + Version: $Revision: 1.148 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -21,6 +21,7 @@ // PS 3.3-2003, pages 731-750 //----------------------------------------------------------------------------- #include "gdcmDicomDir.h" +#include "gdcmDicomDirObject.h" #include "gdcmDicomDirStudy.h" #include "gdcmDicomDirSerie.h" #include "gdcmDicomDirVisit.h" @@ -817,7 +818,9 @@ void DicomDir::CreateDicomDir() continue; } if ( si ) - MoveSQItem(si,tmpSI); + //MoveSQItem(si,tmpSI); // Old code : Copies each Entry + // -and then removes the source- + si->MoveObject(tmpSI); // New code : Copies the List tmpSI=s->GetNextSQItem(); } @@ -1131,7 +1134,7 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type, * @param src source SQItem */ void DicomDir::MoveSQItem(DocEntrySet *dst,DocEntrySet *src) -{ +{ DocEntry *entry; entry = src->GetFirstEntry(); diff --git a/src/gdcmDicomDirElement.h b/src/gdcmDicomDirElement.h index 0da4be80..c9c5148c 100644 --- a/src/gdcmDicomDirElement.h +++ b/src/gdcmDicomDirElement.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirElement.h,v $ Language: C++ - Date: $Date: 2005/07/08 19:07:12 $ - Version: $Revision: 1.29 $ + Date: $Date: 2005/07/12 17:08:12 $ + Version: $Revision: 1.30 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -32,32 +32,32 @@ typedef std::list ListDicomDirElem; typedef std::list ListDicomDirMetaElem; typedef std::list ListDicomDirPatientElem; typedef std::list ListDicomDirStudyElem; +typedef std::list ListDicomDirVisitElem; typedef std::list ListDicomDirSerieElem; typedef std::list ListDicomDirImageElem; // For future use (Full DICOMDIR) -typedef std::list ListDicomDirVisitElem; /* -typedef std::list ListDicomDirResult; -typedef std::list ListDicomDirStudyComponent; - -typedef std::list ListDicomDirOverlay; -typedef std::list ListDicomDirModalityLut; -typedef std::list ListDicomDirModalityLut; -typedef std::list ListDicomDirCurve; -typedef std::list ListDicomDirStoredPrint; -typedef std::list ListDicomDirRtDose; -typedef std::list ListDicomDirRtStructureSet; -typedef std::list ListDicomDirRtPlan; -typedef std::list ListDicomDirRtTreatRecord; -typedef std::list ListDicomDirPresentation; -typedef std::list ListDicomDirSrDocument; -typedef std::list ListDicomDirKeyObjectDoc; -typedef std::list ListDicomDirSpectroscopy; -typedef std::list ListDicomDirRawData; -typedef std::list ListDicomDirRegistration; -typedef std::list ListDicomDirFiducial; +typedef std::list ListDicomDirResultElem; +typedef std::list ListDicomDirStudyComponentElem; + +typedef std::list ListDicomDirOverlayElem; +typedef std::list ListDicomDirModalityLutElem; +typedef std::list ListDicomDirModalityLutElem; +typedef std::list ListDicomDirCurveElem; +typedef std::list ListDicomDirStoredPrintElem; +typedef std::list ListDicomDirRtDoseElem; +typedef std::list ListDicomDirRtStructureSetElem; +typedef std::list ListDicomDirRtPlanElem; +typedef std::list ListDicomDirRtTreatRecordElem; +typedef std::list ListDicomDirPresentationElem; +typedef std::list ListDicomDirSrDocumentElem; +typedef std::list ListDicomDirKeyObjectDocElem; +typedef std::list ListDicomDirSpectroscopyElem; +typedef std::list ListDicomDirRawDataElem; +typedef std::list ListDicomDirRegistrationElem; +typedef std::list ListDicomDirFiducialElem; */ //----------------------------------------------------------------------------- diff --git a/src/gdcmDicomDirObject.cxx b/src/gdcmDicomDirObject.cxx index e81d6b77..84a53876 100644 --- a/src/gdcmDicomDirObject.cxx +++ b/src/gdcmDicomDirObject.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirObject.cxx,v $ Language: C++ - Date: $Date: 2005/02/01 10:29:55 $ - Version: $Revision: 1.19 $ + Date: $Date: 2005/07/12 17:08:12 $ + 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 @@ -55,7 +55,7 @@ DicomDirObject::~DicomDirObject() */ void DicomDirObject::FillObject(ListDicomDirMetaElem const &elemList) { - // FillObject fills up the SQItem that will be conneected to the right place + // FillObject fills up the SQItem that will be connected to the right place ListDicomDirMetaElem::const_iterator it; uint16_t tmpGr,tmpEl; DictEntry *dictEntry; @@ -73,7 +73,7 @@ void DicomDirObject::FillObject(ListDicomDirMetaElem const &elemList) AddEntry(entry); } -} +} //----------------------------------------------------------------------------- // Private diff --git a/src/gdcmDicomDirObject.h b/src/gdcmDicomDirObject.h index b2eb7f01..5e6dc853 100644 --- a/src/gdcmDicomDirObject.h +++ b/src/gdcmDicomDirObject.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirObject.h,v $ Language: C++ - Date: $Date: 2005/02/07 14:48:34 $ - Version: $Revision: 1.16 $ + Date: $Date: 2005/07/12 17:08:12 $ + Version: $Revision: 1.17 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -48,6 +48,7 @@ protected: ~DicomDirObject(); void FillObject(ListDicomDirMetaElem const &elemList); + }; } // end namespace gdcm diff --git a/src/gdcmDirList.h b/src/gdcmDirList.h index 99ea714a..74a220a1 100644 --- a/src/gdcmDirList.h +++ b/src/gdcmDirList.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDirList.h,v $ Language: C++ - Date: $Date: 2005/02/02 15:07:41 $ - Version: $Revision: 1.23 $ + Date: $Date: 2005/07/12 17:08:12 $ + 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 @@ -32,7 +32,7 @@ typedef std::vector DirListType; //----------------------------------------------------------------------------- -// NOTE: Due to a VC6 'feature' we can not export a std::list in a dll, +// NOTE: Due to a VC6 'feature' we cannot export a std::list in a dll, // so GDCM_EXPORT keyword was removed for this class only /** diff --git a/src/gdcmSQItem.cxx b/src/gdcmSQItem.cxx index c0d3b27d..fe331d2b 100644 --- a/src/gdcmSQItem.cxx +++ b/src/gdcmSQItem.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSQItem.cxx,v $ Language: C++ - Date: $Date: 2005/07/06 08:43:18 $ - Version: $Revision: 1.73 $ + Date: $Date: 2005/07/12 17:08:12 $ + Version: $Revision: 1.74 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -198,6 +198,24 @@ void SQItem::ClearEntry() DocEntries.clear(); } +/** + * \brief Clear the std::list from given Sequence Item BUT keep the entries + */ +void SQItem::ClearEntryNoDestroy() +{ + DocEntries.clear(); +} + + +/** + * \brief Move all the entries from a given Sequence Item + */ +void SQItem::MoveObject(SQItem *source) +{ + DocEntries = source->DocEntries; + source->ClearEntryNoDestroy(); +} + /** * \brief Get the first Dicom entry while visiting the SQItem * \return The first DocEntry if found, otherwhise 0 diff --git a/src/gdcmSQItem.h b/src/gdcmSQItem.h index 4874a218..ba42f1c0 100644 --- a/src/gdcmSQItem.h +++ b/src/gdcmSQItem.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSQItem.h,v $ Language: C++ - Date: $Date: 2005/07/07 13:55:39 $ - Version: $Revision: 1.42 $ + Date: $Date: 2005/07/12 17:08:12 $ + 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 @@ -51,6 +51,8 @@ public: bool RemoveEntry(DocEntry *EntryToRemove); bool RemoveEntryNoDestroy(DocEntry *EntryToRemove); void ClearEntry(); + void ClearEntryNoDestroy(); + void MoveObject(SQItem *source); DocEntry *GetFirstEntry(); DocEntry *GetNextEntry(); -- 2.48.1