]> Creatis software - clitk.git/commitdiff
Sort series under Linux
authorSimon Rit <simon.rit@creatis.insa-lyon.fr>
Fri, 26 Jul 2013 10:50:07 +0000 (12:50 +0200)
committerSimon Rit <simon.rit@creatis.insa-lyon.fr>
Fri, 26 Jul 2013 10:50:07 +0000 (12:50 +0200)
vv/vvQPacsConnection.cxx

index 905c668ad1dc8a76a4964b4a4f90999b6737b8d9..443447df970e3ad0bedbfb2aa4b504b27cb14b82 100644 (file)
@@ -8,6 +8,8 @@
 #include "vvPacsSettingsDialog.h"
 #include "vvUtils.h"
 #include <algorithm>
+#include <itkGDCMImageIO.h>
+#include <itkGDCMSeriesFileNames.h>
 
 
 vvQPacsConnection::vvQPacsConnection(QWidget *i_parent)
@@ -385,8 +387,31 @@ void vvQPacsConnection::on_importButton_clicked()
                        getDicomClientPort(),  getDicomClientAETitle().c_str(), m_aetitle.c_str(), path.toStdString().c_str() );
                gdcm::Directory theDir;
                theDir.Load(path.toStdString().c_str());
-          m_files =    theDir.GetFilenames();
-               std::sort (m_files.begin(), m_files.end()); // make sure names are in lexicographical order
+     //m_files =       theDir.GetFilenames();
+
+     typedef itk::GDCMSeriesFileNames NamesGeneratorType;
+     NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();
+     nameGenerator->SetUseSeriesDetails(true);
+
+     //ds gĂ©rer recursive moi-meme pour progress ...
+     nameGenerator->SetInputDirectory(path.toStdString());
+
+     // insert in table
+     typedef std::vector<std::string> SeriesIdContainer;
+     const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs();
+       std::map<std::string, std::vector<std::string>* > mListOfSeriesFilenames;
+
+
+     for (unsigned int i=0; i<seriesUID.size(); i++) {
+
+         // store filenames
+         std::vector<std::string> * filenames = new std::vector<std::string>;
+         m_files = nameGenerator->GetFileNames(seriesUID[i]);
+       /*  for (unsigned int j=0; j<temp.size(); j++) {
+           m_files->push_back(temp[j]);
+         }*/
+
+       }
           
           accept();
          setCursor(QCursor(Qt::ArrowCursor));