+2004-02-10 Benoit Regrain
+ * FIX : bug fix in the gdcmDirList for the recursivity in directories
+ * FIX : in gdcmDicomDir when the directory is empty
+
2004-02-06 Jean-Pierre Roux
* ENH : - now gdcmDicomDir::CreateDicomDir() returns also the meta elements
- GDCM_META added to gdcmDicomDirType
- class gdcmMeta created
- * ENH : - A brief summary is now displayed at the beginning of 'testDicomDir'
- to help disaster magnitude estimation
+ * ENH : - A brief summary is now displayed at the beginning of
+ 'testDicomDir' to help disaster magnitude estimation
* REM : Now useless Test/explDICOMDIR.cxx
2004-02-05 Benoit Regrain
bool exception_on_error):
gdcmParser(FileName,exception_on_error,true)
{
+ metaElems=NULL;
+
if( GetListEntry().begin()==GetListEntry().end() )
{
dbg.Verbose(0, "gdcmDicomDir::gdcmDicomDir : entry list empty");
CreateDicomDir();
}
-/*
- * \ingroup gdcmDicomDir
- * \brief
- * @param exception_on_error
- */
-/*gdcmDicomDir::gdcmDicomDir(ListTag *l,
- bool exception_on_error):
- gdcmParser(exception_on_error )
-{
- listEntries=*l;
- CreateDicomDir();
-}*/
-
/*
* \ingroup gdcmDicomDir
* \brief Canonical destructor
*/
gdcmDicomDir::~gdcmDicomDir()
{
- delete metaelems;
+ if(metaElems)
+ delete metaElems;
for(ListPatient::iterator cc=patients.begin();cc!=patients.end();++cc)
{
*/
void gdcmDicomDir::Print(std::ostream &os)
{
- (*metaelems).SetPrintLevel(printLevel);
- (*metaelems).Print(os);
+ if(metaElems)
+ {
+ metaElems->SetPrintLevel(printLevel);
+ metaElems->Print(os);
+ }
for(ListPatient::iterator cc=patients.begin();cc!=patients.end();++cc)
{
for(gdcmDirList::iterator it=fileList.begin();
it!=fileList.end(); ++it)
{
+ std::cout<<*it<<std::endl;
header=new gdcmHeader(it->c_str());
if(header->IsReadable())
list.push_back(header);
// + we create the object for the precedent tag
// + loop to 1 -
- gdcmDicomDirType type=gdcmDicomDir::GDCM_NONE;
+ gdcmDicomDirType type=gdcmDicomDir::GDCM_META;
ListTag::iterator begin;
ListTag::iterator end;
- ListTag::iterator k;
begin=listEntries.begin();
end=begin;
-
- for(ListTag::iterator j=begin;j !=listEntries.end();++j)
- {
- if((*j)->GetValue()=="PATIENT ") {
- k = j;
- break;
- }
- }
- AddObjectToEnd(gdcmDicomDir::GDCM_META,begin,k);
-
- for(ListTag::iterator i=k;i !=listEntries.end();++i)
+ for(ListTag::iterator i=end;i !=listEntries.end();++i)
{
std::string v=(*i)->GetValue();
if(v=="PATIENT ")
}
}
- end=GetListEntry().end();
- AddObjectToEnd(type,begin,end);
+ if(begin!=end)
+ {
+ end=GetListEntry().end();
+ AddObjectToEnd(type,begin,end);
+ }
}
/*
* \ingroup gdcmDicomDir
}
}
-
/*
* \ingroup gdcmDicomDir
* \brief Well ... Not realy to end, there is only one occurence
*/
void gdcmDicomDir::AddMetaToEnd(ListTag::iterator begin,ListTag::iterator end)
{
- metaelems = new gdcmMeta(begin,end);
+ if(metaElems)
+ delete metaElems;
+ metaElems = new gdcmMeta(begin,end);
}
/*
while( (hFile!=INVALID_HANDLE_VALUE) && (found) )
{
fileName=fileData.cFileName;
+ std::cout<<fileName<<std::endl;
if(fileData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
{
if( (fileName!=".") && (fileName!="..") && (recursive) )
- Explore(dirName+fileName);
+ Explore(dirName+fileName,recursive);
}
else
{
if(namelist[i]->d_type==DT_DIR)
{
if( (fileName!=".") && (fileName!="..") && (recursive) )
- Explore(dirName+fileName);
+ Explore(dirName+fileName,recursive);
}
else
{