From b124b45664473a3ad32c1c8cf680cc3355e4dbd2 Mon Sep 17 00:00:00 2001 From: "eduardo.davila@creatis.insa-lyon.fr" Date: Fri, 21 Jun 2024 15:03:56 +0200 Subject: [PATCH] #333 Export new list of filesnames after DropDuplicatePositions --- appli/TestWxGimmickReaderDialog/main.cxx | 3 ++- bbtk/src/bbcreaImageIOGimmick.xml | 18 ++++++++++-------- src/creaImageIOGimmickView.cpp | 9 +++++---- src/creaImageIOOutputModel.cpp | 3 ++- src/creaImageIOWxGimmickPanel.h | 4 ++-- src/creaImageIOWxGimmickReaderDialog.cpp | 7 +++---- src/creaImageIOWxGimmickReaderDialog.h | 4 ++-- src/creaImageIOWxGimmickView.cpp | 4 ++-- src/creaImageIOWxGimmickView.h | 2 +- src/creaImageIOWxSimpleDlg.cpp | 3 ++- 10 files changed, 31 insertions(+), 26 deletions(-) diff --git a/appli/TestWxGimmickReaderDialog/main.cxx b/appli/TestWxGimmickReaderDialog/main.cxx index a8265ec..833b102 100644 --- a/appli/TestWxGimmickReaderDialog/main.cxx +++ b/appli/TestWxGimmickReaderDialog/main.cxx @@ -140,11 +140,12 @@ bool myApp::OnInit( ) // but for all selected file. // For the moment, no output model file (XML) std::vector out; + std::vector outFileNames; std::vector 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<Delete(); diff --git a/bbtk/src/bbcreaImageIOGimmick.xml b/bbtk/src/bbcreaImageIOGimmick.xml index c44018d..a754216 100644 --- a/bbtk/src/bbcreaImageIOGimmick.xml +++ b/bbtk/src/bbcreaImageIOGimmick.xml @@ -95,12 +95,12 @@ std::vector m_results; std::vector< std::map > m_resultsDicomAtr; - if (w.GetReturnCode() == wxID_OK) { w.stopReading(); std::vector outStrGimmick; - w.getSelected(outStrGimmick, bbGetInputDicomTags() ,true,""); + std::vector outStrFileNames; + w.getSelected(outStrGimmick, bbGetInputDicomTags(), outStrFileNames ,true,""); m_results.clear(); int size=(int)outStrGimmick.size(); int ii; @@ -129,10 +129,12 @@ bbSetOutputOut(m_results[0]); bbSetOutputOut2(m_results); } - std::vector files; - w.GetSelectedFiles(files); - bbSetOutputFiles(files); - bbSetOutputDicomInfo( m_resultsDicomAtr ); +//EED2024-06-21 w.GetSelectedFiles(files); +// bbSetOutputFiles(files); + + bbSetOutputFiles(outStrFileNames); + + bbSetOutputDicomInfo( m_resultsDicomAtr ); w.OnExit(); } @@ -150,8 +152,8 @@ bbSetInputImageMaxDimension(3); bbSetInputImageOutputDimension(3); bbSetInputTitle("Select image(s)"); - bbSetInputOutput(0); - bbSetOutputOut(0); + bbSetInputOutput(NULL); + bbSetOutputOut(NULL); diff --git a/src/creaImageIOGimmickView.cpp b/src/creaImageIOGimmickView.cpp index 0797332..62c7d0c 100644 --- a/src/creaImageIOGimmickView.cpp +++ b/src/creaImageIOGimmickView.cpp @@ -505,9 +505,9 @@ void GimmickView::ReadImagesNotThreaded(std::vector& 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& 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& s, std::vect for (int slice= 0 ; slice SetSpacing(spac); int ext[6]; //EED 2017-01-01 Migration VTK7 diff --git a/src/creaImageIOOutputModel.cpp b/src/creaImageIOOutputModel.cpp index dfa234b..24be6c9 100644 --- a/src/creaImageIOOutputModel.cpp +++ b/src/creaImageIOOutputModel.cpp @@ -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 lstAux; std::vector::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; } diff --git a/src/creaImageIOWxGimmickPanel.h b/src/creaImageIOWxGimmickPanel.h index cb74ee1..5426b47 100644 --- a/src/creaImageIOWxGimmickPanel.h +++ b/src/creaImageIOWxGimmickPanel.h @@ -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 &outG,std::vector< std::string> i_attr, bool mult, const std::string outmodel) + void getSelected(std::vector &outG,std::vector< std::string> i_attr, std::vector &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); diff --git a/src/creaImageIOWxGimmickReaderDialog.cpp b/src/creaImageIOWxGimmickReaderDialog.cpp index f7af7d0..5bf968b 100644 --- a/src/creaImageIOWxGimmickReaderDialog.cpp +++ b/src/creaImageIOWxGimmickReaderDialog.cpp @@ -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(); } diff --git a/src/creaImageIOWxGimmickReaderDialog.h b/src/creaImageIOWxGimmickReaderDialog.h index 902eeb8..669f912 100644 --- a/src/creaImageIOWxGimmickReaderDialog.h +++ b/src/creaImageIOWxGimmickReaderDialog.h @@ -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 &outG,std::vector< std::string> i_attr, bool mult, const std::string outmodel) + void getSelected(std::vector &outG,std::vector< std::string> i_attr, std::vector &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& s) diff --git a/src/creaImageIOWxGimmickView.cpp b/src/creaImageIOWxGimmickView.cpp index a5650ee..21c95b7 100644 --- a/src/creaImageIOWxGimmickView.cpp +++ b/src/creaImageIOWxGimmickView.cpp @@ -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 &outG, std::vector< std::string> i_attr, + void WxGimmickView::getSelectedFiles(std::vector &outG, std::vector< std::string> i_attr, std::vector &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; } diff --git a/src/creaImageIOWxGimmickView.h b/src/creaImageIOWxGimmickView.h index 7ea39f2..34d605f 100644 --- a/src/creaImageIOWxGimmickView.h +++ b/src/creaImageIOWxGimmickView.h @@ -79,7 +79,7 @@ namespace creaImageIO void GetSelectedFiles(std::vector& s); /// Returns the selected files in output structure - void getSelectedFiles(std::vector &outG, std::vector< std::string> out_infos, bool mult = false, const std::string out_model = ""); + void getSelectedFiles(std::vector &outG, std::vector< std::string> out_infos, std::vector &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) diff --git a/src/creaImageIOWxSimpleDlg.cpp b/src/creaImageIOWxSimpleDlg.cpp index 239b00c..cf2911d 100644 --- a/src/creaImageIOWxSimpleDlg.cpp +++ b/src/creaImageIOWxSimpleDlg.cpp @@ -152,7 +152,8 @@ namespace creaImageIO { dlg.stopReading(); std::vector outStrGimmick; - dlg.getSelected(outStrGimmick, m_attrDicomTags,true,""); + std::vector outFileNames; + dlg.getSelected(outStrGimmick, m_attrDicomTags, outFileNames,true,""); m_results.clear(); int size=(int)outStrGimmick.size(); int ii; -- 2.45.1