]> Creatis software - creaContours.git/blobdiff - lib/Interface_Icons_NDimensions/interfMainPanel.cxx
no message
[creaContours.git] / lib / Interface_Icons_NDimensions / interfMainPanel.cxx
index cca064646a7ad5b550606c77b4eba06f27bd2af4..c1179ebc2b43ef97db6898fd80178767d046bf42 100644 (file)
@@ -1,15 +1,5 @@
 #include "interfMainPanel.h"
 
-/*
-#include "interfNewContourMenu.h"
-#include "interfIOMenu.h"
-#include "interfEditMenu.h"
-#include "interfDeleteMenu.h"
-#include "interfToolsMenu.h"
-#include "interfToolsSpreadPanel.h"
-#include "interfMenuBar.h"
-#include "interfSegmentationMenu.h"
-*/
 
 interfMainPanel* interfMainPanel::interfmainpanel=NULL;
 wxFrame* interfMainPanel::_newframe=NULL;
@@ -18,23 +8,28 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH
 : wxPanel(parent, -1, wxDefaultPosition, wxSize(sizex, sizey), wxBORDER_SUNKEN)
 {
 
-       PANEL                   = "New Contour";
-       PANEL1                  = "I/O";
-       PANEL2                  = "Edit";
-       PANEL3                  = "Delete";
-       PANEL4                  = "Tools";  
-       PANEL5                  = "Segmentation";
-       segmentPanel            = NULL;
-       segmentPanelITK         = NULL;
-       configPanel             = NULL;
-       spreadPanel             = NULL;
-       infoWin                 = NULL;
-       infoPanel               = NULL;
-       infoPanelMask           = NULL;
-       informationPanel        = NULL;
-       mirrorPanel             = NULL;
-       thresholdPanel          = NULL;
-       currentWindow           = NULL;
+       PANEL                                   = "New Contour";
+       PANEL1                                  = "I/O";
+       PANEL2                                  = "Edit";
+       PANEL3                                  = "Delete";
+       PANEL4                                  = "Contour Tools";
+       PANEL5                                  = "Segmentation";
+//EED 07/07/2010
+       PANEL6                                  = "Image Tools";
+
+       segmentPanel                    = NULL;
+       segmentPanelITK                 = NULL;
+       configPanel                             = NULL;
+       spreadPanel                             = NULL;
+       infoWin                                 = NULL;
+       infoPanel                               = NULL;
+       infoPanelMask                   = NULL;
+       informationPanel                = NULL;
+       mirrorPanel                             = NULL;
+       thresholdPanel                  = NULL;
+       colorImageLayerPanel    = NULL;
+       currentWindow                   = NULL;
+       testPanel                               = NULL;
 
 //CMRU 17-08-09 ------------------------------------------------------------------
        infoPanelCalibration = NULL;
@@ -45,9 +40,9 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH
        splitterwindow->SetMinimumPaneSize( 10 );
        sizey = sizey/8;
 
-       wxPanel* toolpanel = new wxPanel(splitterwindow, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
+       wxPanel* toolpanel = new wxPanel(splitterwindow, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_DOUBLE, wxString(_T("")));
 
-       wxFlexGridSizer* flexsizer = new wxFlexGridSizer(6,2,1,1);      
+       wxFlexGridSizer* flexsizer = new wxFlexGridSizer(6,2,1,1);
        toolpanel->SetSizer(flexsizer, true);
        toolpanel->SetAutoLayout( true );
 
@@ -63,6 +58,10 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH
        b4->SetClientData(&PANEL4);
        wxButton* b5 = getButton(toolpanel);
        b5->SetClientData(&PANEL5);
+//EED 07/07/2010
+       wxButton* b6 = getButton(toolpanel);
+       b6->SetClientData(&PANEL6);
+
 
        wxPanel* mentex  = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
        wxPanel* mentex1 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
@@ -70,50 +69,58 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH
        wxPanel* mentex3 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
        wxPanel* mentex4 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
        wxPanel* mentex5 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
-       
-       menubar  = new interfNewContourMenu  (mentex,  sizex, sizey, evtHandler, datadir);              
-       menubar1 = new interfIOMenu          (mentex1, sizex, sizey, evtHandler, datadir);      
-       menubar2 = new interfEditMenu        (mentex2, sizex, sizey, evtHandler, datadir);      
-       menubar3 = new interfDeleteMenu      (mentex3, sizex, sizey, evtHandler, datadir);      
+//EED 07/07/2010
+       wxPanel* mentex6 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T("")));
+
+       menubar  = new interfNewContourMenu  (mentex,  sizex, sizey, evtHandler, datadir);
+       menubar1 = new interfIOMenu          (mentex1, sizex, sizey, evtHandler, datadir);
+       menubar2 = new interfEditMenu        (mentex2, sizex, sizey, evtHandler, datadir);
+       menubar3 = new interfDeleteMenu      (mentex3, sizex, sizey, evtHandler, datadir);
        menubar4 = new interfToolsMenu       (mentex4, sizex ,sizey, evtHandler, datadir);
        menubar5 = new interfSegmentationMenu(mentex5, sizex, sizey, evtHandler, datadir);
