00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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
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
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
00141
00142
00143
00144
00145
00146
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 }