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

gdcmDicomDirSerie.cxx

Go to the documentation of this file.
00001 /*=========================================================================
00002                                                                                 
00003   Program:   gdcm
00004   Module:    $RCSfile: gdcmDicomDirSerie.cxx,v $
00005   Language:  C++
00006   Date:      $Date: 2005/02/01 10:29:55 $
00007   Version:   $Revision: 1.37 $
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 "gdcmDicomDirSerie.h"
00020 #include "gdcmDicomDirElement.h"
00021 #include "gdcmDicomDirImage.h"
00022 #include "gdcmGlobal.h"
00023 #include "gdcmDebug.h"
00024 
00025 namespace gdcm 
00026 {
00027 //-----------------------------------------------------------------------------
00028 // Constructor / Destructor
00033 DicomDirSerie::DicomDirSerie(bool empty):
00034    DicomDirObject()
00035 {
00036    if( !empty )
00037    {
00038       ListDicomDirSerieElem const &elemList = 
00039          Global::GetDicomDirElements()->GetDicomDirSerieElements();   
00040       FillObject(elemList);
00041    }
00042 }
00043 
00047 DicomDirSerie::~DicomDirSerie() 
00048 {
00049    ClearImage();
00050 }
00051 
00052 //-----------------------------------------------------------------------------
00053 // Public
00059 void DicomDirSerie::WriteContent(std::ofstream *fp, FileType t)
00060 {
00061    DicomDirObject::WriteContent(fp, t);
00062 
00063    for(ListDicomDirImage::iterator cc = Images.begin();
00064                                    cc!= Images.end();
00065                                  ++cc )
00066    {
00067       (*cc)->WriteContent( fp, t );
00068    }
00069 }
00070 
00075 DicomDirImage *DicomDirSerie::NewImage()
00076 {
00077    DicomDirImage *st = new DicomDirImage();
00078    Images.push_back(st);
00079    return st;   
00080 }
00081 
00085 void DicomDirSerie::ClearImage()
00086 {
00087    for(ListDicomDirImage::iterator cc = Images.begin();
00088                                    cc != Images.end();
00089                                    ++cc)
00090    {
00091       delete *cc;
00092    }
00093    Images.clear();
00094 }
00095 
00100 DicomDirImage *DicomDirSerie::GetFirstImage()
00101 {
00102    ItImage = Images.begin();
00103    if (ItImage != Images.end())
00104       return *ItImage;
00105    return NULL;
00106 }
00107 
00113 DicomDirImage *DicomDirSerie::GetNextImage()
00114 {
00115    gdcmAssertMacro (ItImage != Images.end());
00116 
00117    ++ItImage;
00118    if (ItImage != Images.end())      
00119       return *ItImage;
00120    return NULL;
00121 }
00122 
00123 //-----------------------------------------------------------------------------
00124 // Protected
00125 
00126 //-----------------------------------------------------------------------------
00127 // Private
00128 
00129 //-----------------------------------------------------------------------------
00130 // Print
00136 void DicomDirSerie::Print(std::ostream &os, std::string const &)
00137 {
00138    os << "SERIE" << std::endl;
00139    DicomDirObject::Print(os);
00140 
00141    for(ListDicomDirImage::iterator cc = Images.begin();
00142                                    cc != Images.end();
00143                                    ++cc)
00144    {
00145       (*cc)->SetPrintLevel(PrintLevel);
00146       (*cc)->Print(os);
00147    }
00148 }
00149 
00150 //-----------------------------------------------------------------------------
00151 } // end namespace gdcm

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