-               
-       statictext  = getText(mentex,  PANEL);  
-       statictext1 = getText(mentex1, PANEL1); 
-       statictext2 = getText(mentex2, PANEL2); 
-       statictext3 = getText(mentex3, PANEL3); 
-       statictext4 = getText(mentex4, PANEL4); 
-       statictext5 = getText(mentex5, PANEL5); 
-       
+       menubar6 = new interfImageToolsMenu(mentex6, sizex, sizey, evtHandler, datadir);
+
+       statictext  = getText(mentex,  PANEL);
+       statictext1 = getText(mentex1, PANEL1);
+       statictext2 = getText(mentex2, PANEL2);
+       statictext3 = getText(mentex3, PANEL3);
+       statictext4 = getText(mentex4, PANEL4);
+       statictext5 = getText(mentex5, PANEL5);
+       statictext6 = getText(mentex6, PANEL6);
+
        flexsizer->Add(b, wxFIXED_MINSIZE);
        flexsizer->Add(setMenuTextSizer(mentex, menubar,statictext), wxFIXED_MINSIZE);
 
        flexsizer->Add(b1, wxFIXED_MINSIZE);
        flexsizer->Add(setMenuTextSizer(mentex1, menubar1,statictext1), wxFIXED_MINSIZE);
-       
+
        flexsizer->Add(b2, wxFIXED_MINSIZE);
        flexsizer->Add(setMenuTextSizer(mentex2, menubar2,statictext2), wxFIXED_MINSIZE);
-       
+
        flexsizer->Add(b3, wxFIXED_MINSIZE);
        flexsizer->Add(setMenuTextSizer(mentex3, menubar3,statictext3), wxFIXED_MINSIZE);
-       
+
        flexsizer->Add(b4, wxFIXED_MINSIZE);
        flexsizer->Add(setMenuTextSizer(mentex4, menubar4,statictext4), wxFIXED_MINSIZE);
 
        flexsizer->Add(b5, wxFIXED_MINSIZE);
        flexsizer->Add(setMenuTextSizer(mentex5, menubar5,statictext5), wxFIXED_MINSIZE);
+       flexsizer->Add(b6, wxFIXED_MINSIZE);
+       flexsizer->Add(setMenuTextSizer(mentex6, menubar6,statictext6), wxFIXED_MINSIZE);
 
        toolpanel->Update();
        toolpanel->Layout();
 
