]> Creatis software - creaImageIO.git/commitdiff
#333 Export new list of filesnames after DropDuplicatePositions
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Fri, 21 Jun 2024 13:03:56 +0000 (15:03 +0200)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Fri, 21 Jun 2024 13:03:56 +0000 (15:03 +0200)
appli/TestWxGimmickReaderDialog/main.cxx
bbtk/src/bbcreaImageIOGimmick.xml
src/creaImageIOGimmickView.cpp
src/creaImageIOOutputModel.cpp
src/creaImageIOWxGimmickPanel.h
src/creaImageIOWxGimmickReaderDialog.cpp
src/creaImageIOWxGimmickReaderDialog.h
src/creaImageIOWxGimmickView.cpp
src/creaImageIOWxGimmickView.h
src/creaImageIOWxSimpleDlg.cpp

index a8265ec119a03b02d40c1f43987a136965ba6839..833b1020c27cde3a2260bdcca4ad3b7fe7b17c0b 100644 (file)
@@ -140,11 +140,12 @@ bool myApp::OnInit( )
        // but for all selected file.
     // For the moment, no output model file (XML)
           std::vector<creaImageIO::OutStrGimmick> out;
+       std::vector<std::string> outFileNames;
        std::vector<std::string> attr;
           attr.push_back("D0028_0010");
           attr.push_back("D0008_0023");
           attr.push_back("D0008_1070");
-          w.getSelected(out, attr,true,"");
+          w.getSelected(out, attr,outFileNames,true,"");
        std::cout<<out.size()<<std::endl;
           crea::VtkBasicSlicer(out.front().img);
        out.front().img->Delete();
index c44018da88be807efc24f40c419372e36bcab3d2..a754216d561a618cb00db0749a2e1118a2246c06 100644 (file)
                std::vector<vtkImageData*>                                                      m_results;
                std::vector< std::map<std::string,std::string> >        m_resultsDicomAtr;
 
-
                 if (w.GetReturnCode() == wxID_OK)
             {
                        w.stopReading();
                        std::vector<creaImageIO::OutStrGimmick> outStrGimmick;
-                       w.getSelected(outStrGimmick, bbGetInputDicomTags() ,true,"");
+            std::vector<std::string> outStrFileNames;
+                       w.getSelected(outStrGimmick, bbGetInputDicomTags(), outStrFileNames ,true,"");
                        m_results.clear();
                        int size=(int)outStrGimmick.size();
                        int ii;
            bbSetOutputOut(m_results[0]);
            bbSetOutputOut2(m_results);
          }
-       std::vector<std::string> files;
-               w.GetSelectedFiles(files);
-               bbSetOutputFiles(files);
-               bbSetOutputDicomInfo( m_resultsDicomAtr );
+//EED2024-06-21        w.GetSelectedFiles(files);
+//             bbSetOutputFiles(files);
+
+        bbSetOutputFiles(outStrFileNames);
+
+        bbSetOutputDicomInfo( m_resultsDicomAtr );
                w.OnExit();
                 }
 
     bbSetInputImageMaxDimension(3);
     bbSetInputImageOutputDimension(3);
     bbSetInputTitle("Select image(s)");
-    bbSetInputOutput(0);
-       bbSetOutputOut(0);
+    bbSetInputOutput(NULL);
+       bbSetOutputOut(NULL);
 
   </PRE></defaultValues>    
   
