From ffd5933600d8bad1de6ee62c305cc26a046166dd Mon Sep 17 00:00:00 2001 From: Eduardo Davila Date: Tue, 15 Feb 2011 00:11:59 +0000 Subject: [PATCH] no message --- .../wxContourGUIExample.cxx | 52 ++-- .../interfMainPanel.cxx | 224 +++++++++--------- .../interfMainPanel.h | 47 ++-- .../interfToolsPanels.cxx | 11 +- .../interfToolsPanels.h | 43 ++-- .../wxContourMainFrame.cxx | 67 +++++- .../wxContourMainFrame.h | 5 +- .../KernelManagerContour.cxx | 118 ++++----- .../KernelManagerContour.h | 14 +- .../OutlineModelManager.cxx | 154 ++++++------ 10 files changed, 401 insertions(+), 334 deletions(-) diff --git a/appli/wxContourGUIExample/wxContourGUIExample.cxx b/appli/wxContourGUIExample/wxContourGUIExample.cxx index 7232e99..4c26c64 100644 --- a/appli/wxContourGUIExample/wxContourGUIExample.cxx +++ b/appli/wxContourGUIExample/wxContourGUIExample.cxx @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------------------------------------------- // Class definition include //---------------------------------------------------------------------------------------------------------------- - + #include "wxContourGUIExample.h" #include "wxContourMainFrame.h" //#include "OutlineModelManager.h" @@ -35,24 +35,24 @@ //#include "interfMainPanel.h" -#if defined(MACOSX) // assume this is OSX +#if defined(MACOSX) // assume this is OSX # include -# include // _NSGetExecutablePath : must add -framework CoreFoundation to link line +# include // _NSGetExecutablePath : must add -framework CoreFoundation to link line # include # ifndef PATH_MAX # define PATH_MAX MAXPATHLEN # endif #endif // MACOSX */ - -#ifndef PATH_MAX // If not defined yet : do it + +#ifndef PATH_MAX // If not defined yet : do it # define PATH_MAX 2048 #endif #if defined(WIN32) #include #else - #include + #include #endif #include @@ -100,38 +100,38 @@ bool wxTheApplication :: OnInit() //EED 1Juin2010 - creaImageIO::WxSimpleDlg w(0,_T("Select your image"),"creaContours_Descriptor.dscp","creatisContours DB"); - w.ShowModal(); - + creaImageIO::WxSimpleDlg w(0,_T("Select your image"),"creaContours_Descriptor.dscp","creatisContours DB"); + w.ShowModal(); + std::vector images; //EED 1Juin2010 // creaImageIO::WxGimmickReaderDialog w(0, // -1, // "creaContours_Descriptor.dscp", -// "creatisContours DB", +// "creatisContours DB", // _T("WxGimmickDialog test"), // wxDefaultPosition,wxSize(1200,800) // ,min_image_type, // max_image_type, // output_dim, -// threads); +// threads); // w.ShowModal(); //JCP - //std::string datadir( crea::wx2std(GetExecutablePath()) ); + //std::string datadir( crea::wx2std(GetExecutablePath()) ); std::string datadir( crea::System::GetExecutablePath() ); //JCP #ifdef LINUX /* assume this is OSX */ datadir=datadir+"/../share/creaContours"; - #endif // MACOSX - + #endif // MACOSX + #ifdef MACOSX /* assume this is OSX */ datadir=datadir+"/../../../../share/creaContours"; - #endif // MACOSX - - + #endif // MACOSX + + if(w.GetReturnCode() == wxID_OK) { std::vector s; @@ -175,21 +175,21 @@ bool wxTheApplication :: OnInit() else if (w.GetReturnCode() == wxID_CANCEL) { vtkMetaImageReader *reader = vtkMetaImageReader::New(); - std::string filename= datadir + "/data/hola.mhd"; + std::string filename= datadir + "/data/hola.mhd"; infoImage=_T("DEFAULT-Image:")+crea::std2wx(filename); reader->SetFileName( filename.c_str() ); reader->Update(); images.push_back(reader->GetOutput()); } else - { + { return -1; - } + } wxFrame* frame1 = new wxFrame(NULL, wxID_ANY, wxT("Creatis- ROI Application- Evaluation version,01 Agost 2010 ")+infoImage, wxPoint(400,50), wxSize(800, 600) ); - //frame = new wxContourMainFrame( frame1, wxID_ANY, wxString(_T("")), wxPoint(50,50), wxSize(800, 600), images ); + //frame = new wxContourMainFrame( frame1, wxID_ANY, wxString(_T("")), wxPoint(50,50), wxSize(800, 600), images ); frame = wxContourMainFrame::getInstance(frame1, wxID_ANY, wxString(_T("")), wxPoint(200,50), wxSize(800, 600), images, wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,datadir ); frame1->CreateStatusBar(); frame1->Show(TRUE); @@ -198,11 +198,11 @@ bool wxTheApplication :: OnInit() } #if(WIN32) -int main(int argc, char* argv[]) - { - return WinMain(::GetModuleHandle(NULL), NULL, - ::GetCommandLine(), SW_SHOWNORMAL); - } +int main(int argc, char* argv[]) + { + return WinMain(::GetModuleHandle(NULL), NULL, + ::GetCommandLine(), SW_SHOWNORMAL); + } #else #endif diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx index 1dc3745..c1179eb 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx @@ -12,10 +12,10 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH PANEL1 = "I/O"; PANEL2 = "Edit"; PANEL3 = "Delete"; - PANEL4 = "Contour Tools"; + PANEL4 = "Contour Tools"; PANEL5 = "Segmentation"; //EED 07/07/2010 - PANEL6 = "Image Tools"; + PANEL6 = "Image Tools"; segmentPanel = NULL; segmentPanelITK = NULL; @@ -42,7 +42,7 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH 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 ); @@ -71,35 +71,35 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH wxPanel* mentex5 = new wxPanel(toolpanel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(_T(""))); //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); + + 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); - + + 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); @@ -112,15 +112,15 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH toolpanel->Layout(); infoPanel = new wxPanel(splitterwindow, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_DOUBLE, wxString(_T(""))); - wxFlexGridSizer* infosizer = new wxFlexGridSizer(1,1,2,2); + wxFlexGridSizer* infosizer = new wxFlexGridSizer(1,1,2,2); infoPanel->SetSizer(infosizer, true); - infoPanel->SetAutoLayout( true ); + infoPanel->SetAutoLayout( true ); splitterwindow->Initialize(toolpanel); splitterwindow->SetSashGravity(1); //EED splitterwindow->SetSashPosition(600); splitterwindow->SetSashSize(5); - splitterwindow->SplitHorizontally(toolpanel, infoPanel,8*73); + 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); @@ -141,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); } @@ -150,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 ); @@ -167,7 +167,7 @@ bool interfMainPanel::Show(bool show) } interfMainPanel* interfMainPanel::getInstance() -{ +{ return interfmainpanel; } @@ -200,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) { @@ -210,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) { @@ -230,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; @@ -254,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()-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 ); @@ -294,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) { @@ -304,7 +304,7 @@ void interfMainPanel::showPanel(wxWindow* panel) if(currentWindow != NULL){ currentWindow->Hide(); sizer->Remove(currentWindow); - } + } sizer->Add(panel); currentWindow = panel; currentWindow->Show(true); @@ -452,23 +452,23 @@ void interfMainPanel::onImport(){ void interfMainPanel::onTest(){ if(testPanel==NULL) { - testPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, + testPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T(""))); - wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1); + wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1); testPanel->SetSizer(flexsizer, true); - testPanel->SetAutoLayout( true ); + testPanel->SetAutoLayout( true ); panelTest = new interfTestPanel(testPanel); - wxStaticText* stattext = new wxStaticText(mirrorPanel, -1, - wxString(_T(" Test Panel ")), - wxDefaultPosition, wxDefaultSize, + 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() @@ -508,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(""))); @@ -540,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(""))); @@ -568,7 +568,7 @@ void interfMainPanel::onRigidPressed() } void interfMainPanel::onWidthOfContour(double width) -{ +{ wxContourMainFrame::getInstance()->onWidthOfContour(width); } @@ -595,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, @@ -614,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(""))); @@ -629,7 +629,7 @@ void interfMainPanel::onSpreadPressed() flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE); flexsizer->Add(panelSpread, wxEXPAND); spreadPanel->Layout(); - } + } showPanel(spreadPanel); //hideAxis(); } @@ -644,6 +644,12 @@ void interfMainPanel::onSpreadAdd() wxContourMainFrame::getInstance()->onSpreadAdd(); } +void interfMainPanel::onSpreadAddAll() +{ + wxContourMainFrame::getInstance()->onSpreadAddAll(); +} + + void interfMainPanel::appendStringSpread(std::string val) { panelSpread->appendStringSpread(val); @@ -661,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); @@ -687,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); //------------------------------------------------------------------ @@ -794,13 +800,13 @@ void interfMainPanel::setColLableInfoPanel(int tmpIntB,wxString tmpTitleString) void interfMainPanel::SetScalarRange(int grayRangeMin,int grayRangeMax) { - wxContourMainFrame::getInstance()->SetScalarRange(grayRangeMin, grayRangeMax); + wxContourMainFrame::getInstance()->SetScalarRange(grayRangeMin, grayRangeMax); } -void interfMainPanel::onSaveResults(std::string directory,std::string namefile, std::string filename, +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); } @@ -820,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(""))); @@ -834,7 +840,7 @@ void interfMainPanel::onMirrorPressed(){ refLineShown=true; wxContourMainFrame::getInstance()->referenceLine(); - } + } else { @@ -883,11 +889,11 @@ 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); + wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1); colorImageLayerPanel->SetSizer(flexsizer, true); - colorImageLayerPanel->SetAutoLayout( true ); + colorImageLayerPanel->SetAutoLayout( true ); //configPanel->SetEventHandler(this->contourevent); - wxPanel *panel = wxContourMainFrame::getInstance()->getColorLayerImageViewPanel( colorImageLayerPanel ); + 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); @@ -900,20 +906,20 @@ void interfMainPanel::onColorLayerImagePressed() //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(); + thresholdPanel->Layout(); } showPanel(thresholdPanel); wxContourMainFrame::getInstance()->changeInstant(); @@ -932,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(); @@ -945,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) { @@ -967,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:"<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 ; diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.h b/lib/Interface_Icons_NDimensions/interfMainPanel.h index cea3b74..730796e 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.h +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.h @@ -30,7 +30,7 @@ class interfMainPanel : public wxPanel { public: - + interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtHandler * evtHandler, std::string datadir = "data/Icons"); ~interfMainPanel(void); @@ -54,14 +54,14 @@ public: /** ** Adds a new checkbox to the scrolledwindow using the checkboxsizer ** @Params id of contour - ** + ** **/ void addContourCheckBox(std::string id); /** ** Removes a checkbox from the list of checkboxes in the flexsizer (checkboxsizer) ** @Params id of contour - ** + ** **/ void removeContourCheckBox(std::string id); @@ -75,12 +75,12 @@ public: void onActionButtonPressed1( wxCommandEvent& event ); /** - ** Shows the panel in the + ** Shows the panel in the **/ void showPanel(wxWindow* panel); /** - ** Hides the panel in the + ** Hides the panel in the **/ void hidePanel( ); @@ -88,14 +88,14 @@ public: ** Gets the Information panel **/ wxPanel* getInfoPanel(); - + /** ** This methods connect the event in the class interfNewContourMenu with the world of the appli **/ void onCreateContourSpline( ); void onCreateContourRectangle( ); void onCreateContourCircle( ); - void onCreateContourLine( ); + void onCreateContourLine( ); // RaC 09-09 --------------------- void onCreateContourPoints( ); // RaC 09-09 --------------------- @@ -103,7 +103,7 @@ public: // RaC 10-09 --------------------- void onCreateContourPolygon( ); // RaC 10-09 --------------------- - + void onCreateContoursBullEye(wxPanel* panBull); ///////////////////////////////// void onDeleteContour(); @@ -148,6 +148,7 @@ public: void onConfigurationPressed(); void resetAppend(); void onSpreadAdd(); + void onSpreadAddAll(); void appendStringSpread(std::string val); void onSpreadGo(int type); void setStringSpread(std::string stringtemp); @@ -155,7 +156,7 @@ public: void getInstantVector(std::vector& tempVector); std::vector getOutlinesName(int slide); void onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ,int grayRangeMin,int grayRangeMax); - void setStringInfoPanel(wxString tmpString); + void setStringInfoPanel(wxString tmpString); void setRowLabelInfoPanel(int z, wxString tempString); int getNumberColsInformationPanel(); void appendColsInformationPanel(int _numberOfVariablesStatistics); @@ -171,27 +172,27 @@ public: void SetContourGroup(int contourGroup); //CMRU 29-08-09----------------------------------------------------------------------------------------------- - + /** * Associates the current selected contour with a label */ void onPrintLabel(); - - + + /** * Calculates the pixel value in milimeters according to the current contour if the selected contour is a Line Contour * @param size Size in milimeters of the selected contour * @param unit Measurement unit */ void onCalibration(wxString size, int unit); - + /** * Calculate the pixel value in milimeters * @param realSize Size of the contour in milimeters * @param sizePixel Size of the contour in pixels */ double onePixelSize (double realSize,double sizePixel); - + /** * Returns the value of a pixel in milimeters */ @@ -199,7 +200,7 @@ public: //------------------------------------------------------------------------------------------------------------ private: - + static interfMainPanel* interfmainpanel; @@ -220,12 +221,12 @@ private: wxPanel* infoPanelMask; //CMRU 17-08-09 ------------------------------------------------------------------ - + /** * Panel with the calibration options */ wxPanel* infoPanelCalibration; - + /** * Panel who contains the calibration panel and the information panel mask */ @@ -234,7 +235,7 @@ private: /** * Value of a pixel in milimeters */ - double _pixelValue; + double _pixelValue; //-------------------------------------------------------------------------------- wxStaticText* statictext; @@ -261,19 +262,19 @@ private: interfSpreadPanel *panelSpread; wxWindow *infoWin; wxPanel *informationPanel; - + wxPanel *testPanel; interfTestPanel *panelTest; wxPanel *mirrorPanel; - interfMirrorPanel *panelMirror; + interfMirrorPanel *panelMirror; wxPanel *thresholdPanel; wxPanel *colorImageLayerPanel; - + bool axisshown; bool refLineShown; - + //This attribute contains the panel in charge of adding and removing the corresponding checkboxes in //list of contours interfToolsSpreadPanel* toolspread; @@ -300,7 +301,7 @@ private: **/ wxPanel* setMenuTextSizer(wxWindow* parent, wxPanel* panel, wxStaticText* text); - + }; #endif diff --git a/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx b/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx index f5f7871..aebcf21 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx @@ -103,7 +103,8 @@ interfSpreadPanel::interfSpreadPanel(wxWindow* parent) //wxPanel *panel = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxNO_BORDER, wxString("",wxConvUTF8)); wxButton *spreadResetBtn = new wxButton(this,-1,_T("Reset"),wxDefaultPosition, wxDefaultSize ); - wxButton *spreadAddBtn = new wxButton(this,-1,_T("Add"),wxDefaultPosition, wxDefaultSize); + wxButton *spreadAddBtn = new wxButton(this,-1,_T("Add key contour "),wxDefaultPosition, wxDefaultSize); + wxButton *spreadAddAllBtn = new wxButton(this,-1,_T("Add All to key contour"),wxDefaultPosition, wxDefaultSize); wxString lstOptions[3]; lstOptions[0]=_T("A"); @@ -120,11 +121,13 @@ interfSpreadPanel::interfSpreadPanel(wxWindow* parent) Connect( spreadResetBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfSpreadPanel::onSpreadReset ); Connect( spreadAddBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfSpreadPanel::onSpreadAdd ); + Connect( spreadAddAllBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfSpreadPanel::onSpreadAddAll ); Connect( spreadGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfSpreadPanel::onSpreadGo ); wxFlexGridSizer * sizer = new wxFlexGridSizer(1); sizer -> Add( spreadResetBtn , 1, wxGROW ); sizer -> Add( spreadAddBtn , 1, wxGROW ); + sizer -> Add( spreadAddAllBtn , 1, wxGROW ); sizer -> Add( _spreadMethodRadiobox , 1, wxGROW ); sizer -> Add( spreadGoBtn , 1, wxGROW ); sizer -> Add( _staticTextSpread , 1, wxGROW ); @@ -146,12 +149,16 @@ void interfSpreadPanel::onSpreadReset(wxCommandEvent& event){ _wxtextctrlSpread->SetValue(wxString("",wxConvUTF8)); interfMainPanel::getInstance()->resetAppend(); } + void interfSpreadPanel::onSpreadAdd(wxCommandEvent& event){ interfMainPanel::getInstance()->onSpreadAdd(); } -void interfSpreadPanel::onSpreadGo(wxCommandEvent& event){ +void interfSpreadPanel::onSpreadAddAll(wxCommandEvent& event){ + interfMainPanel::getInstance()->onSpreadAddAll(); +} +void interfSpreadPanel::onSpreadGo(wxCommandEvent& event){ setStringSpread(" "); int typeMethodFindCtrlPoints=_spreadMethodRadiobox->GetSelection(); printf("EED interfSpreadPanel::onSpreadGo %d\n",typeMethodFindCtrlPoints); diff --git a/lib/Interface_Icons_NDimensions/interfToolsPanels.h b/lib/Interface_Icons_NDimensions/interfToolsPanels.h index 85b05d6..afb64f6 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsPanels.h +++ b/lib/Interface_Icons_NDimensions/interfToolsPanels.h @@ -6,14 +6,14 @@ #include "mBarRange.h" #include -class interfConfigurationPanel +class interfConfigurationPanel : public wxPanel { public: - interfConfigurationPanel(wxWindow * parent); + interfConfigurationPanel(wxWindow * parent); ~interfConfigurationPanel(); - + private: @@ -23,42 +23,43 @@ private: void OnInterpolation(wxCommandEvent& event); - + wxSlider* _withOfContourLine; wxSlider* _brithtnessWindowLevel; wxSlider* _brithtnessColorLevel; - wxCheckBox* _interpolationCheckBox; - + wxCheckBox* _interpolationCheckBox; + }; class interfSpreadPanel : public wxPanel { public: - interfSpreadPanel(wxWindow * parent); + interfSpreadPanel(wxWindow * parent); ~interfSpreadPanel(); void appendStringSpread(std::string val); void setStringSpread(std::string stringtemp); private: - wxRadioBox* _spreadMethodRadiobox; - wxStaticText* _staticTextSpread; - wxTextCtrl* _wxtextctrlSpread; + wxRadioBox *_spreadMethodRadiobox; + wxStaticText *_staticTextSpread; + wxTextCtrl *_wxtextctrlSpread; void onSpreadReset(wxCommandEvent& event); void onSpreadAdd(wxCommandEvent& event); + void onSpreadAddAll(wxCommandEvent& event); void onSpreadGo(wxCommandEvent& event); - - + + }; class interfInformationPanel : public wxPanel { public: - interfInformationPanel(wxWindow * parent); + interfInformationPanel(wxWindow * parent); ~interfInformationPanel(); void setStringInfoPanel(wxString tmpString); @@ -76,9 +77,9 @@ private: wxRadioBox* _informationRadiobox; wxRadioBox* _radiolstboxContourGroup; wxStaticText* _staticTextInformation; - wxCheckBox* _XYZValues; - wxCheckBox* _contourImage; - wxCheckBox* _statistics; + wxCheckBox* _XYZValues; + wxCheckBox* _contourImage; + wxCheckBox* _statistics; void onInformationContourLabels(wxCommandEvent& event); void onExtractInformation(wxCommandEvent& event); @@ -89,8 +90,8 @@ private: void onRangeSliceInformation(wxCommandEvent& event); - - + + }; //CMRU 29-08-09----------------------------------------------------------------------------------------------- /** @@ -105,7 +106,7 @@ public: * Initialized the panel * @param parent Window who contains the panel */ - interfCalibrationPanel(wxWindow * parent); + interfCalibrationPanel(wxWindow * parent); ~interfCalibrationPanel(); @@ -128,5 +129,5 @@ private: }; //------------------------------------------------------------------------------------------------------------ #endif - - + + diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index 7017b47..0b9b009 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -835,10 +835,10 @@ void wxContourMainFrame :: createMirrorContourOf ( std::string anExistingKName, //EED04 void wxContourMainFrame ::loadState(std::string filename){ - + deleteAllContours(); onLoadContours(filename,false); - + /* EED Borrame char tmp[255]; FILE *pFile=fopen(filename.c_str(),"r+"); @@ -997,7 +997,7 @@ void wxContourMainFrame::onLoadContours(std::string fileNameContourROI, bool int openContours(pFile,pFileData,false); openContours(pFile,pFileData,true); //Load StaticContours } - + if (version=="1.0.2") { //EED001 @@ -1224,7 +1224,7 @@ void wxContourMainFrame::readDimSpc(FILE *pFile, bool interactiveOption) dial->ShowModal(); int _tmpReadFileTypeOfTransformation = -1; - bool transform = false; +//EED bool transform = false; if (dial->GetReturnCode() == wxID_OK) { @@ -2300,32 +2300,83 @@ void wxContourMainFrame::onChangeInstant(std::string name,int actual){ _instantPanel->setConceptValue( name, actual ); } + void wxContourMainFrame::resetAppend(){ kernelManager->resetAppend(); } + void wxContourMainFrame::onSpreadAdd(){ std::vector vecX; std::vector vecY; std::vector vecZ; _theViewPanel->GetPointsOfActualContour(&vecX , &vecY , &vecZ ); + std::vector tempVector; + _instantPanel->getInstant( tempVector ); + std::string val = kernelManager->onSpreadAdd(&vecX , &vecY , &vecZ, tempVector); + interfMainPanel::getInstance()->appendStringSpread(val); +} + + +void wxContourMainFrame::onSpreadAddAll(){ + printf("EED wxContourMainFrame::onSpreadAddAll \n"); +//EED02 std::vector tempVector; _instantPanel->getInstant( tempVector ); - std::string val = kernelManager->onSpreadAdd(&vecX , &vecY , &vecZ, tempVector); + int minZ,maxZ; + minZ = 0; + maxZ = interfMainPanel::getInstance()->GetImageDataSizeZ(); - interfMainPanel::getInstance()->appendStringSpread(val); + int z; + int sizeLstContourThings; + + for ( z=minZ ; z<=maxZ ; z++ ) + { + tempVector[1]=z; + Instant instant(&tempVector); + std::vector lstContourThings = kernelManager->getOutlinesAtInstant( &instant ); + sizeLstContourThings = lstContourThings.size(); + + printf("EED wxContourMainFrame::onSpreadAddAll z=%d size=%d\n",z,sizeLstContourThings); + + if (sizeLstContourThings>=1) + { + + std::vector vecX; + std::vector vecY; + std::vector vecZ; + + ContourThing **contourthing = lstContourThings[0]; + manualBaseModel *cModel = (*contourthing)->getModel(); + int i,size = cModel->GetNumberOfPointsSpline(); + double x,y,z; + for (i=0; iGetSpline_i_Point(i, &x, &y, &z); + vecX.push_back(x); + vecY.push_back(y); + vecZ.push_back(z); + } + + std::string val = kernelManager->onSpreadAdd(&vecX , &vecY , &vecZ, tempVector); + interfMainPanel::getInstance()->appendStringSpread(val); + + printf("EED wxContourMainFrame::onSpreadAddAll -> val=%s\n",val.c_str() ); + + } + + } } -void wxContourMainFrame::onSpreadGo(int type){ +void wxContourMainFrame::onSpreadGo(int type){ //JCP 20-10-08 Undo redo implementation saveState(); //JCP 20-10-08 Undo redo implementation - wxBusyCursor wait; std::vector vecCtrlPointX; std::vector vecCtrlPointY; diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h index 90361d3..c109ece 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h @@ -246,6 +246,7 @@ class wxContourMainFrame : public wxPanel { void onChangeInstant(std::string name,int actual); void resetAppend(); void onSpreadAdd(); + void onSpreadAddAll(); void onSpreadGo(int type); void getInstantVector(std::vector& tempVector); std::vector getOutlinesName(int slide); @@ -383,9 +384,9 @@ private: void saveState(); void loadState(std::string filename); - + // void loadContours( FILE *pFile, bool staticContour ); - + void saveFileWithContours( std::string filename ); void onLoadContours(std::string fileNameContourROI, bool interactiveInterface); diff --git a/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.cxx b/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.cxx index 57f9228..d189cbd 100644 --- a/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.cxx +++ b/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.cxx @@ -12,7 +12,7 @@ KernelManagerContour::KernelManagerContour(){ ** **/ inredo = 0; - inundo = 0; + inundo = 0; time_t seconds; seconds = time (NULL); @@ -42,7 +42,7 @@ KernelManagerContour::KernelManagerContour(std::vector images,std ** **/ inredo = 0; - inundo = 0; + inundo = 0; time_t seconds; seconds = time (NULL); @@ -51,7 +51,7 @@ KernelManagerContour::KernelManagerContour(std::vector images,std stundoredo = tmpdir+"/temp"+intToString(time); _currentIndex = 0; - + _contourPropagation = NULL; #if(WIN32) mkdir(tmpdir.c_str()); @@ -69,7 +69,7 @@ KernelManagerContour::KernelManagerContour(std::vector images,std } KernelManagerContour::~KernelManagerContour(){ -} +} std::vector KernelManagerContour::getVectImages(){ return vectimages; @@ -83,7 +83,7 @@ void KernelManagerContour::setVectImages(std::vector vectimg){ change->SetInputConnection(img->GetProducerPort()); change->SetOutputSpacing(1,1,1); - + change->Update(); vectimg[i] = change->GetOutput(); @@ -102,7 +102,7 @@ void KernelManagerContour::initializeEnvironment(std::string datadir){ std::map * sourcesMap = new std::map(); std::map* sectionsMap = new std::map(); std::map* axesMap = new std::map(); - std::map* outlinesMap = new std::map(); + std::map* outlinesMap = new std::map(); for(int i = 0; i < (int)(vectimages.size()); i++){ vtkImageData* selectedimage = vectimages[i]; @@ -110,11 +110,11 @@ void KernelManagerContour::initializeEnvironment(std::string datadir){ std::string imgstring = "Source Image "+intToString(i+1); sourcesMap->insert(std::pair( imgstring, thing)); } - + OutlineModelBuilder * _builder = new OutlineModelBuilder( conceptsFN ,datadir); _builder->buildImageSource_Envornment( imageSourcesFN, sourcesMap ); - _builder->buildImageSection_Envornment( imageSectionsFN, sectionsMap ); + _builder->buildImageSection_Envornment( imageSectionsFN, sectionsMap ); _builder->buildAxe_Envornment(axeThingsFN, axesMap ); _builder->buildCountour_Envornment( imageSectionsFN, outlinesMap ); @@ -144,7 +144,7 @@ std::string KernelManagerContour::intToString(int num){ while (k > 0){ char temp = k % 10 + 48; k = k / 10; - result = temp + result; + result = temp + result; } } return result; @@ -208,7 +208,9 @@ std::string KernelManagerContour::createCopyContourOf ( std::string anExistingKN { return modelManager->createCopyContourOf(anExistingKName, instantNoTouchData); } -manualBaseModel* KernelManagerContour::getOutlineByKeyName(std::string cloneName){ + +manualBaseModel* KernelManagerContour::getOutlineByKeyName(std::string cloneName) +{ return modelManager->getOutlineByKeyName (cloneName )->getModel(); } @@ -216,16 +218,16 @@ bool KernelManagerContour::onRedo(std::string& filename){ if(inredo > 0){ inredo--; inundo++; - std::string str = intToString(inundo); - filename = stundoredo + str + ".roi"; - //loadState(temp); + std::string str = intToString(inundo); + filename = stundoredo + str + ".roi"; + //loadState(temp); return true; } return false; } bool KernelManagerContour::onUndo(std::string& filename){ - if(inundo>0){ + if(inundo>0){ inredo++; inundo--; @@ -233,9 +235,9 @@ bool KernelManagerContour::onUndo(std::string& filename){ //itoa(inundo, str, 10); std::string str = intToString(inundo); - + filename = stundoredo + str + ".roi"; - + return true;//loadState(temp); } return false; @@ -259,7 +261,7 @@ bool KernelManagerContour::onUndoSaveFile(std::string& filename){ filename = stundoredo + str + ".roi"; return true; - //saveFileWithContours(temp); + //saveFileWithContours(temp); } } @@ -271,53 +273,55 @@ void KernelManagerContour :: changeContourOfManager(std::string keyName, Instant modelManager->ChangeContourOfList(keyName, instant); } -void KernelManagerContour ::resetAppend(){ - if(isInitContourPropagation()){ +void KernelManagerContour ::resetAppend() +{ + if (_contourPropagation!=NULL) + { _contourPropagation->resetAppend(); - } -} - -bool KernelManagerContour::isInitContourPropagation(){ - if(_contourPropagation == NULL){ - _contourPropagation = new ContourPropagation(); - }else{ - return true; } - return false; - } -std::string KernelManagerContour::onSpreadAdd( std::vector *vecX, std::vector *vecY, std::vector *vecZ, std::vector instants){ - if(isInitContourPropagation()){ - if (vecX->size()!=0){ - - int i,size=vecZ->size(); - int actualSlice = instants[1]; - for ( i=0 ; iappendContour(vecX , vecY , vecZ); - return intToString(actualSlice); - } - } +std::string KernelManagerContour::onSpreadAdd( std::vector *vecX, std::vector *vecY, std::vector *vecZ, std::vector instants) +{ + if (_contourPropagation==NULL) + { + _contourPropagation = new ContourPropagation(); + } + + if (vecX->size()!=0){ + + int i,size=vecZ->size(); + int actualSlice = instants[1]; + for ( i=0 ; iappendContour(vecX , vecY , vecZ); + return intToString(actualSlice); + } return ""; } -void KernelManagerContour::getMaxMinZ(double *minZ,double *maxZ){ - if(isInitContourPropagation()){ + +void KernelManagerContour::getMaxMinZ(double *minZ,double *maxZ) +{ + if (_contourPropagation!=NULL) + { _contourPropagation->getMaxMinZ(minZ, maxZ); } } -void KernelManagerContour::CalculeSplinePropagation(){ + + +void KernelManagerContour::CalculeSplinePropagation() +{ _contourPropagation->setInterpolationNumber(100); _contourPropagation->CalculeSplinePropagation(); } -manualBaseModel* KernelManagerContour::GetPoints(int z,int type, std::vector* vecCtrlPointX,std::vector* vecCtrlPointY,std::vector* vecCtrlPointZ, std::string& theName,int typeofcontour, std::vector tempVector){ - - +manualBaseModel* KernelManagerContour::GetPoints(int z,int type, std::vector* vecCtrlPointX,std::vector* vecCtrlPointY,std::vector* vecCtrlPointZ, std::string& theName,int typeofcontour, std::vector tempVector) +{ bool addedModel = false; manualBaseModel* manModelContour=NULL; @@ -328,9 +332,9 @@ manualBaseModel* KernelManagerContour::GetPoints(int z,int type, std::vectorFindIdWithZ(z); if (type==0) // Initial Points - { + { _contourPropagation->GetInitialControlPoints( idTmp , vecCtrlPointX,vecCtrlPointY,vecCtrlPointZ); - } + } if (type==1) // Automatique Method { _contourPropagation->GetControlPoints( idTmp ,vecCtrlPointX,vecCtrlPointY,vecCtrlPointZ); @@ -354,13 +358,13 @@ manualBaseModel* KernelManagerContour::GetPoints(int z,int type, std::vector KernelManagerContour::getOutlinesNameAtInstant(std::vec ContourThing **contourthing = vectcont[i]; vectname.push_back((*contourthing)->getName()); } - return vectname; + return vectname; } std::vector KernelManagerContour::getOutlinesAtInstant(Instant* instant ){ @@ -467,7 +471,7 @@ void KernelManagerContour::setCurrentFileName(std::string filenam){ } std::string KernelManagerContour::parseOsirixFile(std::string filename){ - + #ifdef ParserOsirix_BUILD vtkImageData* sourceimage; @@ -487,7 +491,7 @@ std::string KernelManagerContour::parseOsirixFile(std::string filename){ return p.getContoursFileName(); #else return ""; -#endif +#endif } diff --git a/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.h b/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.h index 4df96d1..6aa151f 100644 --- a/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.h +++ b/lib/kernel_ManagerContour_NDimensions/KernelManagerContour.h @@ -52,14 +52,14 @@ public: */ vtkImageData* getSourceImage(); - + void initializeEnvironment(std::string datadir); /** ** This methods connect the event in the class interfNewContourMenu with the world of the appli - **/ + **/ std::string createOutline(manualBaseModel * manModelContour,std::vector instantVector); ///////////////////////////////// @@ -89,7 +89,7 @@ public: void setInstant(Instant* theInstant); void setInstant(std::vector vectInstant); std::string createCopyContourOf ( std::string anExistingKName, std::vector &instantNoTouchData); - + Instant * getCurrentInstant(); manualBaseModel* getOutlineByKeyName(std::string cloneName); @@ -135,11 +135,11 @@ public: std::vector ExploseEachModel( std::vector lstManConMod ); - + void getConceptsInformation(std::vector& conceptNameVect, std::vector& conceptSizeVect); vtkImageData* getImageAtInstant(std::vector inst); - + //------------------------------------------------------------------------------------------------------------ // Constants //------------------------------------------------------------------------------------------------------------ @@ -148,7 +148,7 @@ public: std::string getCurrentFileName(); std::string parseOsirixFile(std::string filename); -private: +private: //------------------------------------------------------------------------------------------------------------ // Attributes //------------------------------------------------------------------------------------------------------------ @@ -170,8 +170,6 @@ private: ContourPropagation* _contourPropagation; - bool isInitContourPropagation(); - OutlineModelManager* getOutlineModelManager(); }; #endif diff --git a/lib/kernel_ManagerContour_NDimensions/OutlineModelManager.cxx b/lib/kernel_ManagerContour_NDimensions/OutlineModelManager.cxx index 6b2e68b..9dbb1db 100644 --- a/lib/kernel_ManagerContour_NDimensions/OutlineModelManager.cxx +++ b/lib/kernel_ManagerContour_NDimensions/OutlineModelManager.cxx @@ -24,11 +24,11 @@ outlinesEnvironment = contourEnv; workSpace = new ContourWorkspace(this);//implies a shared workSpace - keyGenerator = * new PrefixMaxKeyGenerator(); + keyGenerator = * new PrefixMaxKeyGenerator(); counterIdKey = 0; actualInstantWrapping = new InstantMembersNameList(); - changeSourceImage = true; + changeSourceImage = true; bool allOK = keyGenerator.addKeyThing("Axes", "Axe"); allOK &= keyGenerator.addKeyThing("Image Sources", "Image source"); @@ -45,11 +45,11 @@ clean(); delete actualInstant; delete workSpace; - delete actualInstantWrapping; + delete actualInstantWrapping; } //------------------------------------------------------------------------------------------------------------ -// Methods +// Methods //------------------------------------------------------------------------------------------------------------ @@ -65,7 +65,7 @@ /* * Sets the workSpace object - * @param aWorkSpace The workSpace to set + * @param aWorkSpace The workSpace to set */ void OutlineModelManager :: setWorkSpace( ContourWorkspace * aWorkSpace ) { @@ -117,7 +117,7 @@ { bool executedComs = executionQueue.size()>0 ? true : false; while( executionQueue.size()>0 ) - { + { CommandObject * aCmmand = executionQueue.front(); executedComs &= executeCommand(aCmmand, fromRegistration); executionQueue.pop_front(); @@ -125,9 +125,9 @@ return executedComs; } - + /* - * Sets the concepts of the environments and includes the concepts managed by the program + * Sets the concepts of the environments and includes the concepts managed by the program * @conceptsScript Is the script for with the concepts descrition * @return Returns true if successful insert of the given concepts, false otherwise */ @@ -137,45 +137,45 @@ int endSub; std::string::size_type equalIndex = conceptsScript.find("=", 0); std::string::size_type nextIndex = 0; - while( equalIndex != std::string::npos && allOK) - { + while( equalIndex != std::string::npos && allOK) + { endSub = equalIndex; - std::string concept = conceptsScript.substr( 0, endSub ); - conceptsScript.erase( 0, endSub+1 ); - std::cout << "C: " << concept <0 ) allOK &= addUserConcept(concept, intReturn); else allOK = false; - } + } return allOK; } /* - * Add a concept to all the environments + * Add a concept to all the environments * @param theConceptName Is the name of the new concept - * @param conceptSize Is the size of the concept, that represent the ammount of concept posible instances + * @param conceptSize Is the size of the concept, that represent the ammount of concept posible instances * @return Returns true if successful insert of concept, false otherwise - */ + */ bool OutlineModelManager :: addUserConcept(std::string theConceptName, int conceptSize) - { + { bool allOK = axesEnvironment->addConcept(theConceptName, conceptSize); allOK &= imagesSectionEnvironment->addConcept(theConceptName, conceptSize); allOK &= imageSourceEnvironment->addConcept(theConceptName, conceptSize); @@ -204,7 +204,7 @@ this->outlinesEnvironment->removeThingFromInstant(keyName, instant); } else { ContourThing **contourthing = staticContourLst[ispartofstaticlist]; - this->outlinesEnvironment->addInstantToThing ( keyName , instant ); + this->outlinesEnvironment->addInstantToThing ( keyName , instant ); staticContourLst.erase( staticContourLst.begin()+ispartofstaticlist ); } } @@ -256,7 +256,7 @@ std::vector kNamesVector; std::vector outlinesVector; //= new std::vector(); std::vector lstInstants = getOutlineInstants(); - int i,sizeLstInstants = lstInstants.size(); + int i,sizeLstInstants = lstInstants.size(); Instant *instant; for ( i=0 ; i OutlineModelManager :: getOutlinesFromGroup(std::string aGroupName) { std::vector outlinesVector; std::map< std::string,OutlineGroup * >::iterator iterP = outlineGroups.find(aGroupName); if ( iterP != outlineGroups.end() ) - { - std::vector kNamesVector = iterP->second->getGroupOutlinesNames(); + { + std::vector kNamesVector = iterP->second->getGroupOutlinesNames(); for(int i=0; i ( theOutlineName, theGroup )); + outlineGroups.insert(std::pair ( theOutlineName, theGroup )); // std::map :: iterator iter = NULL; std::map :: iterator iter; iter = outlineGroups.find( theOutlineName ); @@ -341,8 +341,8 @@ std::string OutlineModelManager :: createOutline(manualBaseModel * model, std::vector theInstantData, std::string aName) { ContourThing * theOutline = new ContourThing ( model ); - theOutline->setName(aName); - return addOutline( theOutline, new Instant( &theInstantData ) ); + theOutline->setName(aName); + return addOutline( theOutline, new Instant( &theInstantData ) ); } /* @@ -354,8 +354,8 @@ bool OutlineModelManager :: createAxe(std::string aDescription, Instant * theInstantData) { AxeThing * theAxe = new AxeThing (); - theAxe->setDescription(aDescription); - return addAxe(theAxe, theInstantData); + theAxe->setDescription(aDescription); + return addAxe(theAxe, theInstantData); } /* @@ -366,8 +366,8 @@ //bool OutlineModelManager :: createImageSource(std::string aSource, ImageSourceThing * &imageSource) bool OutlineModelManager :: createImageSource(std::string aSource, Instant * theInstantData) { -// imageSource = new ImageSourceThing(aSource); - //return addImageSource(new ImageSourceThing(aSource), theInstantData); +// imageSource = new ImageSourceThing(aSource); + //return addImageSource(new ImageSourceThing(aSource), theInstantData); return NULL;//*********************************************************************************************** } @@ -379,22 +379,22 @@ //bool OutlineModelManager :: createImageSection(std::string aSecImageData, ImageSectionThing * &imageSection) bool OutlineModelManager :: createImageSection(std::string aSecImageData, Instant * theInstantData) { - //imageSection = new ImageSectionThing(aSecImageData); -// return addImageSection(new ImageSectionThing(aSecImageData), theInstantData); + //imageSection = new ImageSectionThing(aSecImageData); +// return addImageSection(new ImageSectionThing(aSecImageData), theInstantData); return NULL; } /* - * Adds an outlineThing + * Adds an outlineThing * @param theOutline The outline/contour (thing) * @param theInstantData Is the instant for the outline to add * @return Returns true if the addition of the outline was successful */ std::string OutlineModelManager :: addOutline( ContourThing * theOutline, Instant * theInstantData) - { + { std::string kName; -// EED +// EED // bool added = keyGenerator.generateKeyOf("Outlines", outlinesEnvironment->getNumberOfThings(),kName); counterIdKey++; @@ -408,7 +408,7 @@ if( added ) return kName; else - return ""; + return ""; } @@ -429,11 +429,11 @@ /* - * Remove an outlineThing + * Remove an outlineThing * @param theOutline The outline/contour (thing) */ void OutlineModelManager :: removeOutline( std::string ss ) - { + { outlinesEnvironment->removeThing( ss ); } @@ -447,7 +447,7 @@ std::vector< ContourThing **> thingsVector; outlinesEnvironment->getThingsOfEnvironment( &thingsVector ); int i,sizeThingVector = thingsVector.size(); - for(i=0;igetName() ); @@ -456,7 +456,7 @@ /* - * Adds an axeThing + * Adds an axeThing * @param thaAxe The axe (thing) * @param theInstantData Is the instant for the axe to add * @return Returns true if the addition of the axe was successful @@ -464,13 +464,13 @@ bool OutlineModelManager :: addAxe( AxeThing * theAxe , Instant * theInstantData) { std::string kName; - bool added = keyGenerator.generateKeyOf("Axes", axesEnvironment->getNumberOfThings(),kName); + bool added = keyGenerator.generateKeyOf("Axes", axesEnvironment->getNumberOfThings(),kName); added &= axesEnvironment->addThingWithInstant(kName,theAxe, theInstantData); return added; } /* - * Adds an imageSourceThing + * Adds an imageSourceThing * @param imgageSource The image source (thing) * @param theInstantData Is the instant for the source to add * @return Returns true if the addition of the imageSource was successful @@ -490,7 +490,7 @@ * @return Returns true if the addition of the imageSection was successful */ bool OutlineModelManager :: addImageSection(ImageSectionThing * imageSection, Instant * theInstantData) - { + { std::string kName; bool added = keyGenerator.generateKeyOf("Image Sections", imagesSectionEnvironment->getNumberOfThings(),kName); added &= imagesSectionEnvironment->addThingWithInstant(kName, imageSection, theInstantData); @@ -521,7 +521,7 @@ actualInstantWrapping -> addOutlineName( kNamesVector[i], anOutline->getName() ); } } - + /* * Annotates the actual outline keyName-real name wrapping at the actual instant * @param actualKeyOutline The key name to annotate @@ -550,17 +550,17 @@ void OutlineModelManager :: annotateActualSectionImageWrap(std::string actualKeyImage, std::string theRealName)//---BORRAR... { actualInstantWrapping -> setActualSectionImageNamesWrapp(actualKeyImage, theRealName); - } + } /* * Annotate the annotateActualSource image keyName-real name wrapping at the actual instant * @param actualKeyImage The key name to annotate - * @param theRealName The real name asigned to the annotateActualSource + * @param theRealName The real name asigned to the annotateActualSource */ void OutlineModelManager :: annotateActualSourceImageWrap(std::string actualKeyImage, std::string theRealName)//---BORRAR... { actualInstantWrapping -> setActualSourceImageNamesWrapp(actualKeyImage, theRealName); - } + } /* @@ -591,20 +591,20 @@ /* * Gets the instants of a specific outline * @param thekName Is the name of the outline - * @return The instants set + * @return The instants set */ std::vector OutlineModelManager :: getOutlineInstantsByName(std::string thekName) - { - return *outlinesEnvironment->getInstantsOfThing(thekName); + { + return *outlinesEnvironment->getInstantsOfThing(thekName); } /* * Gets all instants outlines - * @return The instants set + * @return The instants set */ std::vector OutlineModelManager :: getOutlineInstants() - { - return *outlinesEnvironment->getExistingInstants(); + { + return *outlinesEnvironment->getExistingInstants(); } @@ -652,7 +652,7 @@ { return imageSourceEnvironment->addInstantToThing( imaKName,anInstantData ); } - + /* * Method that retorns the name of each concept and the size of it. * @param conceptNameVect, Vector in which is disposed to be setted the name for each of the included concepts @@ -664,12 +664,12 @@ { //if (outlinesEnvironment->getNumberOfThings()>0) outlinesEnvironment->getConceptsInformation(conceptNameVect, conceptSizeVect); - } + } } /* - * Gets the contourWorspace + * Gets the contourWorspace * @return Returns the workspace */ ContourWorkspace * OutlineModelManager :: getContourWorkspace() @@ -697,10 +697,10 @@ * Update the registered objects in the InstantMemebersNameList, is the one that really changes the instant in the model */ void OutlineModelManager :: updateToActualInstant() - { + { Instant * longInstant = actualInstant; /*Instant * mediumInstant = new Instant(); - Instant * shortInstant = new Instant(); + Instant * shortInstant = new Instant(); std::vector* theInstant = longInstant->getInstant(); for(int i=1; isize(); i++) { @@ -708,14 +708,14 @@ shortInstant->addConcept( (*theInstant)[i] ); mediumInstant->addConcept( (*theInstant)[i] ); } - + //getting the sourceAtInstant std::vector kSourceVector; std::vector imSourceVector; imageSourceEnvironment->getThings(kSourceVector, imSourceVector, shortInstant); annotateActualSourceImageWrap(kSourceVector[0], (**imSourceVector[0]).getSourceImage()); - //getting the aAxeAtInstant + //getting the aAxeAtInstant std::vector kAxeVector; std::vector axesVector; axesEnvironment->getThings(kAxeVector, axesVector, mediumInstant); @@ -728,15 +728,15 @@ imagesSectionEnvironment->getThings(kSectionVector, imSectionVector, longInstant); if ( !kSectionVector.empty() ) //annotateActualSectionImageWrap(kSectionVector[0], (**imSectionVector[0]).getImageData()); */ - - //getting the outlines + + //getting the outlines std::vector vect = getOutlinesAtInstant( longInstant ); } - + /* - * Sets the automatic managed concepts including them in the environments. That are at the beginning of the instant vector for the corresponding environments. + * Sets the automatic managed concepts including them in the environments. That are at the beginning of the instant vector for the corresponding environments. * @return Returns true if successful insert of the automatic concepts, false otherwise */ bool OutlineModelManager :: setAutomaticConcepts() @@ -749,7 +749,7 @@ bool allOK = axesEnvironment->addConcept(axeConcept, axeC_size); allOK &= imagesSectionEnvironment->addConcept(axeConcept, axeC_size); allOK &= outlinesEnvironment->addConcept(axeConcept, axeC_size); - + allOK &= imagesSectionEnvironment->addConcept(axeDepthConcept, axeDepthC_size); allOK &= outlinesEnvironment->addConcept(axeDepthConcept, axeDepthC_size); /* @@ -771,9 +771,7 @@ void OutlineModelManager::SaveThingName( FILE *pFile, FILE *pFileData, std::string nameThing ) { std::vector< Instant * > *lstInstants; -printf("EED OutlineModelManager::SaveThingName %s\n",nameThing.c_str() ); lstInstants = outlinesEnvironment->getInstantsOfThing( nameThing ); -printf("EED OutlineModelManager::SaveThingName %d\n", (*lstInstants).size() ); Instant *instant = (*lstInstants)[0]; std::vector *vecInst =instant->getInstant(); int i,sizeVecInst = vecInst->size(); -- 2.45.0