]> Creatis software - creaImageIO.git/blobdiff - src/creaImageIOWxGimmickView.cpp
#3218 creaImageIO Feature New Normal - vtk8itk4wx3-mingw64
[creaImageIO.git] / src / creaImageIOWxGimmickView.cpp
index e7dcfcf63918959ff5d1291ac5620a10b0477159..0e2fa1e537a7005d5695f4f288d2a26f58d1f866 100644 (file)
@@ -1,8 +1,34 @@
-#include <creaImageIOPACSConnection.h>
+/*
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
+#                        pour la Santé)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+#  This software is governed by the CeCILL-B license under French law and 
+#  abiding by the rules of distribution of free software. You can  use, 
+#  modify and/ or redistribute the software under the terms of the CeCILL-B 
+#  license as circulated by CEA, CNRS and INRIA at the following URL 
+#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+#  or in the file LICENSE.txt.
+#
+#  As a counterpart to the access to the source code and  rights to copy,
+#  modify and redistribute granted by the license, users are provided only
+#  with a limited warranty  and the software's author,  the holder of the
+#  economic rights,  and the successive licensors  have only  limited
+#  liability. 
+#
+#  The fact that you are presently reading this means that you have had
+#  knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------
+*/
+
+
+
 #include <creaImageIOWxPACSConnectionPanel.h>
-#include <creaImageIOWxGimmickView.h>
 #include <creaImageIOWxTreeView.h>
-#include <creaImageIOSystem.h>
 #include <creaImageIOWxCustomizeConfigPanel.h>
 #include <creaImageIOWxListenerPanel.h>
 #include <creaImageIOWxEditFieldsPanel.h>
 #include <creaImageIOWxOutputDlg.h>
 #include <creaImageIOOutputModel.h>
 
+#if defined(_WIN32)
+#pragma warning(disable: 4996)
+#endif
+
 using namespace crea;
 // Icons
 #include "icons/accept.xpm"
@@ -171,10 +201,11 @@ namespace creaImageIO
     mBottomPanel->SetSizer(mbottom_sizer);
 
     // Splitting
+    /// \TODO fix warning: unused variable hsize
     int hsize = size.GetHeight();
 
-    int top_minsize = 450;
-    int bottom_minsize = 50;
+    int top_minsize    = 450;
+    int bottom_minsize         = 50;
 
     mSplitter->SetMinimumPaneSize( bottom_minsize );
     mSplitter->SplitHorizontally( mNotebook, mBottomPanel, 
@@ -327,7 +358,7 @@ namespace creaImageIO
                                        bool mult, const std::string out_model)
   {
        // First we select the files
-        std::vector<std::string> files;
+   std::vector<std::string> files;
        std::string db_name = crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()));
        GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->GetSelectedAsString(files);
 
@@ -338,6 +369,7 @@ namespace creaImageIO
        mGimmick->GetSetting(SETTINGS_OUTPUT_ASK, asking);
        mGimmick->GetSetting(SETTINGS_OUTPUT_DIM, dim);
 
+
        if (asking == "true")
        {
                // display the output dialog box
@@ -350,37 +382,35 @@ namespace creaImageIO
                        dim = dlg->getDim();
                        mGimmick->UpdateSetting(SETTINGS_OUTPUT_ASK, dlg->getAsking());
                        mGimmick->UpdateSetting(SETTINGS_OUTPUT_DIM, dim);
-               }
-               else
-               {
+               } else {
                        return;
                } 
-       }
-       else
-       {
+       } else {
        }
        sscanf(dim.c_str(),"%d",&i_dim_out);
 
-
        // Next we create the structure for dicom output infos
        OutputAttr Oattr;
+//EED 01/09/2014
+          if (i_dim_out==2)
+               {
+                       Oattr.mult=true;
+               } // i_dim_out
+
+
        Oattr.db = crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()));
        if(i_attr.empty())
        {
                // We don't send informations!
-       }
-       else if( i_attr.size() == 1 && i_attr.front() == "ALL")
+       } else if( i_attr.size() == 1 && i_attr.front() == "ALL")
        {
                // we send all database
                Oattr.inside.push_back("ALL");
-       }
-       else if( (i_attr.size() == 1 && i_attr.front() != "ALL") 
+       } else if( (i_attr.size() == 1 && i_attr.front() != "ALL") 
                || (i_attr.size() >1) )
        {
                mGimmick->fillVectInfos(i_attr, Oattr);
-       }
-       else
-       {
+       } else {
                // nothing
        }
 
