2004-03-17 Jean-Pierre Roux
* REM (Eric Boix bug) : removal of meaningless
- gdcmDicomDirImage::NewImage function.
+ gdcmDicomDirImage::NewImage function.
* FIX now file names and directory name are written properly in the
DICOMDIR
- now gdcmDicomDir constructor may be call without any trick
+ * FIX now gdcmDicomDir constructor may be call without any trick
about the name
2004-03-16 Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
ParseDirectory();
}
}
- else
+ else {
CreateDicomDir();
+ CheckBoundaries(); // JPR
+ }
+
}
/*
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()
+{
+
+cout <<"entree ds CheckBoundaries " <<endl;
+ 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
// Parsing
void ParseDirectory(void);
-
+ void CheckBoundaries(void);
+
void SetStartMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
void SetStartMethodArgDelete(gdcmMethod *);
void SetProgressMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
// gdcmDirList.cxx
//-----------------------------------------------------------------------------
#include "gdcmDirList.h"
+#include "gdcmUtil.h"
#include <iostream>
#include <algorithm>
#include <unistd.h>
#endif
-//-----------------------------------------------------------------------------
-const char gdcmDirList::SEPARATOR_X = '/';
-const char gdcmDirList::SEPARATOR_WIN = '\\';
-const std::string gdcmDirList::SEPARATOR = "/";
-
-//-----------------------------------------------------------------------------
// Constructor / Destructor
/*
* \ingroup gdcmDirList
//-----------------------------------------------------------------------------
// Private
-/*
- * \ingroup gdcmDirList
- * \brief Add a SEPARATOR to the end of the directory name is necessary
- * @param
- */
-void gdcmDirList::NormalizePath(std::string &dirName)
-{
- int size=dirName.size();
- if((dirName[size-1]!=SEPARATOR_X)&&(dirName[size-1]!=SEPARATOR_WIN))
- {
- dirName+=SEPARATOR;
- }
-}
/*
* \ingroup gdcmDirList
static const std::string SEPARATOR;
private :
- void NormalizePath(std::string &dirName);
void Explore(std::string dirName,bool recursive=false);
std::string name;
return GetEntryByNumber(dictEntry->GetGroup(),dictEntry->GetElement());
}
+/**
+ * \ingroup gdcmObject
+ * \brief Set the 'boundaries' gdcmObject (gdcmDicomDirPatient,
+ * gdcmDicomDirStudy, gdcmDicomDirSerie, gdcmDicomDirImage)
+ * comming for the parsing of a DICOMDIR file
+ * \warning NOT en user intended function
+ * @param flag = 0 when META to be dealt with
+ */
+void gdcmObject::ResetBoundaries(int flag) {
+
+ if (flag) { // it's NOT a META
+ // upwards to fffe,e000
+ for( i=j=debut();
+ ((*i)->GetGroup() != 0xfffe) && ((*i)->GetElement() != 0x0000);
+ --i,j--) {
+ }
+ beginObj=j;
+ }
+
+ // downwards to fffe,e000
+ for( i=j=fin();
+ ((*i)->GetGroup() != 0xfffe) && ((*i)->GetElement() != 0x0000);
+ --i,j--) {
+ }
+ j--;
+ endObj=j;
+}
+
/**
* \ingroup gdcmParser
* \brief Sets Entry (Dicom Element) value of an element,
TagHeaderEntryHT GetEntry(void);
ListTag GetListEntry(void);
+
+ void ResetBoundaries(int flag);
/**
* \ingroup gdcmObject
* \brief returns an iterator on the first Header Entry (i.e Dicom Element),
*/
ListTag::iterator fin (void)
{ return(endObj); }
+
+/**
+ * \ingroup gdcmObject
+ * \brief Sets the iterator on the 'new' last Header Entry (i.e Dicom Element),
+ * inside the DICOMDIR chained list,
+ * related to this 'Object'
+ * \warning : NOT end user intended function
+ * \todo find a trick to make this function useless.
+* @return
+ */
+ ListTag::iterator SetEndObj(ListTag::iterator newEnd)
+ { endObj=newEnd; }
protected:
}
//-----------------------------------------------------------------------------
+// Here are some usefull functions, belonging to NO class,
+// dealing with strings, file names, etc
+// that can be called from anywhere
+// by whomsoever they can help.
+//-----------------------------------------------------------------------------
+
// Because is not yet available in g++2.96
std::istream& eatwhite(std::istream& is) {
char c;
return v;
}
-
///////////////////////////////////////////////////////////////////////////
// to prevent a flashing screen when non-printable character
std::string _CreateCleanString(std::string s) {