00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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
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
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
00125
00126
00127
00128
00129
00130
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 }