@@ -474,7 +504,15 @@ namespace creaImageIO
   void WxGimmickView::OnAddFiles(wxCommandEvent& event)
   {
     mViewer->StopPlayer();
+
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
     long style = wxOPEN | wxFILE_MUST_EXIST | wxFD_MULTIPLE;
+#else
+    long style = wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE;
+#endif
+
+
     std::string wc("*");
     wxFileDialog* FD = new wxFileDialog( 0, 
                                         _T("Select file"),
@@ -590,7 +628,7 @@ namespace creaImageIO
                {
                        if (recursive) 
                        {
-                               nb += NumberFilesToAdd(itr->string(), recursive);
+                               nb += NumberFilesToAdd(itr->path().string(), recursive);
                        }
                }
                else
@@ -606,7 +644,7 @@ namespace creaImageIO
   bool WxGimmickView::isNeedRecursive(std::string i_name)
   {
       boost::filesystem::directory_iterator iter(i_name), end_iter;
-         bool bfindir = false;
+      //bool bfindir = false;
                  for(; iter != end_iter; ++iter)
                  {
                          if(boost::filesystem::is_directory(*iter))
@@ -621,9 +659,7 @@ namespace creaImageIO
   //=================================================
   void WxGimmickView::OnSelectionChange(const std::vector<tree::Node*>& sel, bool isSelection, int selection, bool needProcess)
   {      
-    GimmickDebugMessage(5,
-                       "WxGimmickView::OnSelectionChange"
-                       <<std::endl);
+       GimmickDebugMessage(5,"WxGimmickView::OnSelectionChange"<<std::endl);
     wxBusyCursor busy;
        bool valid=true;
        
@@ -632,9 +668,7 @@ namespace creaImageIO
                valid= ValidateSelected(NULL,
                                mSelectionMinDimension,
                                mSelectionMaxDimension );
-       }
-       else if(needProcess)
-       {
+       } else if(needProcess) {
                ResetExtent();
                std::vector<tree::Node*>::const_iterator i;
                for(i=sel.begin();i!=sel.end()&&valid;++i)
@@ -642,16 +676,12 @@ namespace creaImageIO
                        valid= ValidateSelected((*i),
                                mSelectionMinDimension,
                                mSelectionMaxDimension );
-               }
-       }
-       else if(isSelection)
-       {
+               } // for
+       } else if(isSelection) {
                valid= ValidateSelected(sel.front(),
                                mSelectionMinDimension,
                                mSelectionMaxDimension );
-       }
-       else
-       {
+       } else {
                ResetExtent();
                std::vector<tree::Node*>::const_iterator i;
                for(i=sel.begin();i!=sel.end()&&valid;++i)
@@ -659,18 +689,22 @@ namespace creaImageIO
                        valid= ValidateSelected((*i),
                                mSelectionMinDimension,
                                mSelectionMaxDimension );
-               }
-       }
+               } // for 
+       } // if sel.size 
        mText->SetLabel(crea::std2wx(GetMessage()));
-    /*if(valid)
-      {
-       ReadImageThreaded(sel);
-      }
-    else
-      {
-                 ClearSelection();
-      }*/
-       ReadImageThreaded(sel);
+/*
+       if(valid)
+    {
+               ReadImageThreaded(sel);
+    } else {
+               ClearSelection();
+    }
+*/
+         
+         
+//EED1 2018-08  
+//EED1 ReadImageThreaded(sel);
+
    }
 
   //==================================================
@@ -742,17 +776,15 @@ namespace creaImageIO
                RequestReading(*iterDown,prio,-1,ph);
                //              AddEntryToMap(*iterDown);
                prio--;
-               if (prio == maxprio) break;
-       }
-   }
-   else
-   {
+               if (prio == maxprio) { break; }
+       } // for
+   } else {
           pointers.clear();
           //ImagePointerHolder* ph=new ImagePointerHolder(GetDefaultImage());
           boost::shared_ptr<ImagePointerHolder> ph(new ImagePointerHolder(GetDefaultImage()));
           pointers.push_back(ph);
           mViewer->SetImageVector(pointers);
-   }
+   } // if
   }
 
   //==================================================
@@ -790,12 +822,14 @@ namespace creaImageIO
   //==================================================
    void  WxGimmickView::ClearSelection()
    {
+printf("EED WxGimmickView::ClearSelection Start\n");      
        pointers.clear();
        pointers.push_back(boost::shared_ptr<creaImageIO::ImagePointerHolder>(new ImagePointerHolder(GetDefaultImage())));
        //pointers.push_back(new ImagePointerHolder(GetDefaultImage()));
        mViewer->SetImageVector(pointers);
        mViewer->RefreshIfNecessary();
        ResetExtent();
+printf("EED WxGimmickView::ClearSelection End\n");        
   }
 
   //=================================================
@@ -1145,9 +1179,9 @@ namespace creaImageIO
   //========================================================================
   void WxGimmickView::CreateEditFieldsDialog(tree::Node* node, std::vector<std::string> names, std::vector<std::string> keys)
   {
-    wxDialogdial= new wxDialog (this,-1,crea::std2wx("Edit Fields for node "+node->GetLabel()),wxDefaultPosition, wxSize(350,155));
-    wxBoxSizer *siz = new wxBoxSizer(wxVERTICAL);
-    WxEditFieldsPanel* ef = new WxEditFieldsPanel(dial, dial, this, node, names, keys);
+    wxDialog           *dial= new wxDialog (this,-1,crea::std2wx("Edit Fields for node "+node->GetLabel()),wxDefaultPosition, wxSize(350,155));
+    wxBoxSizer         *siz = new wxBoxSizer(wxVERTICAL);
+    WxEditFieldsPanel  *ef  = new WxEditFieldsPanel(dial, dial, this, node, names, keys);
 
     siz->Add( ef,1,wxGROW  ,0); 
     dial->SetSizer(siz);