Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

gdcmDicomDirStudy.cxx

Go to the documentation of this file.
00001 /*=========================================================================
00002                                                                                 
00003   Program:   gdcm
00004   Module:    $RCSfile: gdcmDicomDirStudy.cxx,v $
00005   Language:  C++
00006   Date:      $Date: 2005/02/02 10:02:16 $
00007   Version:   $Revision: 1.36 $
00008                                                                                 
00009   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
00010   l'Image). All rights reserved. See Doc/License.txt or
00011   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
00012                                                                                 
00013      This software is distributed WITHOUT ANY WARRANTY; without even
00014      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00015      PURPOSE.  See the above copyright notices for more information.
00016                                                                                 
00017 =========================================================================*/
00018 
00019 #include "gdcmDicomDirStudy.h"
00020 #include "gdcmDicomDirElement.h"
00021 #include "gdcmGlobal.h"
00022 #include "gdcmDicomDirSerie.h"
00023 #include "gdcmDebug.h"
00024 
00025 namespace gdcm 
00026 {
00027 //-----------------------------------------------------------------------------
00028 // Constructor / Destructor
00033 DicomDirStudy::DicomDirStudy(bool empty)
00034               :DicomDirObject()
00035 {
00036    if( !empty )
00037    {
00038       ListDicomDirStudyElem const &elemList = 
00039          Global::GetDicomDirElements()->GetDicomDirStudyElements();
00040       FillObject(elemList);
00041    }
00042 }
00043 
00047 DicomDirStudy::~DicomDirStudy() 
00048 {
00049    ClearSerie();
00050 }
00051 
00052 //-----------------------------------------------------------------------------
00053 // Public
00060 void DicomDirStudy::WriteContent(std::ofstream *fp, FileType t)
00061 {
00062    DicomDirObject::WriteContent(fp, t);
00063 
00064    for(ListDicomDirSerie::iterator cc = Series.begin();
00065                                    cc!= Series.end();
00066                                  ++cc )
00067    {
00068       (*cc)->WriteContent( fp, t );
00069    }
00070 }
00071 
00076 DicomDirSerie *DicomDirStudy::NewSerie()
00077 {
00078    DicomDirSerie *st = new DicomDirSerie();
00079    Series.push_back(st);
00080    return st;
00081 } 
00082 
00086 void DicomDirStudy::ClearSerie()
00087 {
00088    for(ListDicomDirSerie::iterator cc = Series.begin();
00089                                    cc != Series.end();
00090                                  ++cc )
00091    {
00092       delete *cc;
00093    }
00094    Series.clear();
00095 }
00096 
00101 DicomDirSerie *DicomDirStudy::GetFirstSerie()
00102 {
00103    ItSerie = Series.begin();
00104    if (ItSerie != Series.end())
00105       return *ItSerie;
00106    return NULL;
00107 }
00108 
00114 DicomDirSerie *DicomDirStudy::GetNextSerie()
00115 {
00116    gdcmAssertMacro (ItSerie != Series.end());
00117 
00118    ++ItSerie;
00119    if (ItSerie != Series.end())
00120       return *ItSerie;
00121    return NULL;
00122 }  
00123 
00128 DicomDirSerie *DicomDirStudy::GetLastSerie()
00129 {
00130    ItSerie = Series.end();
00131    if (ItSerie != Series.begin())
00132    {
00133      --ItSerie;
00134       return *ItSerie;
00135    }
00136    return NULL;
00137 }
00138 
00139 //-----------------------------------------------------------------------------
00140 // Protected
00141 
00142 //-----------------------------------------------------------------------------
00143 // Private
00144 
00145 //-----------------------------------------------------------------------------
00146 // Print
00153 void DicomDirStudy::Print(std::ostream &os, std::string const & )
00154 {
00155    os << "STUDY" << std::endl;
00156    DicomDirObject::Print(os);
00157 
00158    for(ListDicomDirSerie::iterator cc = Series.begin();
00159                                    cc != Series.end();
00160                                    ++cc)
00161    {
00162       (*cc)->SetPrintLevel(PrintLevel);
00163       (*cc)->Print(os);
00164    }
00165 }
00166 
00167 //-----------------------------------------------------------------------------
00168 } // end namespace gdcm

Generated on Thu Feb 10 22:17:57 2005 for gdcm by doxygen 1.3.6