-       infoPanel = new wxPanel(splitterwindow, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
-       wxFlexGridSizer* infosizer = new wxFlexGridSizer(1,1,2,2);      
+       infoPanel = new wxPanel(splitterwindow, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_DOUBLE, wxString(_T("")));
+       wxFlexGridSizer* infosizer = new wxFlexGridSizer(1,1,2,2);
        infoPanel->SetSizer(infosizer, true);
-       infoPanel->SetAutoLayout( true );       
+       infoPanel->SetAutoLayout( true );
 
        splitterwindow->Initialize(toolpanel);
        splitterwindow->SetSashGravity(1);
-       splitterwindow->SplitHorizontally(toolpanel, infoPanel);        
+//EED  splitterwindow->SetSashPosition(600);
+       splitterwindow->SetSashSize(5);
+       splitterwindow->SplitHorizontally(toolpanel, infoPanel,8*73);
 
        Connect(b->GetId(),  wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
        Connect(b1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
@@ -121,6 +128,7 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH
        Connect(b3->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
        Connect(b4->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
        Connect(b5->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
+       Connect(b6->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1);
 
        this->Layout();
 }
@@ -133,7 +141,7 @@ interfMainPanel::~interfMainPanel(void)
 interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, std::string datadir, wxEvtHandler * evtHandler)
 {
        _newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(350,900),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT);
-                                                                                                                                                               
+
        if(interfmainpanel == NULL){
                interfmainpanel = new interfMainPanel(_newframe, 350, 900, evtHandler, datadir);
        }
@@ -142,7 +150,7 @@ interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, std::string data
 }
 
 interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, wxEvtHandler * evtHandler)
-{      
+{
 
        _newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(350,900),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT );
 
@@ -159,7 +167,7 @@ bool interfMainPanel::Show(bool show)
 }
 
 interfMainPanel* interfMainPanel::getInstance()
-{      
+{
        return interfmainpanel;
 }
 
@@ -192,7 +200,7 @@ wxPanel* interfMainPanel::initializeToolsPanel(wxWindow* parent, int sizex, int
 /**
 **     Adds a new checkbox to the scrolledwindow using the checkboxsizer
 **     @Params id of contour
-**     
+**
 **/
 void interfMainPanel::addContourCheckBox(std::string id)
 {
@@ -202,7 +210,7 @@ void interfMainPanel::addContourCheckBox(std::string id)
 /**
 **     Removes a checkbox from the list of checkboxes in the flexsizer (checkboxsizer)
 **     @Params id of contour
-**     
+**
 **/
 void interfMainPanel::removeContourCheckBox(std::string id)
 {
@@ -222,7 +230,7 @@ void interfMainPanel::onActionButtonPressed1( wxCommandEvent& event )
                dmenu = menubar;
                text = statictext;
        }else if(dstring.compare(PANEL1)==0 ){
-               dmenu = menubar1;       
+               dmenu = menubar1;
                text = statictext1;
        }else if(dstring.compare(PANEL2)==0){
                dmenu = menubar2;
@@ -236,6 +244,9 @@ void interfMainPanel::onActionButtonPressed1( wxCommandEvent& event )
        }else if(dstring.compare(PANEL5)==0){
                dmenu = menubar5;
                text = statictext5;
+       }else if(dstring.compare(PANEL6)==0){
+               dmenu = menubar6;
+               text = statictext6;
        }
 
        if(wxStrcmp(b->GetLabel(),_T("+"))==0 ){
@@ -243,35 +254,35 @@ void interfMainPanel::onActionButtonPressed1( wxCommandEvent& event )
                sizechange = 1;
                b->SetLabel(_T("-"));
        }else{
-               dmenu->Show(false);             
+               dmenu->Show(false);
                sizechange = -1;
                b->SetLabel(_T("+"));
-       }       
-       
-       sizechange *= dmenu->GetSize().GetHeight();
+       }
+
+       sizechange *= (dmenu->GetSize().GetHeight()-10);
        splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()+sizechange);
-       
+
        this->Layout();
        this->Refresh();
 }
 
 wxStaticText* interfMainPanel::getText(wxWindow* parent, std::string nom)
 {
-       return new wxStaticText(parent, -1, wxString(nom.c_str(),wxConvUTF8), wxDefaultPosition, 
+       return new wxStaticText(parent, -1, wxString(nom.c_str(),wxConvUTF8), wxDefaultPosition,
                                        wxDefaultSize, wxALIGN_CENTRE, wxString(nom.c_str(),wxConvUTF8));
 }
 
 wxButton* interfMainPanel::getButton(wxWindow* parent)
 {
-       wxButton* b = new wxButton(parent, -1, wxString(_T("-")), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, 
-                                       wxDefaultValidator, wxString(_T("-"))); 
+       wxButton* b = new wxButton(parent, -1, wxString(_T("-")), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT,
+                                       wxDefaultValidator, wxString(_T("-")));
        return b;
 }
 
 wxPanel* interfMainPanel::setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxStaticText* text)
 {
 
-       wxFlexGridSizer* flexsizer = new wxFlexGridSizer(2,1,2,2);      
+       wxFlexGridSizer* flexsizer = new wxFlexGridSizer(2,1,2,2);
        parent->SetSizer(flexsizer, true);
        parent->SetAutoLayout( true );
 
@@ -283,7 +294,7 @@ wxPanel* interfMainPanel::setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxS
 }
 
 /**
-**     Shows the panel in the 
+**     Shows the panel in the
 **/
 void interfMainPanel::showPanel(wxWindow* panel)
 {
@@ -293,7 +304,7 @@ void interfMainPanel::showPanel(wxWindow* panel)
        if(currentWindow != NULL){
                currentWindow->Hide();
                sizer->Remove(currentWindow);
-       }       
+       }
        sizer->Add(panel);
        currentWindow = panel;
        currentWindow->Show(true);
@@ -372,6 +383,14 @@ void interfMainPanel::onCreateContourPoints( )
 }
 // RaC 09-09 ---------------------
 
+// RaC 10-09 ---------------------
+void interfMainPanel::onCreateContourPolygon( )
+{
+       wxContourMainFrame::getInstance()->showAxis(false);
+    wxContourMainFrame::getInstance()->onCreateContourPolygon();
+}
+// RaC 10-09 ---------------------
+
 void interfMainPanel::onCreateContoursBullEye(wxPanel* panBull)
 {
        wxContourMainFrame::getInstance()->showAxis(false);
@@ -426,6 +445,32 @@ void interfMainPanel::onSave()
        wxContourMainFrame::getInstance()->onSave();
 }
 
+void interfMainPanel::onImport(){
+       wxContourMainFrame::getInstance()->onImport();
+}
+
+void interfMainPanel::onTest(){
+       if(testPanel==NULL)
+       {
+               testPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition,
+                       wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
+               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
+               testPanel->SetSizer(flexsizer, true);
+               testPanel->SetAutoLayout( true );
+               panelTest = new interfTestPanel(testPanel);
+
+               wxStaticText* stattext = new wxStaticText(mirrorPanel,  -1,
+                       wxString(_T("   Test Panel   ")),
+                       wxDefaultPosition, wxDefaultSize,
+                       wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
+
+               flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
+               flexsizer->Add(panelTest, wxEXPAND);
+               testPanel->Layout();
+               showPanel(testPanel);
+       }
+}
+
 void interfMainPanel::RefreshInterface()
 {
        wxContourMainFrame::getInstance()->RefreshInterface();
@@ -463,21 +508,21 @@ void interfMainPanel::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int
 }
 
 void interfMainPanel::setLabelSegmentationPanelVTK(wxString tmpString)
-{      
+{
     ((interfSegmentationPanelVTK*)segmentationPanel)->setLabel(tmpString);
 }
 void interfMainPanel::onSegmentationPressed()
 {
        if(segmentPanel == NULL){
                segmentPanel = new wxPanel(getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
-               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);    
+               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
                segmentPanel->SetSizer(flexsizer, true);
-               segmentPanel->SetAutoLayout(true);      
+               segmentPanel->SetAutoLayout(true);
                segmentPanel->SetEventHandler(this);
-               
+
                //wxPanel* panel = contourevent->getSegmentationPanel(segmentPanel);
                segmentationPanel = new interfSegmentationPanelVTK(segmentPanel);
-       
+
 
                wxStaticText* stattext = new wxStaticText(segmentPanel, -1, wxString(_T("   Automatic Segmentation   ")), wxDefaultPosition,
                        wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
@@ -495,16 +540,16 @@ void interfMainPanel::onSegmentationPressedITK()
 {
     if(segmentPanelITK == NULL){
                segmentPanelITK = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
-                       
 
-               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);    
+
+               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
                segmentPanelITK->SetSizer(flexsizer, true);
-               segmentPanelITK->SetAutoLayout( true ); 
+               segmentPanelITK->SetAutoLayout( true );
                //segmentPanelITK->SetEventHandler(this->contourevent);
-               
+
                //wxPanel* panel = contourevent->getSegmentationPanelITK(segmentPanelITK);
                wxPanel* panel = new interfSegmentationPanelITK(segmentPanelITK);
-       
+
                wxStaticText* stattext = new wxStaticText(segmentPanelITK, -1, wxString(_T("   Automatic ITK Segmentation   ")), wxDefaultPosition,
                        wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
 
@@ -523,7 +568,7 @@ void interfMainPanel::onRigidPressed()
 }
 
 void interfMainPanel::onWidthOfContour(double width)
-{    
+{
        wxContourMainFrame::getInstance()->onWidthOfContour(width);
 }
 
@@ -550,9 +595,9 @@ void interfMainPanel::onConfigurationPressed()
 {
        if(configPanel == NULL){
                configPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
-               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);    
+               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
                configPanel->SetSizer(flexsizer, true);
-               configPanel->SetAutoLayout( true );     
+               configPanel->SetAutoLayout( true );
                //configPanel->SetEventHandler(this->contourevent);
                wxPanel* panel = new interfConfigurationPanel(configPanel);
                wxStaticText* stattext = new wxStaticText(configPanel, -1, wxString(_T("   Interface Configuration   ")), wxDefaultPosition,
@@ -569,14 +614,14 @@ void interfMainPanel::onSpreadPressed()
     if(spreadPanel==NULL){
 
                spreadPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
-               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);    
+               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
                spreadPanel->SetSizer(flexsizer, true);
-               spreadPanel->SetAutoLayout( true );     
+               spreadPanel->SetAutoLayout( true );
                //spreadPanel->SetEventHandler(this->contourevent);
-               
+
                //wxPanel* panel = contourevent->getSpreadPanel(spreadPanel);
                panelSpread = new interfSpreadPanel(spreadPanel);
-       
+
 
                wxStaticText* stattext = new wxStaticText(spreadPanel, -1, wxString(_T("   Automatic Spread   ")), wxDefaultPosition,
                        wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
@@ -584,7 +629,7 @@ void interfMainPanel::onSpreadPressed()
                flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
                flexsizer->Add(panelSpread, wxEXPAND);
                spreadPanel->Layout();
-       }       
+       }
        showPanel(spreadPanel);
        //hideAxis();
 }
@@ -599,6 +644,12 @@ void interfMainPanel::onSpreadAdd()
        wxContourMainFrame::getInstance()->onSpreadAdd();
 }
 
+void interfMainPanel::onSpreadAddAll()
+{
+       wxContourMainFrame::getInstance()->onSpreadAddAll();
+}
+
+
 void interfMainPanel::appendStringSpread(std::string val)
 {
     panelSpread->appendStringSpread(val);
@@ -616,12 +667,12 @@ void interfMainPanel::setStringSpread(std::string stringtemp)
 
 void interfMainPanel::onInformationPressed()
 {
-       
+
        // Statistics frame
        if(infoWin ==NULL){
                infoWin                 = new wxFrame (this, -1,_T("  Statistics  "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER  );
                infoWin->SetSize( wxSize(825,650) );
-               
+
                wxSize sizepanel(825,675);
                informationPanel        = new interfInformationPanel(infoWin);//contourevent->getInformationPanel(infoWin);
 
@@ -642,57 +693,57 @@ void interfMainPanel::onInformationPressed()
                        infoWin->Show(true);
                }
        }
-               
-//CMRU 29-08-09----------------------------------------------------------------------------------------------- 
+
+//CMRU 29-08-09-----------------------------------------------------------------------------------------------
        if(panelAux == NULL)
        {
                panelAux = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
-       }       
+       }
 //------------------------------------------------------------------------------------------------------------
 
        // mask view control panel
        if(infoPanelMask == NULL){
                infoPanelMask = new wxPanel(panelAux, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
-               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);    
+               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
                infoPanelMask->SetSizer(flexsizer, true);
-               infoPanelMask->SetAutoLayout( true );   
+               infoPanelMask->SetAutoLayout( true );
                //configPanel->SetEventHandler(this->contourevent);
-               wxPanel *panel = wxContourMainFrame::getInstance()->getMaskImageViewPanel( infoPanelMask );                             
+               wxPanel *panel = wxContourMainFrame::getInstance()->getMaskImageViewPanel( infoPanelMask );
                wxStaticText* stattext = new wxStaticText(infoPanelMask, -1, wxString(_T("   Mask segmentation    ")), wxDefaultPosition,
                                                                                                  wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
-               
+
                flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
-               
+
                flexsizer->Add(panel, wxEXPAND);
                infoPanelMask->Layout();
-               
+
        }
-       
+
 //CMRU 29-08-09-----------------------------------------------------------------------------------------------
        //Calibration panel
        if(infoPanelCalibration == NULL)
        {
                infoPanelCalibration = new wxPanel(panelAux, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER , wxString(_T("")));
-               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);    
+               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
                infoPanelCalibration->SetSizer(flexsizer, true);
-               infoPanelCalibration->SetAutoLayout( true );    
+               infoPanelCalibration->SetAutoLayout( true );
 
                wxPanel *panel = new interfCalibrationPanel(infoPanelCalibration);
                wxStaticText* stattext = new wxStaticText(infoPanelCalibration, -1, wxString(_T("              Calibration               ")), wxDefaultPosition,
                                                                                                  wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
-               
+
                flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
-               
+
                flexsizer->Add(panel, wxEXPAND);
                infoPanelCalibration->Layout();
        }
 
        wxFlexGridSizer* sizer = new wxFlexGridSizer(1);
        panelAux->SetSizer(sizer, true);
-       panelAux->SetAutoLayout( true );        
+       panelAux->SetAutoLayout( true );
        sizer->Add(infoPanelMask);
        sizer->Add(infoPanelCalibration);
-       
+
        showPanel(panelAux);
 
 //------------------------------------------------------------------
@@ -747,10 +798,15 @@ void interfMainPanel::setColLableInfoPanel(int tmpIntB,wxString tmpTitleString)
 
 }
 
-void interfMainPanel::onSaveResults(std::string directory,std::string namefile, std::string filename, 
+void interfMainPanel::SetScalarRange(int grayRangeMin,int grayRangeMax)
+{
+       wxContourMainFrame::getInstance()->SetScalarRange(grayRangeMin, grayRangeMax);
+}
+
+void interfMainPanel::onSaveResults(std::string directory,std::string namefile, std::string filename,
                                                                        int typeContourGroup, int selection, int minZ, int maxZ ,bool XYZValues, bool contourImage, bool statistics)
 {
-       wxContourMainFrame::getInstance()->onSaveResults(directory, namefile, filename, 
+       wxContourMainFrame::getInstance()->onSaveResults(directory, namefile, filename,
                typeContourGroup, selection, minZ,maxZ, XYZValues, contourImage, statistics);
 }
 
@@ -770,11 +826,11 @@ void interfMainPanel::onMirrorPressed(){
        {
 
                mirrorPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
-               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);    
+               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
                mirrorPanel->SetSizer(flexsizer, true);
-               mirrorPanel->SetAutoLayout( true );     
+               mirrorPanel->SetAutoLayout( true );
                panelMirror = new interfMirrorPanel(mirrorPanel);
-       
+
                wxStaticText* stattext = new wxStaticText(mirrorPanel, -1, wxString(_T("   Mirroring Tool   ")), wxDefaultPosition,
                        wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
 
@@ -784,7 +840,7 @@ void interfMainPanel::onMirrorPressed(){
 
                refLineShown=true;
                wxContourMainFrame::getInstance()->referenceLine();
-       }       
+       }
 
        else
        {
@@ -827,28 +883,43 @@ void interfMainPanel::onMirrorChangeWidth(int width)
        wxContourMainFrame::getInstance()->refLineChangeWidth(width);
 }
 
-
+//EED 07/07/2010
+void interfMainPanel::onColorLayerImagePressed()
+{
+       // Color Image Layer  view control panel
+       if(colorImageLayerPanel == NULL){
+               colorImageLayerPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
+               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
+               colorImageLayerPanel->SetSizer(flexsizer, true);
+               colorImageLayerPanel->SetAutoLayout( true );
+               //configPanel->SetEventHandler(this->contourevent);
+               wxPanel *panel = wxContourMainFrame::getInstance()->getColorLayerImageViewPanel( colorImageLayerPanel );
+               wxStaticText* stattext = new wxStaticText(colorImageLayerPanel, -1, wxString(_T("   Color Image Layer     ")), wxDefaultPosition,
+                                                                                                 wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
+               flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
+               flexsizer->Add(panel, wxEXPAND);
+               colorImageLayerPanel->Layout();
+       }
+       showPanel(colorImageLayerPanel);
+       wxContourMainFrame::getInstance()->changeInstant();
+}
 
 //EED01
 void interfMainPanel::onThresholdPressed()
 {
-       
        // Threshold view control panel
        if(thresholdPanel == NULL){
                thresholdPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER, wxString(_T("")));
-               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);    
+               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);
                thresholdPanel->SetSizer(flexsizer, true);
-               thresholdPanel->SetAutoLayout( true );  
+               thresholdPanel->SetAutoLayout( true );
                //configPanel->SetEventHandler(this->contourevent);
-               wxPanel *panel = wxContourMainFrame::getInstance()->getThresholdImageViewPanel( thresholdPanel );                               
+               wxPanel *panel = wxContourMainFrame::getInstance()->getThresholdImageViewPanel( thresholdPanel );
                wxStaticText* stattext = new wxStaticText(thresholdPanel, -1, wxString(_T("   Threshold segmentation    ")), wxDefaultPosition,
                                                                                                  wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
-               
                flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
-               
                flexsizer->Add(panel, wxEXPAND);
                thresholdPanel->Layout();
-               
        }
        showPanel(thresholdPanel);
        wxContourMainFrame::getInstance()->changeInstant();
@@ -867,7 +938,7 @@ void interfMainPanel::SetContourGroup(int contourGroup)
 }
 
 //CMRU 17-08-09 ---------------------------------------------
-void interfMainPanel::onPrintLabel () 
+void interfMainPanel::onPrintLabel ()
 {
        wxString label;
        manualBaseModel* manualModel = wxContourMainFrame::getInstance()->getContour();
@@ -880,10 +951,10 @@ void interfMainPanel::onPrintLabel ()
        }
 
        wxTextEntryDialog* dialog = new wxTextEntryDialog(this,_T("Enter a tag name: ")) ;
-       
+
        if (dialog->ShowModal() == wxID_OK)
        {
-               label = dialog->GetValue(); 
+               label = dialog->GetValue();
 
                if(label.Len()!=0)
                {
@@ -902,15 +973,15 @@ void interfMainPanel::onPrintLabel ()
 void interfMainPanel::onCalibration(wxString size, int unit)
 {
        int type = 0;
-       double contourSize = 0.0; 
+       double contourSize = 0.0;
        double realSizeDouble = 0.0;
 
-       type = wxContourMainFrame::getInstance()->getType(); 
+       type = wxContourMainFrame::getInstance()->getType();
        contourSize = wxContourMainFrame::getInstance()->getContourSizeInPixels();
 
        std::cout<<"Cata->TamaƱo del contorno en pixeles:"<<contourSize<<endl;
-       
-       if ( type == 6 ) 
+
+       if ( type == 6 )
        {
                if (size.ToDouble(&realSizeDouble))
                {
@@ -922,27 +993,27 @@ void interfMainPanel::onCalibration(wxString size, int unit)
                        {
                                realSizeDouble = realSizeDouble * 25.4;
                        }
-                       std::cout<< "Valor del usuario" << realSizeDouble<< endl ; 
+                       std::cout<< "Valor del usuario" << realSizeDouble<< endl ;
                        onePixelSize (realSizeDouble,contourSize);
                 }
                 else
                 {
                        wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please enter a numeric value"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
                        dial->ShowModal();
-                }              
+                }
        }
-       else 
+       else
        {
                wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please select a line contour"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
                dial->ShowModal();
        }
-       
+
        wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("The calibration was made"), wxT("Information"), wxOK | wxICON_INFORMATION);
        dial->ShowModal();
        std::cout<< "Cata-> Se ha realizado la calibracion" << endl ;
 }
 
-double interfMainPanel::onePixelSize (double realSize,double sizePixel) 
+double interfMainPanel::onePixelSize (double realSize,double sizePixel)
 {
        _pixelValue = realSize/sizePixel;
        std::cout<< "Valor del un pixel = " << _pixelValue<< endl ;