]> Creatis software - creaImageIO.git/blobdiff - src/creaImageIOWxSimpleDlg.cpp
#3318 creaImageIO Bug New Normal - Display buttons (Chose image box)
[creaImageIO.git] / src / creaImageIOWxSimpleDlg.cpp
index 1c076b0d4a0d0bc4fd733543fd22f1e8f6ea3a3a..226f55fafddaca2251545fc7dea6fdce75b7b1cf 100644 (file)
@@ -37,7 +37,7 @@ namespace creaImageIO
                             wxString i_title,  
                             const std::string i_namedescp , 
                             const std::string i_namedb)
-    : wxDialog(parent, -1,_T("SELECT IMAGE(S)"), wxDefaultPosition, wxSize(230,150))
+    : wxDialog(parent, -1,_T("SELECT IMAGE(S)"), wxDefaultPosition, wxSize(500,300))
    {
                namedescp       = i_namedescp; 
                namedb          = i_namedb;
@@ -47,15 +47,15 @@ namespace creaImageIO
                        this->SetTitle(i_title);  
           }
           // Button to select file(s)
-          wxButton *fileBut = new wxButton(this, -1,_T("Select a single file"), wxPoint(10,7) );
+          wxButton *fileBut = new wxButton(this, -1,_T("Select a single file"), wxPoint(10,10) );
           Connect( fileBut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxSimpleDlg::OnReadFile ); 
 
           // Button to select directory
-          wxButton *directoryBut = new wxButton(this, -1,_T("Select all the files in a directory"), wxPoint(10,40) );
+          wxButton *directoryBut = new wxButton(this, -1,_T("Select all the files in a directory"), wxPoint(10,50) );
           Connect( directoryBut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxSimpleDlg::OnReadDirectory ); 
 
           // button to select creaImageIO
-          wxButton *gimmickBut = new wxButton(this, -1,_T("Select thru Dicom browser"), wxPoint(10,70) );
+          wxButton *gimmickBut = new wxButton(this, -1,_T("Select thru Dicom browser"), wxPoint(10,90) );
           Connect( gimmickBut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxSimpleDlg::OnReadGimmick ); 
 
           /// \TODO  Button to select Bruker directory
@@ -69,7 +69,12 @@ namespace creaImageIO
          void WxSimpleDlg::OnReadFile(wxCommandEvent& event)
          {
                  int resultShowModal;
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
                  wxFileDialog* fileDlg = new wxFileDialog( 0,  _T("Select file"), _T(""), _T(""), crea::std2wx("*"), wxOPEN |wxFD_MULTIPLE, wxDefaultPosition);
+#else
+                 wxFileDialog* fileDlg = new wxFileDialog( 0,  _T("Select file"), _T(""), _T(""), crea::std2wx("*"), wxFD_OPEN |wxFD_MULTIPLE, wxDefaultPosition);
+#endif
     
                    resultShowModal = fileDlg->ShowModal();
                        if ( resultShowModal==wxID_OK )
@@ -141,7 +146,7 @@ namespace creaImageIO
                    GIMMICK_2D_IMAGE_SELECTION,
                    GIMMICK_3D_IMAGE_SELECTION,
                    _3D,
-                                  1);
+                                  0);
                 dlg.ShowModal();
                 if (dlg.GetReturnCode() == wxID_OK)
             {
@@ -155,8 +160,6 @@ namespace creaImageIO
 //                     {
                                for (ii=0;ii<size;ii++)
                                {
-                                       outStrGimmick[ii].img->Modified();
-                                       outStrGimmick[ii].img->Update();
                                        m_results.push_back(outStrGimmick[ii].img);
                                        m_resultsDicomAtr.push_back( outStrGimmick[ii].infos );
                                }
@@ -231,12 +234,14 @@ namespace creaImageIO
                                first->GetDimensions(dim);
                                if (dim[2]==1)
                                {
-                                       vtkImageData *out;
-                                       out  = vtkImageData::New();
-                                       out->SetScalarType(first->GetScalarType());
-                                       out->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents());
+                                       vtkImageData *out = vtkImageData::New();
                                        int ext[6];
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                                        first->GetWholeExtent(ext); 
+#else
+                                       first->GetExtent(ext); 
+#endif
                                        if(ext[5] == 0)
                                        {
                                           ext[5] = getImagesSelected().size()-1;
@@ -253,8 +258,18 @@ namespace creaImageIO
                                }
                                        out->SetSpacing(spac);
                                        out->SetDimensions(dim[0], dim[1], getImagesSelected().size() );
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+
+                                       out->SetScalarType(first->GetScalarType());
+                                       out->SetNumberOfScalarComponents(first->GetNumberOfScalarComponents());
                                        out->AllocateScalars();
                                        out->Update();
+#else
+                                       out->AllocateScalars(first->GetScalarType(),first->GetNumberOfScalarComponents());
+#endif
+
+
                                        unsigned long imsize = dim[0] * dim[1];
                                        imsize = imsize * dim[2];  // deal with multiframes here
                                        // differents formats char , short, etc...
@@ -268,7 +283,6 @@ namespace creaImageIO
                                                //img->Delete();
                                        } // for slice  
                                        out->Modified();
-                                       out->Update();
 //EED This is NOT working. The iteration over the pointer vtkImageData
 //                             int slice=0;
 //                             std::vector<vtkImageData*>::iterator it;
@@ -293,7 +307,6 @@ namespace creaImageIO
                } // getImagesSelected().size()!=0
 
                        result->Modified();
-                       result->Update();
                return result;
 
                }