index 07973328d5f60c29d981f7fb9f9f97f8eb0fdcf9..62c7d0c862fbb884d5ec6fcb4f03d47f46489361 100644 (file)
@@ -505,9 +505,9 @@ void GimmickView::ReadImagesNotThreaded(std::vector<vtkImageData*>& s, std::vect
                for (it=im.begin(); it!=im.end(); ++it)
                {
                        OutStrGimmick out;
-                       out.img = vtkImageData::New();
+                       out.img         = vtkImageData::New();
                        out.img->ShallowCopy(mReader.GetImage(*it));
-                       if(i_attr.mult) 
+                       if(i_attr.mult)
                        {
                                getAttributes((*it),out.infos,i_attr);
                        }
@@ -529,7 +529,8 @@ void GimmickView::ReadImagesNotThreaded(std::vector<vtkImageData*>& s, std::vect
        {
                OutStrGimmick out;
                vtkImageData* first = mReader.GetImage( im.front() );
-               out.img  = vtkImageData::New();
+               out.img             = vtkImageData::New();
+
                int ext[6];
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
@@ -616,7 +617,7 @@ void GimmickView::ReadImagesNotThreaded(std::vector<vtkImageData*>& s, std::vect
                        for (int slice= 0 ; slice <dim[2]; slice++)
                        {
                                OutStrGimmick out;
-                               out.img = vtkImageData::New();
+                               out.img         = vtkImageData::New();
                                out.img->SetSpacing(spac);
                                int ext[6];
 //EED 2017-01-01 Migration VTK7
index dfa234b7129ebfa3cbf78f64cf54cec81c5d6ec1..24be6c9dd7a2139ccc340d4d95935a6ebc01dc93 100644 (file)
@@ -67,6 +67,7 @@ namespace creaImageIO
                FileList fileVector;
                //GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New();
                GDCM_NAME_SPACE::SerieHelper *sh = GDCM_NAME_SPACE::SerieHelper::New();
+        sh->SetDropDuplicatePositions(true);
                std::vector<std::string> lstAux;
                std::vector<std::string>::iterator it;
                for (it=im.begin(); it!=im.end(); ++it)
@@ -100,7 +101,7 @@ namespace creaImageIO
                }else {
                        std::sort( im.begin(), im.end() );
                }
-               
+
           return spacing;
        }
 
index cb74ee122a68489f152ebc5b67897a0ad34112de..5426b47a397f07f548e0216b4c6714302ad22543 100644 (file)
@@ -96,9 +96,9 @@ namespace creaImageIO
        // i_attr: list of dicom tags to extract 
        // mult: information of one file or multiple files
        // outmodel: xml-filename that specifies images order..(todo) 
-       void getSelected(std::vector<OutStrGimmick> &outG,std::vector< std::string> i_attr, bool mult, const std::string outmodel)
+       void getSelected(std::vector<OutStrGimmick> &outG,std::vector< std::string> i_attr, std::vector<std::string> &outFileNames, bool mult, const std::string outmodel)
        {
-               mView->getSelectedFiles(outG, i_attr, mult, outmodel);
+               mView->getSelectedFiles(outG, i_attr, outFileNames, mult, outmodel);
        }
 
     void OnSelectedImage(bool t);
index f7af7d0a589d99594fb3da7499bd26a58ee52b34..5bf968b2f1f8beeeeac9a5e878a0ff9d59cecd4d 100644 (file)
@@ -88,14 +88,13 @@ namespace creaImageIO
     }
     mtopsizer->Add( mView,1,wxGROW,0);
     wxSizer* bsizer = this->CreateSeparatedButtonSizer(wxOK|wxCANCEL);
-       //mOkButton = new wxButton(this, wxID_OK, _T("OK"), wxPoint(170,50));
+       //mOkButton     = new wxButton(this, wxID_OK, _T("OK"), wxPoint(170,50));
        //mCancelButton = new wxButton(this, wxID_CANCEL, _T("CANCEL"), wxPoint(210,50));
-    mOkButton = (wxButton*)FindWindowById(GetAffirmativeId(), this);
-    mCancelButton = (wxButton*)FindWindowById(GetEscapeId(),      this);
+    mOkButton       = (wxButton*)FindWindowById(GetAffirmativeId(), this);
+    mCancelButton   = (wxButton*)FindWindowById(GetEscapeId(),      this);
     mOkButton->Enable(false);
     mtopsizer->Add ( bsizer, 0, wxGROW );
     SetSizer( mtopsizer );
-
     Layout(); 
   }
 
index 902eeb8dbd9827fc0d2578657a3c840918ce3840..669f9127ee71d0e8384ef3d920f6e2aaea4b78ca 100644 (file)
@@ -80,9 +80,9 @@ namespace creaImageIO
        // i_attr: list of dicom tags to extract 
        // mult: information of one file or multiple files
        // outmodel: xml-filename that specifies images order..(todo) 
-       void getSelected(std::vector<OutStrGimmick> &outG,std::vector< std::string> i_attr, bool mult, const std::string outmodel)
+       void getSelected(std::vector<OutStrGimmick> &outG,std::vector< std::string> i_attr, std::vector<std::string> &outFileNames, bool mult, const std::string outmodel)
        {
-               mView->getSelectedFiles(outG, i_attr, mult, outmodel);
+               mView->getSelectedFiles(outG, i_attr, outFileNames, mult, outmodel);
        }
 
     void GetSelectedFiles(std::vector<std::string>& s) 
index a5650ee32978d68830327d8b0de2b66ac7c68a68..21c95b7f865320f0220271d3edf1515ad1669fcf 100644 (file)
@@ -395,7 +395,7 @@ void WxGimmickView::AddBtnTool(wxPanel *panel, wxBoxSizer *sizerH, int id, wxStr
 
   /// By default if out_infos is empty, we dont' provide informations, we return only vtkImageData 
   /// if out_infos has only one entry "all" we provide all database informations
-  void WxGimmickView::getSelectedFiles(std::vector<OutStrGimmick> &outG, std::vector< std::string> i_attr, 
+  void WxGimmickView::getSelectedFiles(std::vector<OutStrGimmick> &outG, std::vector< std::string> i_attr, std::vector<std::string> &outFileNames,
                                        bool mult, const std::string out_model)
   {
        // First we select the files
@@ -472,7 +472,7 @@ void WxGimmickView::AddBtnTool(wxPanel *panel, wxBoxSizer *sizerH, int id, wxStr
        }
        // Now we read and create the waiting output (vtkImageData * or OutGimmickData *)
        readImages(outG, sort_files, Oattr, i_dim_out, zspacing);
-
+    outFileNames = sort_files;
   }
 
 
index 7ea39f2e84b6d054a1c5425c3a742c33c90f9101..34d605faa80444ba1eae913a3dda36e4a1606d19 100644 (file)
@@ -79,7 +79,7 @@ namespace creaImageIO
     void GetSelectedFiles(std::vector<std::string>& s);
     
         /// Returns the selected files in output structure
-       void getSelectedFiles(std::vector<OutStrGimmick> &outG, std::vector< std::string> out_infos, bool mult = false, const std::string out_model = "");
+       void getSelectedFiles(std::vector<OutStrGimmick> &outG, std::vector< std::string> out_infos, std::vector<std::string> &outFileNames, bool mult = false, const std::string out_model = "");
 
     /// Returns the selected Images so that they comply with the 
     /// given parameter(4D) (overloaded from GimmickView)
index 239b00c0859f30a233524813449b22e02234dae2..cf2911d73647e6d5b80817e2b314cc61301a8d86 100644 (file)
@@ -152,7 +152,8 @@ namespace creaImageIO
             {
                        dlg.stopReading();
                        std::vector<creaImageIO::OutStrGimmick> outStrGimmick;
-                       dlg.getSelected(outStrGimmick, m_attrDicomTags,true,"");
+            std::vector<std::string>                outFileNames;
+                       dlg.getSelected(outStrGimmick, m_attrDicomTags, outFileNames,true,"");
                        m_results.clear();
                        int size=(int)outStrGimmick.size();
                        int ii;