X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDicomDirSerie.cxx;h=99a96c2d61c0709d8ce4a70fad784b62cdadf3b8;hb=b06cbd9177331d793223eac6bf8b2bccf874e7e3;hp=090dac646c530056d5274e317a7289760e887254;hpb=6b51b22366f878e1050c75a6ebb755bd2ff365c7;p=gdcm.git diff --git a/src/gdcmDicomDirSerie.cxx b/src/gdcmDicomDirSerie.cxx index 090dac64..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: 2005/10/25 14:52:33 $ - Version: $Revision: 1.39 $ + 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 @@ -19,10 +19,11 @@ #include "gdcmDicomDirSerie.h" #include "gdcmDicomDirElement.h" #include "gdcmDicomDirImage.h" +#include "gdcmDicomDirPrivate.h" #include "gdcmGlobal.h" #include "gdcmDebug.h" -namespace gdcm +namespace GDCM_NAME_SPACE { //----------------------------------------------------------------------------- // Constructor / Destructor @@ -47,6 +48,7 @@ DicomDirSerie::DicomDirSerie(bool empty): DicomDirSerie::~DicomDirSerie() { ClearImage(); + ClearPrivate(); // For SIEMENS 'CSA non image' } //----------------------------------------------------------------------------- @@ -56,16 +58,22 @@ 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) +void DicomDirSerie::WriteContent(std::ofstream *fp, FileType t, bool dummy, bool dummy2) { - DicomDirObject::WriteContent(fp, t); + DicomDirObject::WriteContent(fp, t, false, true); for(ListDicomDirImage::iterator cc = Images.begin(); cc!= Images.end(); ++cc ) { - (*cc)->WriteContent( fp, t ); - } + (*cc)->WriteContent( fp, t, false, true ); + } + for(ListDicomDirPrivate::iterator cc2 = Privates.begin(); + cc2!= Privates.end(); + ++cc2 ) + { + (*cc2)->WriteContent( fp, t, false, true); + } } /** @@ -80,13 +88,39 @@ DicomDirImage *DicomDirSerie::NewImage() } /** - * \brief Remove all images in the serie + * \brief adds a new Private (with the basic elements) to a partially created + * DICOMDIR + */ + +DicomDirPrivate *DicomDirSerie::NewPrivate() +{ + DicomDirPrivate *dd = DicomDirPrivate::New(); + Privates.push_back(dd); + return dd; +} + +/** + * \brief Remove all 'Privates' in the serie + */ +void DicomDirSerie::ClearPrivate() +{ + for(ListDicomDirPrivate::iterator cc = Privates.begin(); + cc!= Privates.end(); + ++cc) + { + (*cc)->Delete(); + } + Privates.clear(); +} + +/** + * \brief Remove all 'Images' in the serie */ void DicomDirSerie::ClearImage() { for(ListDicomDirImage::iterator cc = Images.begin(); - cc != Images.end(); - ++cc) + cc!= Images.end(); + ++cc) { (*cc)->Delete(); } @@ -107,7 +141,7 @@ DicomDirImage *DicomDirSerie::GetFirstImage() /** * \brief Get the next entry while visiting the DicomDirImages - * \note : meaningfull only if GetFirstEntry already called + * \note : meaningfull only if GetFirstImage already called * \return The next DicomDirImages if found, otherwhise NULL */ DicomDirImage *DicomDirSerie::GetNextImage() @@ -120,6 +154,59 @@ DicomDirImage *DicomDirSerie::GetNextImage() return NULL; } +/** + * \brief Get the first entry while visiting the DicomDirPrivate + * \return The first DicomDirPrivate if DicomDirserie not empty, otherwhise NULL + */ +DicomDirPrivate *DicomDirSerie::GetFirstPrivate() +{ + ItPrivate = Privates.begin(); + if (ItPrivate != Privates.end()) + return *ItPrivate; + return NULL; +} + +/** + * \brief Get the next entry while visiting the DicomDirPrivates + * \note : meaningfull only if GetFirstPrivate already called + * \return The next DicomDirPrivates if found, otherwhise NULL + */ +DicomDirPrivate *DicomDirSerie::GetNextPrivate() +{ + gdcmAssertMacro (ItPrivate != Privates.end()); + + ++ItPrivate; + if (ItPrivate != Privates.end()) + return *ItPrivate; + return NULL; +} + +/** + * \brief Copies all the attributes from an other DocEntrySet + * @param set entry to copy from + * @remarks The contained DocEntries a not copied, only referenced + */ +void DicomDirSerie::Copy(DocEntrySet *set) +{ + // Remove all previous childs + ClearImage(); + ClearPrivate(); + + DicomDirObject::Copy(set); + + DicomDirSerie *ddEntry = dynamic_cast(set); + if( ddEntry ) + { + Images = ddEntry->Images; + for(ItImage = Images.begin();ItImage != Images.end();++ItImage) + (*ItImage)->Register(); + + Privates = ddEntry->Privates; + for(ItPrivate = Privates.begin();ItPrivate != Privates.end();++ItPrivate) + (*ItPrivate)->Register(); + } +} + //----------------------------------------------------------------------------- // Protected @@ -145,6 +232,15 @@ void DicomDirSerie::Print(std::ostream &os, std::string const &) (*cc)->SetPrintLevel(PrintLevel); (*cc)->Print(os); } + + for(ListDicomDirPrivate::iterator cc2 = Privates.begin(); + cc2 != Privates.end(); + ++cc2) + { + (*cc2)->SetPrintLevel(PrintLevel); + (*cc2)->Print(os); + } + } //-----------------------------------------------------------------------------