- QModelIndex index;
- QVariant elt= Patientmodel->data(index.sibling(ui.patientTreeView->selectionModel()->selectedRows().first().row(),1));
-
- gdcm::EQueryLevel theLevel = gdcm::ePatient;
- gdcm::ERootType theRoot = gdcm::ePatientRootType;//ePatientRootType;
- std::vector<gdcm::DataSet> theDataSet;
- std::vector< std::pair<gdcm::Tag, std::string> > keys;
-
- // Study Description
- gdcm::Tag tagsdc(0x0010,0x0020);
- keys.push_back(std::make_pair(tagsdc, elt.toString().toStdString()));
- gdcm::SmartPointer<gdcm::BaseRootQuery> theQuery = gdcm::CompositeNetworkFunctions::ConstructQuery(theRoot, theLevel ,keys);
- // gdcm::CompositeNetworkFunctions::CFind("127.0.0.1", 5678, theQuery, theDataSet, "CREATIS", "CONQUESTSRV1");
-
- bool didItWork = gdcm::CompositeNetworkFunctions::CMove(m_adress.c_str(),atoi(m_port.c_str()), theQuery, 0,
- "CREATIS", m_nickname.c_str(), "d:\\temp_pacs_import\\" );
- }
\ No newline at end of file
+ setCursor(QCursor(Qt::WaitCursor));
+ QString path = QString::fromStdString(getCMoveDirectory());
+ QDir dirpath (path);
+ if (dirpath.exists())
+ {
+ QFileInfoList list = dirpath.entryInfoList( QDir::Files);
+ QFileInfoList::iterator it_file = dirpath.entryInfoList( QDir::Files).begin();
+ for(int i = 0; i < list.length() ; i++)
+ {
+ QFile::remove(list.at(i).filePath());
+ }
+ }
+ else
+ {
+ dirpath.mkdir(path);
+ }
+ bool didItWork = gdcm::CompositeNetworkFunctions::CMove(m_adress.c_str(),atoi(m_port.c_str()),
+ gdcm::CompositeNetworkFunctions::ConstructQuery(mQFactory.getMoveQuery().theRoot, mQFactory.getMoveQuery().theLevel ,mQFactory.getMoveQuery().keys, gdcm::eMove),
+ 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();
+
+ typedef itk::GDCMSeriesFileNames NamesGeneratorType;
+ NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();
+ nameGenerator->SetUseSeriesDetails(true);
+
+ //ds gerer 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;
+
+
+ m_fileseries.clear();
+
+ for (unsigned int i=0; i<seriesUID.size(); i++) {
+ m_fileseries.push_back( nameGenerator->GetFileNames(seriesUID[i]));
+ }
+
+ accept();
+ setCursor(QCursor(Qt::ArrowCursor));
+ }
+
+
+
+std::vector <std::string> vvQPacsConnection::getFileNames(int i_series)
+{
+ std::vector <std::string> filenames;
+ gdcm::Directory::FilenamesType::iterator it = m_fileseries[i_series].begin();
+ for (;it != m_fileseries[i_series].end(); it++)
+ filenames.push_back(it->c_str());
+ return filenames;
+}
+std::vector< std::pair<gdcm::Tag, std::string> > vvQPacsConnection::fillMoveKeys()
+{
+ std::vector< std::pair<gdcm::Tag, std::string> > keys;
+ switch(m_level)
+ {
+ case gdcm::ePatient:
+ //keys.push_back(getPatientKeys("",""));
+ break;
+ }
+
+ return keys;
+}