+/**
+ * \brief Load the gdcm::File* set, according to user's requierements
+ * returns a std::vector of gdcm::File* (gdcm::FileList : actually, a std::vector of gdcm::File*)
+ */
+
+
+GDCM_NAME_SPACE::FileList *vtkGdcm4DSplitter::getGdcmFileList()
+{
+
+ GDCM_NAME_SPACE::File *f;
+ GDCM_NAME_SPACE::DirListType fileNames;
+
+ //
+ // Fill fileNames with the user supplied file names (in any)
+ // ------------------------------------------------
+ //
+ if (TypeDir == 0 ) // Nothing was set as input...
+ {
+ ///\TODO (?) Throw an exception "Set input Directory name(s) / file names before!"
+ std::cout << "Set input Directory name(s) / file names before!" << std::endl;
+ return false;
+ }
+ else if (TypeDir == 1) // A root directory name was set as input
+ {
+ GDCM_NAME_SPACE::DirList dirlist(DirName, Recursive); // NO recursive exploration
+ fileNames = dirlist.GetFilenames(); // all the file names
+ }
+
+ else if (TypeDir == 2) // a std::vector of directory names was set as input
+ {
+ int nbDir = VectDirName.size();
+ GDCM_NAME_SPACE::DirListType tmpFileNames;
+ for (int iDir=0; iDir<nbDir; iDir++)
+ {
+ GDCM_NAME_SPACE::DirList dirlist(VectDirName[iDir], Recursive);
+ tmpFileNames = dirlist.GetFilenames();
+ // Concat two std::vector
+ //vector1.insert( vector1.end(), vector2.begin(), vector2.end() );
+ fileNames.insert( fileNames.end(), tmpFileNames.begin(), tmpFileNames.end() );
+ }
+ }
+ else if (TypeDir == 3) // a list of files names was set as input
+ {
+ fileNames=VectFileName;
+ }
+
+ //
+ // Fill l with the gdcm::File* corresponding to the files
+ // --------------------------------------
+ //
+
+ GDCM_NAME_SPACE::FileList *l = new GDCM_NAME_SPACE::FileList; // (set of gdcm::File*)
+
+ if (TypeDir == 4) // an already existing std::vector of gdcm::File* was set as input
+ {
+ l = VectGdcmFile;
+ }
+ else
+ {
+ double floatTagvalue;
+ // Loop on all the gdcm-readable files
+ for (GDCM_NAME_SPACE::DirListType::iterator it = fileNames.begin();
+ it != fileNames.end();
+ ++it)
+ {
+ int maxSize = 0x7fff; // load Elements of any length
+ /// \TODO ? gdcm::File are never free'd
+ f = GDCM_NAME_SPACE::File::New();
+ f->SetMaxSizeLoadEntry(maxSize);
+ f->SetFileName( *it );
+ if (f->Load())
+ l->push_back(f);
+ else
+ std::cout << " Fail to load [" << *it << "]" << std::endl;
+ }
+ }
+ return l;
+}
+
+
+