X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FInterface_Icons_NDimensions%2FinterfMainPanel.cxx;h=83da40fc269afdd5f346003d8d53ba907185ceaf;hb=2ca0ae039a31c7aec93da7aadc5fa5e983e08045;hp=4f75c89106ed1713e3d62410da764d71ddcaf666;hpb=022ea4ddf8cd8a991cc9060f3c13e51af6bc226e;p=creaContours.git diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx index 4f75c89..83da40f 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx @@ -1,15 +1,30 @@ +/*# --------------------------------------------------------------------- +# +# 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 "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; @@ -17,31 +32,47 @@ wxFrame* interfMainPanel::_newframe=NULL; interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtHandler * evtHandler, std::string datadir) : 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; - 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; + flipPanel = NULL; + +//CMRU 17-08-09 ------------------------------------------------------------------ + infoPanelCalibration = NULL; + panelAux = NULL; +//-------------------------------------------------------------------------------- splitterwindow = new wxSplitterWindow(this,-1, wxDefaultPosition, wxSize(sizex, sizey), wxSP_3DSASH, wxString(_T(""))); 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); +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 + wxFlexGridSizer* flexsizer = new wxFlexGridSizer(6,2,1,1); +#else + wxFlexGridSizer* flexsizer = new wxFlexGridSizer(6); +#endif toolpanel->SetSizer(flexsizer, true); toolpanel->SetAutoLayout( true ); @@ -57,102 +88,115 @@ 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* mentex = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T(""))); wxPanel* mentex1 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T(""))); wxPanel* mentex2 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T(""))); 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); - 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); - +//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); + 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); - - Connect(b->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1); +//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); Connect(b2->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&interfMainPanel::onActionButtonPressed1); 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(); } interfMainPanel::~interfMainPanel(void) { + } -interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, std::string datadir, wxEvtHandler * evtHandler){ +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); - _newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(350,850),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT); - - if(interfmainpanel == NULL){ - interfmainpanel = new interfMainPanel(_newframe, 350, 850, evtHandler, datadir); + interfmainpanel = new interfMainPanel(_newframe, 350, 900, evtHandler, datadir); } - _newframe->Show(TRUE); return interfmainpanel; } -interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, wxEvtHandler * evtHandler){ +interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, wxEvtHandler * evtHandler) +{ - _newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(350,850),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT ); + _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, 850, evtHandler); + interfmainpanel = new interfMainPanel(_newframe, 350, 900, evtHandler); } - _newframe->Show(TRUE); return interfmainpanel; } -bool interfMainPanel::Show(bool show){ + +bool interfMainPanel::Show(bool show) +{ return _newframe->Show(show); } -interfMainPanel* interfMainPanel::getInstance() -{ +interfMainPanel* interfMainPanel::getInstance() +{ return interfmainpanel; } @@ -163,9 +207,8 @@ void interfMainPanel :: resetInstance() interfmainpanel = NULL; } -wxPanel* interfMainPanel::initializeToolsPanel(wxWindow* parent, int sizex, int sizey, wxEvtHandler * evtHandler){ - - +wxPanel* interfMainPanel::initializeToolsPanel(wxWindow* parent, int sizex, int sizey, wxEvtHandler * evtHandler) +{ wxPanel* panel = new wxPanel(parent, -1, wxDefaultPosition, wxSize(sizex, sizey), wxBORDER_SUNKEN, wxString(_T("Spread"))); wxFlexGridSizer* flexsizer = new wxFlexGridSizer(2,1,2,2) ; @@ -177,33 +220,34 @@ wxPanel* interfMainPanel::initializeToolsPanel(wxWindow* parent, int sizex, int flexsizer->Add(menu, wxFIXED_MINSIZE); flexsizer->Add(toolspread, wxFIXED_MINSIZE); - - panel->Layout(); - + + panel->Layout(); return panel; } - /** ** Adds a new checkbox to the scrolledwindow using the checkboxsizer ** @Params id of contour -** +** **/ -void interfMainPanel::addContourCheckBox(std::string id){ +void interfMainPanel::addContourCheckBox(std::string id) +{ toolspread->addContourCheckBox(id); } /** ** Removes a checkbox from the list of checkboxes in the flexsizer (checkboxsizer) ** @Params id of contour -** +** **/ -void interfMainPanel::removeContourCheckBox(std::string id){ +void interfMainPanel::removeContourCheckBox(std::string id) +{ toolspread->removeContourCheckBox(id); } -void interfMainPanel::onActionButtonPressed1( wxCommandEvent& event ){ +void interfMainPanel::onActionButtonPressed1( wxCommandEvent& event ) +{ //((interfToolsMenu*)menubar4)->hideAxis(); wxButton* b = (wxButton*)event.GetEventObject(); wxPanel* dmenu; @@ -211,12 +255,11 @@ void interfMainPanel::onActionButtonPressed1( wxCommandEvent& event ){ std::string dstring = *((std::string*) b->GetClientData()); int sizechange=0; - if(dstring.compare(PANEL)==0){ dmenu = menubar; text = statictext; }else if(dstring.compare(PANEL1)==0 ){ - dmenu = menubar1; + dmenu = menubar1; text = statictext1; }else if(dstring.compare(PANEL2)==0){ dmenu = menubar2; @@ -230,6 +273,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 ){ @@ -237,32 +283,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, - wxDefaultSize, wxALIGN_CENTRE, wxString(nom.c_str(),wxConvUTF8)); +wxStaticText* interfMainPanel::getText(wxWindow* parent, std::string nom) +{ + 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* interfMainPanel::getButton(wxWindow* parent) +{ + 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){ +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 ); @@ -271,11 +320,10 @@ wxPanel* interfMainPanel::setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxS parent->Layout(); return (wxPanel*)parent; - } /** -** Shows the panel in the +** Shows the panel in the **/ void interfMainPanel::showPanel(wxWindow* panel) { @@ -284,10 +332,17 @@ void interfMainPanel::showPanel(wxWindow* panel) if(currentWindow != NULL){ currentWindow->Hide(); + /// \TODO fix warning: virtual bool wxSizer::Remove(wxWindow*) is deprecated +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 sizer->Remove(currentWindow); - } +#else + sizer->Detach(currentWindow); +#endif + + } sizer->Add(panel); - currentWindow = panel; + currentWindow = panel; currentWindow->Show(true); splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()+1); @@ -302,17 +357,25 @@ void interfMainPanel::showPanel(wxWindow* panel) /** ** Hide the panel in the lower box **/ -void interfMainPanel::hidePanel( ){ +void interfMainPanel::hidePanel( ) +{ wxContourMainFrame::getInstance()->showAxis(false); wxSizer* sizer = infoPanel->GetSizer(); if(currentWindow != NULL){ currentWindow->Hide(); + /// \TODO fix warning: virtual bool wxSizer::Remove(wxWindow*) is deprecated +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 sizer->Remove(currentWindow); +#else + sizer->Detach(currentWindow); +#endif + } wxPanel * emptyPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T(""))); sizer->Add(emptyPanel); - currentWindow = emptyPanel; + currentWindow = emptyPanel; currentWindow->Show(true); splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()+1); @@ -327,66 +390,138 @@ void interfMainPanel::hidePanel( ){ /** ** Gets the Information panel **/ -wxPanel* interfMainPanel::getInfoPanel(){ +wxPanel* interfMainPanel::getInfoPanel() +{ return infoPanel; } -void interfMainPanel::onCreateContourSpline( ){ +void interfMainPanel::onCreateContourSpline( ) +{ wxContourMainFrame::getInstance()->showAxis(false); wxContourMainFrame::getInstance()->onCreateContourSpline(); } -void interfMainPanel::onCreateContourRectangle( ){ + +void interfMainPanel::onCreateContourRectangle( ) +{ wxContourMainFrame::getInstance()->showAxis(false); wxContourMainFrame::getInstance()->onCreateContourRectangle(); } -void interfMainPanel::onCreateContourCircle( ){ +void interfMainPanel::onCreateContourCircle( ) +{ wxContourMainFrame::getInstance()->showAxis(false); wxContourMainFrame::getInstance()->onCreateContourCircle(); } -void interfMainPanel::onCreateContourLine( ){ + +void interfMainPanel::onCreateContourLine( ) +{ wxContourMainFrame::getInstance()->showAxis(false); wxContourMainFrame::getInstance()->onCreateContourLine(); } -void interfMainPanel::onCreateContoursBullEye(wxPanel* panBull){ + +// RaC 09-09 --------------------- +void interfMainPanel::onCreateContourPoints( ) +{ + wxContourMainFrame::getInstance()->showAxis(false); + wxContourMainFrame::getInstance()->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); wxContourMainFrame::getInstance()->onCreateContourBullEye(panBull); } -void interfMainPanel::onDeleteContour(){ + +void interfMainPanel::onDeleteContour() +{ wxContourMainFrame::getInstance()->showAxis(false); wxContourMainFrame::getInstance()->onDeleteContour(); } -void interfMainPanel::onDeleteContoursActSlice(){ + +void interfMainPanel::onDeleteContoursActSlice() +{ wxContourMainFrame::getInstance()->showAxis(false); wxContourMainFrame::getInstance()->onDeleteContoursActSlice(); } -void interfMainPanel::onDeleteAllContours(){ + +void interfMainPanel::onDeleteAllContours() +{ wxContourMainFrame::getInstance()->showAxis(false); wxContourMainFrame::getInstance()->onDeleteAllContours(); } -void interfMainPanel::onCopy(){ +void interfMainPanel::onCopy() +{ wxContourMainFrame::getInstance()->onCopy(); } -void interfMainPanel::onPaste(){ + +void interfMainPanel::onPaste() +{ wxContourMainFrame::getInstance()->onPaste(); } -void interfMainPanel::onUndo(){ + +void interfMainPanel::onUndo() +{ wxContourMainFrame::getInstance()->onUndo(); } -void interfMainPanel::onRedo(){ + +void interfMainPanel::onRedo() +{ wxContourMainFrame::getInstance()->onRedo(); } -void interfMainPanel::onLoad(){ + +void interfMainPanel::onLoad() +{ wxContourMainFrame::getInstance()->onLoad(); } -void interfMainPanel::onSave(){ - wxContourMainFrame::getInstance()-> onSave(); + +void interfMainPanel::onSave() +{ + wxContourMainFrame::getInstance()->onSave(); } -void interfMainPanel::RefreshInterface(){ + +void interfMainPanel::onImport() +{ + wxContourMainFrame::getInstance()->onImport(); +} + +void interfMainPanel::onTest() +{ + printf("EED interfMainPanel::onTest \n"); + 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(testPanel, -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(); } -vtkImageData* interfMainPanel::getImageData(){ +vtkImageData* interfMainPanel::getImageData() +{ return wxContourMainFrame::getInstance()->getImageData(); } @@ -401,36 +536,37 @@ void interfMainPanel::onSegmentationOneSlice(int isovalue,int sampling,int metho wxContourMainFrame::getInstance()->onSegmentationOneSlice(isovalue, sampling, method); } -void interfMainPanel::onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation){ +void interfMainPanel::onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation) +{ wxContourMainFrame::getInstance()->onSegmentationOneSliceITK(distance, sigma, alfa, beta, propagation, iterations, inflation); } -int interfMainPanel::GetImageDataSizeZ(){ +int interfMainPanel::GetImageDataSizeZ() +{ return wxContourMainFrame::getInstance()->GetImageDataSizeZ(); } -void interfMainPanel::GetImageDataRange(double *range){ - wxContourMainFrame::getInstance()->GetImageDataRange(range); -} - -void interfMainPanel::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method){ +void interfMainPanel::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method) +{ wxContourMainFrame::getInstance()->onSegmentationAllSlice(minZ, maxZ,isovalue,sampling,method); } -void interfMainPanel::setLabelSegmentationPanelVTK(wxString tmpString){ +void interfMainPanel::setLabelSegmentationPanelVTK(wxString tmpString) +{ ((interfSegmentationPanelVTK*)segmentationPanel)->setLabel(tmpString); } -void interfMainPanel::onSegmentationPressed(){ +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(""))); @@ -444,19 +580,19 @@ void interfMainPanel::onSegmentationPressed(){ axisshown = true; } -void interfMainPanel::onSegmentationPressedITK(){ +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(""))); @@ -470,21 +606,26 @@ void interfMainPanel::onSegmentationPressedITK(){ axisshown = true; } -void interfMainPanel::onRigidPressed(){ +void interfMainPanel::onRigidPressed() +{ wxContourMainFrame::getInstance()->onRigidPressed(); } -void interfMainPanel::onWidthOfContour(double width){ +void interfMainPanel::onWidthOfContour(double width) +{ wxContourMainFrame::getInstance()->onWidthOfContour(width); } -int interfMainPanel::getColorWindow(){ +int interfMainPanel::getColorWindow() +{ return wxContourMainFrame::getInstance()->getColorWindow(); } -int interfMainPanel::getWindowLevel(){ +int interfMainPanel::getWindowLevel() +{ return wxContourMainFrame::getInstance()->getWindowLevel(); } -void interfMainPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel){ +void interfMainPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel) +{ wxContourMainFrame::getInstance()->onBrigthnessColorWindowLevel(colorwindow, windowlevel); } @@ -493,41 +634,38 @@ void interfMainPanel::onInterpolation(bool interpolate) wxContourMainFrame::getInstance()->onInterpolation(interpolate); } -void interfMainPanel::onConfigurationPressed(){ +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, wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T(""))); - flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE); - flexsizer->Add(panel, wxEXPAND); configPanel->Layout(); - } showPanel(configPanel); } -void interfMainPanel::onSpreadPressed(){ +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(""))); @@ -535,47 +673,60 @@ void interfMainPanel::onSpreadPressed(){ flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE); flexsizer->Add(panelSpread, wxEXPAND); spreadPanel->Layout(); - } + } showPanel(spreadPanel); //hideAxis(); } -void interfMainPanel::resetAppend(){ +void interfMainPanel::resetAppend() +{ wxContourMainFrame::getInstance()->resetAppend(); } -void interfMainPanel::onSpreadAdd(){ +void interfMainPanel::onSpreadAdd() +{ wxContourMainFrame::getInstance()->onSpreadAdd(); } -void interfMainPanel::appendStringSpread(std::string val){ +void interfMainPanel::onSpreadAddAll() +{ + wxContourMainFrame::getInstance()->onSpreadAddAll(); +} + + +void interfMainPanel::appendStringSpread(std::string val) +{ panelSpread->appendStringSpread(val); } -void interfMainPanel::onSpreadGo(int type){ +void interfMainPanel::onSpreadGo(int type) +{ wxContourMainFrame::getInstance()->onSpreadGo(type); } -void interfMainPanel::setStringSpread(std::string stringtemp){ + +void interfMainPanel::setStringSpread(std::string stringtemp) +{ panelSpread->setStringSpread(stringtemp); } -void interfMainPanel::onInformationPressed(){ +void interfMainPanel::onInformationPressed() +{ + + // Statistics frame if(infoWin ==NULL){ - infoWin = new wxFrame (this, -1,_T(" Spread "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER ); - infoWin->SetSize( wxSize(500,450) ); - - wxSize sizepanel(200,300); - informationPanel = new interfInformationPanel(infoWin);//contourevent->getInformationPanel(infoWin); + 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); - wxBoxSizer * sizerPanel = new wxBoxSizer(wxHORIZONTAL); - sizerPanel -> Add( informationPanel , 1, wxEXPAND ,0); + wxBoxSizer * sizerPanel = new wxBoxSizer(wxHORIZONTAL); + sizerPanel -> Add( informationPanel, 1, wxEXPAND ,0); infoWin->SetSizer( sizerPanel ); infoWin->SetAutoLayout( true ); infoWin->Layout(); - infoWin->Show(); - }else { if (infoWin->IsShown()==true) @@ -585,50 +736,122 @@ void interfMainPanel::onInformationPressed(){ //contourevent->FillGridWithContoursInformation(); infoWin->Show(true); } - } + } + +//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); + infoPanelMask->SetSizer(flexsizer, true); + infoPanelMask->SetAutoLayout( true ); + //configPanel->SetEventHandler(this->contourevent); + 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); + infoPanelCalibration->SetSizer(flexsizer, 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 ); + sizer->Add(infoPanelMask); + sizer->Add(infoPanelCalibration); + + showPanel(panelAux); + +//------------------------------------------------------------------ + + wxContourMainFrame::getInstance()->changeInstant(); } -void interfMainPanel::getInstantVector(std::vector& tempVector){ +void interfMainPanel::getInstantVector(std::vector& tempVector) +{ wxContourMainFrame::getInstance()->getInstantVector(tempVector); } -std::vector interfMainPanel::getOutlinesName(int slide){ +std::vector interfMainPanel::getOutlinesName(int slide) +{ return wxContourMainFrame::getInstance()->getOutlinesName(slide); } -void interfMainPanel::onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ){ - wxContourMainFrame::getInstance()->onInformationContourLabels(typeContourGroup, selection, minZ, maxZ); +void interfMainPanel::onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ,int grayRangeMin,int grayRangeMax){ + wxContourMainFrame::getInstance()->onInformationContourLabels(typeContourGroup, selection, minZ, maxZ,grayRangeMin,grayRangeMax); } -void interfMainPanel::setStringInfoPanel(wxString tmpString){ +void interfMainPanel::setStringInfoPanel(wxString tmpString) +{ if(informationPanel!=NULL){ ((interfInformationPanel*)informationPanel)->setStringInfoPanel(tmpString); } } -void interfMainPanel::setRowLabelInfoPanel(int z, wxString tempString){ +void interfMainPanel::setRowLabelInfoPanel(int z, wxString tempString) +{ ((interfInformationPanel*)informationPanel)->setRowLabelInfoPanel(z, tempString); } -int interfMainPanel::getNumberColsInformationPanel(){ +int interfMainPanel::getNumberColsInformationPanel() +{ return ((interfInformationPanel*)informationPanel)->getNumberCols(); } -void interfMainPanel::appendColsInformationPanel(int _numberOfVariablesStatistics){ +void interfMainPanel::appendColsInformationPanel(int _numberOfVariablesStatistics) +{ ((interfInformationPanel*)informationPanel)->appendCols(_numberOfVariablesStatistics); } -void interfMainPanel::setCellValueInfoPanel(int z,int tmpIntA,wxString tempString){ +void interfMainPanel::setCellValueInfoPanel(int z,int tmpIntA,wxString tempString) +{ ((interfInformationPanel*)informationPanel)->setCellValue(z, tmpIntA, tempString); } -void interfMainPanel::setColLableInfoPanel(int tmpIntB,wxString tmpTitleString){ +void interfMainPanel::setColLableInfoPanel(int tmpIntB,wxString tmpTitleString) +{ ((interfInformationPanel*)informationPanel)->setColLabel(tmpIntB, tmpTitleString); } -void interfMainPanel::onSaveResults(std::string directory,std::string namefile, std::string filename, int typeContourGroup){ - wxContourMainFrame::getInstance()->onSaveResults(directory, namefile,filename, typeContourGroup); +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, + typeContourGroup, selection, minZ,maxZ, XYZValues, contourImage, statistics); } wxString interfMainPanel::getCellValue(int j,int i){ @@ -639,7 +862,7 @@ void interfMainPanel::onSnakePressed() { axisshown=false; wxContourMainFrame::getInstance()->showAxis(axisshown); - wxContourMainFrame::getInstance()->onSnakePressed(); + wxContourMainFrame::getInstance()->onSnakePressed(); } void interfMainPanel::onMirrorPressed(){ @@ -647,11 +870,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(""))); @@ -661,7 +884,7 @@ void interfMainPanel::onMirrorPressed(){ refLineShown=true; wxContourMainFrame::getInstance()->referenceLine(); - } + } else { @@ -704,56 +927,178 @@ void interfMainPanel::onMirrorChangeWidth(int width) wxContourMainFrame::getInstance()->refLineChangeWidth(width); } - -void interfMainPanel::onThreshold() +//EED 07/07/2010 +void interfMainPanel::onColorLayerImagePressed() { - wxContourMainFrame::getInstance()->onThreshold(); + // 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(); } -void interfMainPanel::onThresholdChange() +//EED01 +void interfMainPanel::onThresholdPressed() { - wxContourMainFrame::getInstance()->onThresholdChange(); + // 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); + thresholdPanel->SetSizer(flexsizer, true); + thresholdPanel->SetAutoLayout( true ); + //configPanel->SetEventHandler(this->contourevent); + 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(); } -void interfMainPanel::onThresholdInstantChange(double range[]) + +void interfMainPanel::ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ) { - panelThreshold->onThresholdInstantChange(range); + wxContourMainFrame::getInstance()->ShowResultImages(typeContourGroup, selection, minZ, maxZ); } -void interfMainPanel::onThresholdInterpolation(bool interpolate) + +void interfMainPanel::SetContourGroup(int contourGroup) { - wxContourMainFrame::getInstance()->onThresholdInterpolation(interpolate); + wxContourMainFrame::getInstance()->SetContourGroup( contourGroup); } -void interfMainPanel::onThresholdChangeOpacity (int opacity) + +void interfMainPanel::onFlipContours() { - wxContourMainFrame::getInstance()->onThresholdChangeOpacity(opacity); + printf("EED interfMainPanel::onFlipContours() \n"); + if(flipPanel==NULL) + { + flipPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, + wxDefaultSize, wxBORDER_STATIC, wxString(_T(""))); + wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1); + flipPanel->SetSizer(flexsizer, true); + flipPanel->SetAutoLayout( true ); + panelFlip = new interfFlipPanel(flipPanel); + wxStaticText* stattext = new wxStaticText(flipPanel, -1, + wxString(_T(" Flip Contours ")), + wxDefaultPosition, wxDefaultSize, + wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T(""))); + flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE); + flexsizer->Add(panelFlip, wxEXPAND); + flipPanel->Layout(); + } + showPanel(flipPanel); } -void interfMainPanel::onThresholdRemove() + +void interfMainPanel::FlipContours(int typeContourFlip, int flipDirection) { - wxContourMainFrame::getInstance()->onThresholdRemove(); + printf("EED interfMainPanel::FlipContours( %d , %d ) \n",typeContourFlip, flipDirection ); + wxContourMainFrame::getInstance()->FlipContours( typeContourFlip , flipDirection ); } -void interfMainPanel::onThresholdPressed() + + +//CMRU 17-08-09 --------------------------------------------- +void interfMainPanel::onPrintLabel () { - if(thresholdPanel==NULL) + wxString label; + manualBaseModel* manualModel = wxContourMainFrame::getInstance()->getContour(); + + if(manualModel==NULL) { + wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please select a Contour"), wxT("Warning"), wxOK | wxICON_EXCLAMATION); + dial->ShowModal(); + return; + } - thresholdPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T(""))); - wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1); - thresholdPanel->SetSizer(flexsizer, true); - thresholdPanel->SetAutoLayout( true ); - panelThreshold = new interfThresholdPanel(thresholdPanel); - - wxStaticText* stattext = new wxStaticText(thresholdPanel, -1, wxString(_T(" Threshold Tool ")), wxDefaultPosition, - wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T(""))); + wxTextEntryDialog* dialog = new wxTextEntryDialog(this,_T("Enter a tag name: ")) ; - flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE); - flexsizer->Add(panelThreshold, wxEXPAND); - thresholdPanel->Layout(); + if (dialog->ShowModal() == wxID_OK) + { + label = dialog->GetValue(); - } - showPanel(thresholdPanel); + if(label.Len()!=0) + { + wxContourMainFrame::getInstance()->onPrintLabel(label,manualModel); + wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("The tag name was updated"), wxT("Information"), wxOK | wxICON_INFORMATION); + dial->ShowModal(); + } + else + { + wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please enter a valid tag"), wxT("Warning"), wxOK | wxICON_EXCLAMATION); + dial->ShowModal(); + } + } +} + +void interfMainPanel::onCalibration(wxString size, int unit) +{ + int type = 0; + double contourSize = 0.0; + double realSizeDouble = 0.0; + + type = wxContourMainFrame::getInstance()->getType(); + contourSize = wxContourMainFrame::getInstance()->getContourSizeInPixels(); + + std::cout<<"Cata->Tama�o del contorno en pixeles:"<ShowModal(); + } + } + 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) +{ + _pixelValue = realSize/sizePixel; + std::cout<< "Valor del un pixel = " << _pixelValue<< endl ; + wxContourMainFrame::getInstance()->onePixelSize (_pixelValue); + return _pixelValue ; } +double interfMainPanel::GetPixelValue() +{ + return _pixelValue; +} +//------------------------------------------------------------------------------------------------------------