]> Creatis software - creaMaracasVisu.git/commitdiff
#2855 creaMaracasVisu Bug New Normal - ColorLayer box spacing size not identified
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Fri, 26 Feb 2016 11:30:25 +0000 (12:30 +0100)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Fri, 26 Feb 2016 11:30:25 +0000 (12:30 +0100)
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h

index b0fd0bb8a0155e23e363cd362da8855d70ade338..7763924fdad8c41fcf58465913689da140dc1997 100644 (file)
@@ -31,7 +31,7 @@
 
 #include "ColorLayerImageViewPanel.h"
 #include "OpenImageDialog.h"
-
+#include <wx/string.h>
 
 //---------------------------------------------------------
 //---------------------------------------------------------
@@ -46,9 +46,17 @@ wxDlgTransformByDimensionBySpacingByPixel::~wxDlgTransformByDimensionBySpacingBy
 }
 
 
-void wxDlgTransformByDimensionBySpacingByPixel::GetTransformType(wxWindow *parent , wxString message,int &typeOfTransformation,bool &dlgWxOK)
+void wxDlgTransformByDimensionBySpacingByPixel::GetTransformType(
+                                                                       wxWindow *parent , 
+                                                                       double baseSpc[3],
+                                                                       double layerSpc[3],
+                                                                       int baseDim[3],
+                                                                       int layerDim[3],
+                                                                       wxString message,
+                                                                       int &typeOfTransformation,
+                                                                       bool &dlgWxOK)
 {
-       wxDialog* dial                          = new wxDialog (parent,-1,_T("Tools"),wxDefaultPosition, wxSize(590,190));
+       wxDialog* dial                  = new wxDialog (parent,-1,_T("Tools"),wxDefaultPosition, wxSize(500,550),wxRESIZE_BORDER);
        wxSizer* buttonsSizer   = dial->CreateSeparatedButtonSizer(wxOK|wxCANCEL);
        wxBoxSizer *dialSizer   = new wxBoxSizer(wxVERTICAL);
 
@@ -56,24 +64,43 @@ void wxDlgTransformByDimensionBySpacingByPixel::GetTransformType(wxWindow *paren
        lstOptOperation[0]=_T("By Dimension");
        lstOptOperation[1]=_T("By Spacing");
        lstOptOperation[2]=_T("By Pixel");
-       wxRadioBox * radioOpts = new wxRadioBox(dial, -1, _T("Type of Transformation"), wxDefaultPosition, wxSize(270,45), 3 , lstOptOperation,  3, wxRA_SPECIFY_COLS);
-
-       dialSizer->Add( new wxStaticText(dial,-1,message)  , 0, wxGROW );
-       dialSizer->Add( new wxStaticText(dial,-1,_T(" "))  , 0, wxGROW );
+       wxRadioBox * radioOpts = new wxRadioBox(dial, -1, _T("Type of Transformation"), wxDefaultPosition, wxSize(250,90), 3 , lstOptOperation,  3, wxRA_SPECIFY_COLS);
+
+       wxString str;
+       wxString strBaseSpc(str);
+       wxString strLayerSpc;
+       wxString strBaseDim;
+       wxString strLayerDim;
+
+       strBaseSpc.Printf(wxT("Base spacing: %f %f %f"), baseSpc[0],baseSpc[1],baseSpc[2] );
+       strLayerSpc.Printf(wxT("Layer spacing: %f %f %f"), layerSpc[0],layerSpc[1],layerSpc[2] );
+       strBaseDim.Printf(wxT("Base dimension: %d %d %d"), baseDim[0],baseDim[1],baseDim[2] );
+       strLayerDim.Printf(wxT("Layer dimension: %d %d %d"), layerDim[0],layerDim[1],layerDim[2] );
+
+       dialSizer->Add( new wxStaticText(dial,-1,message                )       , 0, wxGROW );
+       dialSizer->Add( new wxStaticText(dial,-1,_T(" ")                )       , 0, wxGROW );
+       dialSizer->Add( new wxStaticText(dial,-1, strBaseSpc    )       , 0, wxGROW );
+       dialSizer->Add( new wxStaticText(dial,-1, strLayerSpc   )       , 0, wxGROW );
+       dialSizer->Add( new wxStaticText(dial,-1,_T(" ")                )       , 0, wxGROW );
+       dialSizer->Add( new wxStaticText(dial,-1, strBaseDim    )       , 0, wxGROW );
+       dialSizer->Add( new wxStaticText(dial,-1, strLayerDim   )       , 0, wxGROW );
+       dialSizer->Add( new wxStaticText(dial,-1,_T(" ")                )       , 0, wxGROW );
+       dialSizer->Add( new wxStaticText(dial,-1,message                )       , 0, wxGROW );
+       dialSizer->Add( new wxStaticText(dial,-1,_T(" ")                )       , 0, wxGROW );
        dialSizer->Add(radioOpts,0,wxGROW);
-       dialSizer->Add( new wxStaticText(dial,-1,_T(" "))  , 0, wxGROW );
+       dialSizer->Add( new wxStaticText(dial,-1,_T(" ")                )       , 0, wxGROW );
        dialSizer->Add(buttonsSizer,0,wxGROW);
        dial->SetSizer(dialSizer, true);
        dial->Layout();
        dial->ShowModal();
 
        typeOfTransformation    = -1;
-       dlgWxOK                 = false;
+       dlgWxOK                                 = false;
 
        if (dial->GetReturnCode() == wxID_OK)
        {
                typeOfTransformation    = radioOpts->GetSelection() + 1;
-               dlgWxOK                 = true;
+               dlgWxOK                                 = true;
        }
 }
 
@@ -281,27 +308,27 @@ void ColorLayerImageViewPanel::SetImage(vtkImageData *img)
              (dim[0]!=_dimBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2])
             )
         {
-         // CM
-         int typeOfTransformation;     
-         // In case of the option is set to create a dialog box.
-         if (_fitting_mode == -1)
-         {
-               bool transformOkDlg;
-           wxString msg = _T("The image resolution of both images are not compatible. Do you want to tranform it? ");
-           wxDlgTransformByDimensionBySpacingByPixel dlg;
-           dlg.GetTransformType(this,msg,typeOfTransformation,transformOkDlg);
-           // CM Reset the default value (Pixel i.e. 3) if the dialog box returned an inappropriate value.
-           if (transformOkDlg == false)
-               {
-               typeOfTransformation = 3;
-               } 
-          } else {
-               typeOfTransformation = _fitting_mode;
-         }
+                       // CM
+                       int typeOfTransformation;       
+                       // In case of the option is set to create a dialog box.
+                       if (_fitting_mode == -1)
+                       {
+                               bool transformOkDlg;
+                       wxString msg = _T("The image resolution of both images are not compatible. Do you want to tranform it? ");
+                       wxDlgTransformByDimensionBySpacingByPixel dlg;
+                       dlg.GetTransformType(this,spc,spc,dim,dim,msg,typeOfTransformation,transformOkDlg);
+                       // CM Reset the default value (Pixel i.e. 3) if the dialog box returned an inappropriate value.
+                       if (transformOkDlg == false)
+                               {
+                               typeOfTransformation = 3;
+                               
+                       } else {
+                       typeOfTransformation = _fitting_mode;
+                       } // _fitting_mode -1
 
 printf("EED ColorLayerImageViewPanel::SetImage %d\n", typeOfTransformation );
 
-         //EO CM
+                       //EO CM
             if (typeOfTransformation==1)  // make dimensions equals
             {
                 printf("EED ColorLayerImageViewPanel::onReadImage ...WARNNING.... dif size image spc*dim ofnew image ...???\n");
index 8853a85f215fb94683e623d93e9c72c267a19bad..cb4564f2c480af7d9b9c0b82b9e55c688176b667 100644 (file)
@@ -54,7 +54,14 @@ class wxDlgTransformByDimensionBySpacingByPixel
        public:
                wxDlgTransformByDimensionBySpacingByPixel();
                ~wxDlgTransformByDimensionBySpacingByPixel();
-               void GetTransformType(wxWindow *parent , wxString message,int &typeOfTransformation,bool &dlgWxOK) ;
+               void GetTransformType(wxWindow *parent,
+                                                                       double baseSpc[3],
+                                                                       double layerSpc[3],
+                                                                       int baseDim[3],
+                                                                       int layerDim[3],
+                                                                       wxString message,
+                                                                       int &typeOfTransformation,
+                                                                       bool &dlgWxOK) ;
        };