Program: gdcm
Module: $RCSfile: gdcmDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/01/13 12:19:58 $
- Version: $Revision: 1.100 $
+ Date: $Date: 2005/01/14 22:20:11 $
+ Version: $Revision: 1.101 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
void DicomDir::CreateDicomDirChainedList(std::string const & path)
{
CallStartMethod();
- DirList fileList(path,1); // gets recursively the file list
+ DirList dirList(path,1); // gets recursively the file list
unsigned int count = 0;
VectDocument list;
Header *header;
- for( DirList::iterator it = fileList.begin();
+ DirListType fileList = dirList.GetFilenames();
+
+ for( DirListType::iterator it = fileList.begin();
it != fileList.end();
++it )
{
// sorts Patient/Study/Serie/
std::sort(list.begin(), list.end(), DicomDir::HeaderLessThan );
- std::string tmp = fileList.GetDirName();
+ std::string tmp = dirList.GetDirName();
//for each Header of the chained list, add/update the Patient/Study/Serie/Image info
SetElements(tmp, list);
CallEndMethod();
Program: gdcm
Module: $RCSfile: gdcmDirList.cxx,v $
Language: C++
- Date: $Date: 2005/01/14 21:52:06 $
- Version: $Revision: 1.33 $
+ Date: $Date: 2005/01/14 22:20:11 $
+ Version: $Revision: 1.34 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
{
}
-//-----------------------------------------------------------------------------
-// Print
-
//-----------------------------------------------------------------------------
// Public
+
/**
* \ingroup DirList
- * \brief Get the directory name
- * @return the directory name
+ * \brief Print method
*/
-std::string const &DirList::GetDirName() const
-{
- return DirName;
-}
-
void DirList::Print(std::ostream &os)
{
- copy(begin(), end(), std::ostream_iterator<std::string>(os, "\n"));
+ std::copy(Filenames.begin(), Filenames.end(),
+ std::ostream_iterator<std::string>(os, "\n"));
}
//-----------------------------------------------------------------------------
stat(fileName.c_str(), &buf); //really discard output ?
if( S_ISREG(buf.st_mode) ) //is it a regular file?
{
- push_back( fileName );
+ Filenames.push_back( fileName );
numberOfFiles++;
}
else if( S_ISDIR(buf.st_mode) ) //directory?
Program: gdcm
Module: $RCSfile: gdcmDirList.h,v $
Language: C++
- Date: $Date: 2005/01/14 21:52:06 $
- Version: $Revision: 1.17 $
+ Date: $Date: 2005/01/14 22:20:11 $
+ Version: $Revision: 1.18 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// NOTE: Due to a VC6 'feature' we can not export a std::list in a dll,
// so GDCM_EXPORT keyword was removed for this class only
-class DirList : public std::vector<std::string>
+typedef std::vector<std::string> DirListType;
+
+class GDCM_EXPORT DirList
{
public :
DirList(std::string const &dirName, bool recursive=false);
- virtual ~DirList();
+ ~DirList();
- std::string const &GetDirName() const;
+ /// Return the name of the directory
+ std::string const &GetDirName() const { return DirName; }
- void Print(std::ostream &os = std::cout);
+ /// Return the file names
+ DirListType const &GetFilenames() const { return Filenames; };
- /// Character '\'
- static const char SEPARATOR_X;
- /// Character '/'
- static const char SEPARATOR_WIN;
- /// depending on the O.S.
- static const std::string SEPARATOR;
+ /// Print all element of the DirList
+ void Print(std::ostream &os = std::cout);
private :
int Explore(std::string const &dirName, bool recursive=false);
+ DirListType Filenames;
+
/// name of the root directory to explore
std::string DirName;
};
Program: gdcm
Module: $RCSfile: gdcmSerieHeader.cxx,v $
Language: C++
- Date: $Date: 2005/01/14 21:34:53 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2005/01/14 22:20:11 $
+ Version: $Revision: 1.9 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
void SerieHeader::SetDirectory(std::string const &dir)
{
CurrentSerieUID = ""; //Reset previous Serie Instance UID
- DirList filenames_list(dir); //OS specific
+ DirList dirList(dir); //OS specific
- for( DirList::const_iterator it = filenames_list.begin();
+ DirListType filenames_list = dirList.GetFilenames();
+ for( DirListType::const_iterator it = filenames_list.begin();
it != filenames_list.end(); ++it)
{
AddFileName( *it );