#include <sys/types.h>
#include <errno.h>
-#include <unistd.h>
+
+#ifdef _MSC_VER
+ #include <direct.h>
+#else
+ #include <unistd.h>
+#endif
//-----------------------------------------------------------------------------
// For full DICOMDIR description, see:
if(strlen(Name)==1 && Name[0]=='.') { // user passed '.' as Name
// we get current directory name
- char*dummy=(char*) malloc(1000); // TODO : check with Windoze
+ char*dummy=(char*) malloc(1000); // TODO : check with Windoze // JPR
+#ifdef _MSC_VER
+ _getcwd(dummy,(size_t)1000);
+#else
getcwd(dummy,(size_t)1000);
+#endif
SetFileName(dummy); // will be converted into a string
free(dummy); // no longer needed
}
ParseDirectory();
}
}
- else
+ else {
CreateDicomDir();
+ CheckBoundaries(); // to maintain consistency between
+ // home-made gdcmDicomDir
+ // and the ones comming from a DICOMDIR file
+ }
}
/*
fwrite(filePreamble,128,1,fp1);
fwrite("DICM",4,1,fp1);
free(filePreamble);
- //UpdateDirectoryRecordSequenceLength(); // a reecrire en utilisant
+ //UpdateDirectoryRecordSequenceLength(); // a reecrire en utilisant JPR
// la structure arborescente JPR
WriteDicomDirEntries(fp1);
std::sort(list.begin(),list.end(),gdcmDicomDir::HeaderLessThan);
std::string tmp=fileList.GetDirName();
+
//for each Header of the chained list, add/update the Patient/Study/Serie/Image info
SetElements(tmp,list);
-
+
CallEndMethod();
}
+
+
+void gdcmDicomDir::CheckBoundaries()
+{
+ ListDicomDirPatient::iterator itPatient;
+ ListDicomDirStudy::iterator itStudy;
+ ListDicomDirSerie::iterator itSerie;
+ ListDicomDirImage::iterator itImage;
+ ListTag::iterator i,j;
+
+ GetDicomDirMeta()->ResetBoundaries(0);
+
+ itPatient = GetDicomDirPatients().begin();
+ while ( itPatient != GetDicomDirPatients().end() ) {
+ (*itPatient)->ResetBoundaries(1);
+ itStudy = ((*itPatient)->GetDicomDirStudies()).begin();
+ while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) {
+ (*itStudy)->ResetBoundaries(1);
+ itSerie = ((*itStudy)->GetDicomDirSeries()).begin();
+ while (itSerie != (*itStudy)->GetDicomDirSeries().end() ) {
+ (*itSerie)->ResetBoundaries(1);
+ itImage = ((*itSerie)->GetDicomDirImages()).begin();
+ while (itImage != (*itSerie)->GetDicomDirImages().end() ) {
+ (*itImage)->ResetBoundaries(1);
+ ++itImage;
+ }
+ ++itSerie;
+ }
+ ++itStudy;
+ }
+ ++itPatient;
+ }
+}
+
+
/*
* \ingroup gdcmDicomDir
* \brief adds a new Patient to a partially created DICOMDIR