From 28671ae02163f2b674da599a98a128f58dfead88 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Tue, 10 Oct 2017 09:18:45 +0200 Subject: [PATCH] #3145 creaContours Bug New Normal - changeWx28to30 --- .../wxContourGUIExample.cxx | 113 ++-------- bbtk/src/bbCreaContournDimensions.cxx | 6 +- .../interfMainPanel.cxx | 4 +- .../wxContourMainFrame.cxx | 210 +++++------------- .../wxContourMainFrame.h | 3 +- .../wxContourViewPanel.cxx | 85 ++----- .../wxContourViewPanel.h | 30 +-- .../wxVtkBaseView_SceneManager.cxx | 31 ++- .../wxVtkBaseView_SceneManager.h | 59 +++-- 9 files changed, 143 insertions(+), 398 deletions(-) diff --git a/appli/wxContourGUIExample/wxContourGUIExample.cxx b/appli/wxContourGUIExample/wxContourGUIExample.cxx index 46c896e..72c9130 100644 --- a/appli/wxContourGUIExample/wxContourGUIExample.cxx +++ b/appli/wxContourGUIExample/wxContourGUIExample.cxx @@ -31,70 +31,34 @@ #include "wxContourMainFrame.h" //#include "OutlineModelManager.h" //#include "wxContourEventHandler.h" - //#include //#include #include - #include - #include //#include "wxContourMainPanel.h" - #include "vtkMetaImageReader.h" #include #include "vtkImageData.h" - #include "wx/artprov.h" #include - -/* EED EraseMe -//#include "OutlineModelBuilder.h" -//#include "ContourThing.h" -//#include "AxeThing.h" -//#include "ImageSourceThing.h" -//#include "ImageSectionThing.h" -//#include "SomeEnvironment.h" -//#include "ReaderEnvironment.h" - -//#include "interfMainPanel.h" - -#if defined(MACOSX) // assume this is OSX -# include -# 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 # define PATH_MAX 2048 #endif - #if defined(WIN32) #include #else #include #endif - #include - - wxContourMainFrame* wxTheApplication::frame = 0; //---------------------------------------------------------------------------------------------------------------- // This macro implements the entry point (main function) for the application //---------------------------------------------------------------------------------------------------------------- - - - - - //========================================================================= //========================================================================= IMPLEMENT_APP( wxTheApplication ); @@ -115,14 +79,11 @@ void wxAppConsole::OnAssertFailure(char const *,int,char const *,char const *,ch } #endif - - -bool wxTheApplication :: OnInit() +bool wxTheApplication::OnInit() { vtkOutputWindowCreaContour *outputWindowCreaContour= vtkOutputWindowCreaContour::New(); vtkOutputWindow::SetInstance( outputWindowCreaContour ); outputWindowCreaContour->Delete(); - wxString infoImage; wxInitAllImageHandlers(); @@ -131,7 +92,6 @@ bool wxTheApplication :: OnInit() //EED01Juin2010 int output_dim = NATIVE; //EED01Juin2010 int threads = 1; - //EED 1Juin2010 creaImageIO::WxSimpleDlg w(0,_T("Select your image"),"creaContours_Descriptor.dscp","creatisContours DB"); w.ShowModal(); @@ -150,78 +110,33 @@ bool wxTheApplication :: OnInit() // threads); // w.ShowModal(); - //JCP //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 - #ifdef MACOSX /* assume this is OSX */ datadir=datadir+"/../../../../share/creaContours"; #endif // MACOSX - - if(w.GetReturnCode() == wxID_OK) { - std::vector s; -//EED 01Juin2010 w.GetSelectedFiles(s); - - -//EED std::vector::iterator i; -// for (i=s.begin();i!=s.end();++i) -// { -// std::cout << *i << std::endl; -// } -// std::cout << "$$$$ "< out; -// std::vector attr; -//// attr.push_back("D0028_0010"); -//// attr.push_back("D0008_0023"); -//// attr.push_back("D0008_1070"); -// w.getSelected(out, attr,true,""); -//// std::cout< s; + images = w.getImagesSelected(); + infoImage = w.getInfoImage(); + } else if (w.GetReturnCode() == wxID_CANCEL) { - vtkMetaImageReader *reader = vtkMetaImageReader::New(); - 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; - } - - + vtkMetaImageReader *reader = vtkMetaImageReader::New(); + 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 = wxContourMainFrame::getInstance(frame1, wxID_ANY, wxString(_T("")), wxPoint(200,50), wxSize(800, 600), images, wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,datadir ); frame1->CreateStatusBar(); diff --git a/bbtk/src/bbCreaContournDimensions.cxx b/bbtk/src/bbCreaContournDimensions.cxx index 5a02859..143cd5e 100644 --- a/bbtk/src/bbCreaContournDimensions.cxx +++ b/bbtk/src/bbCreaContournDimensions.cxx @@ -43,14 +43,12 @@ void nDimensions::Process() vtkImageData* img = bbGetInputIn(); std::vector selectedimages; - if(img!=NULL && currentimg!=img){ - - printf("EED nDimensions::Process 02\n"); + if(img!=NULL && currentimg!=img) + { wxContourMainFrame::getInstance()->ShowToolsPanel(true); currentimg=img; selectedimages.push_back(img); wxContourMainFrame::getInstance()->setVectImages(selectedimages); - printf("EED nDimensions::Process 03\n"); } if(currentimg != NULL){ diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx index 83da40f..64fb2ee 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx @@ -26,8 +26,8 @@ #include "interfMainPanel.h" -interfMainPanel* interfMainPanel::interfmainpanel=NULL; -wxFrame* interfMainPanel::_newframe=NULL; +interfMainPanel *interfMainPanel::interfmainpanel = NULL; +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) diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index 5b5f61f..760f543 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -96,7 +96,7 @@ char wxContourMainFrame::COPY = 'C'; _viewColorLayerImagePanel = NULL; } - wxContourMainFrame :: wxContourMainFrame(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector images, long style,std::string datadir) + wxContourMainFrame::wxContourMainFrame(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector images, long style,std::string datadir) : wxPanel(parent, id, pos, size, style) { m_mgr.SetManagedWindow(this); @@ -233,17 +233,13 @@ void wxContourMainFrame::setVectImages(std::vector imgs) notebook->AddPage( _theViewPanel, wxT(" View ") ); m_mgr.Update(); } - - if( configured ) { notebook->AddPage( _instantPanel, wxT("Instant Page") ); m_mgr.Update(); } - m_mgr.AddPane(notebook, wxAuiPaneInfo().Name(wxT("notebook_content")).CenterPane().PaneBorder(false)); m_mgr.Update(); - SetMinSize(wxSize(300,300)); m_mgr.Update(); return configured; @@ -446,13 +442,15 @@ manualBaseModel * wxContourMainFrame::factoryManualContourModel(wxPanel* panel){ return manModelContour; } -void wxContourMainFrame :: saveState(){ +void wxContourMainFrame :: saveState() +{ std::string temp = kernelManager->saveState(); saveFileWithContours(temp); } -void wxContourMainFrame::onDeleteContour(){ +void wxContourMainFrame::onDeleteContour() +{ //JCP 20-10-08 Undo redo implementation saveState(); //JCP 20-10-08 Undo redo implementation @@ -513,7 +511,8 @@ void wxContourMainFrame :: deleteContours( std::vector keyNamesVec } } -void wxContourMainFrame :: deleteContour( std::string theKeyName ){ +void wxContourMainFrame :: deleteContour( std::string theKeyName ) +{ /* manualContourModel * cModel; manualViewBaseContour * cViewer; @@ -602,17 +601,20 @@ void wxContourMainFrame::deleteAllContours(){ JCP --08-09-2008 */ } -void wxContourMainFrame::setConceptValue( std::string name, int value ){ +void wxContourMainFrame::setConceptValue( std::string name, int value ) +{ _instantPanel->setConceptValue(name, value); } -ConceptDataWrap* wxContourMainFrame::getLastConceptData(){ +ConceptDataWrap* wxContourMainFrame::getLastConceptData() +{ return _instantPanel->getLastConceptData(); } -bool wxContourMainFrame::getIfConceptCheckedAt( std::string name, int pos ){ +bool wxContourMainFrame::getIfConceptCheckedAt( std::string name, int pos ) +{ return _instantPanel->getIfConceptCheckedAt( name, pos ); } @@ -655,11 +657,10 @@ void wxContourMainFrame::changeInstant() std::vector instantVect; _instantPanel->getInstant( instantVect ); int actualSlice = instantVect[1]; - kernelManager->setInstant(instantVect); - // Refresh Mask image - if(_viewMaskImage!=NULL){ + if(_viewMaskImage!=NULL) + { _viewMaskImage->SetZ(actualSlice); if (_viewMaskImagePanel->IsVisible()==true) { @@ -667,17 +668,16 @@ void wxContourMainFrame::changeInstant() getMaskValue(&mask,&value, _contourGroup , 0, -1, -1); _viewMaskImage->onThreshold(); } - } - + } // if _viewMaskImage // Refresh Threshold image - if(_viewThresholdImage!=NULL){ + if(_viewThresholdImage!=NULL) + { _viewThresholdImage->SetZ(actualSlice); - if (_viewThresholdImagePanel->IsVisible()==true){ + if (_viewThresholdImagePanel->IsVisible()==true) + { _viewThresholdImage->onThreshold(); } - } - - + } // if _viewThresholdImage updateInstantOutlines(); updateInstantImageData(); updateInstantAxes(); @@ -685,7 +685,7 @@ void wxContourMainFrame::changeInstant() -void wxContourMainFrame :: updateInstantOutlines() +void wxContourMainFrame::updateInstantOutlines() { _theViewPanel->removeSceneContours(); _theViewPanel->addNameWrapperToScene(); @@ -696,10 +696,13 @@ void wxContourMainFrame :: updateInstantOutlines() //} } -int wxContourMainFrame::getNamesWrappingSize(){ +int wxContourMainFrame::getNamesWrappingSize() +{ return kernelManager->getNamesWrappingSize(); } -std::string wxContourMainFrame::getNameWrapping(int i){ + +std::string wxContourMainFrame::getNameWrapping(int i) +{ return kernelManager->getNameWrapping(i); } @@ -731,7 +734,6 @@ void wxContourMainFrame::onChangeDeep(int val){ void wxContourMainFrame::onCopy(){ std::vector currentSelection = _theViewPanel->getSelectedObjects(); - std::vector tempVector; _instantPanel->getInstant( tempVector ); _performingOperation->reset(); @@ -740,9 +742,8 @@ void wxContourMainFrame::onCopy(){ _performingOperation->setKeyNamesOperationElems( currentSelection ); } -void wxContourMainFrame::onPaste(){ - - +void wxContourMainFrame::onPaste() +{ char theStartCommand = _performingOperation->getStartCommand(); if ( theStartCommand == COPY ) { @@ -760,7 +761,9 @@ void wxContourMainFrame::onPaste(){ } } } -void wxContourMainFrame::onUndo(){ + +void wxContourMainFrame::onUndo() +{ std::string filename; if(kernelManager->onUndoSaveFile(filename)){ saveFileWithContours(filename); @@ -829,109 +832,11 @@ void wxContourMainFrame :: createMirrorContourOf ( std::string anExistingKName, _theViewPanel->getSceneManager()->createCopyContourOf( anExistingKName, cloneName, manualModel , append ); } -//EED04 -void wxContourMainFrame ::loadState(std::string filename){ - +void wxContourMainFrame ::loadState(std::string filename) +{ deleteAllContours(); onLoadContours(filename,false); - - /* EED Borrame - char tmp[255]; - FILE *pFile=fopen(filename.c_str(),"r+"); - - fscanf(pFile,"%s",tmp); // --CreaContour-- - - fscanf(pFile,"%s",tmp); // Version - fscanf(pFile,"%s",tmp); // 1.0.3 || 1.0.2 || 1.0.1 || 1.0.0 - - deleteAllContours(); - - loadContours(pFile, false); - loadContours(pFile, true); - - fclose(pFile); - */ -} - - -//EED03 -/*EED Borrame -void wxContourMainFrame::loadContours( FILE *pFile, bool staticContour ) -{ - char tmp[255]; - - if (staticContour==false) - { - fscanf(pFile,"%s",tmp); // ImageDimensions - fscanf(pFile,"%s",tmp); // X - fscanf(pFile,"%s",tmp); // Y - fscanf(pFile,"%s",tmp); // Z - - fscanf(pFile,"%s",tmp); // ImageSpacing - fscanf(pFile,"%s",tmp); // X - fscanf(pFile,"%s",tmp); // Y - fscanf(pFile,"%s",tmp); // Z - } - - fscanf(pFile,"%s",tmp); // NumberOfContours - fscanf(pFile,"%s",tmp); // ## - int numberOfContours = atoi(tmp); - - std::vector instantVector; - int typeContourModel; - manualBaseModel *manModelContour; - int typeView; - - int i; - for (i=0;ifactoryManualContourModel(typeContourModel); - manModelContour->Open(pFile); - - fscanf(pFile,"%s",tmp); // TypeView - fscanf(pFile,"%s",tmp); // ## - typeView = atoi(tmp); - - std::string theName; - theName = kernelManager->createOutline( manModelContour, instantVector ); - bool addedModel = theName.compare("") != 0; - if( addedModel ) - { - double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default - _theViewPanel->getSpacing(spc); - //Adding the manualContourControler to interface objects structure - //Adding the manualViewContour to interface objects structure - //_theViewPanel->getSceneManager()->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active. - _theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , typeView) ; - } - - if (staticContour==true) - { - Instant instant(&instantVector); - kernelManager->changeContourOfManager( theName , &instant ); - } - }// for numberOfContours } -*/ void wxContourMainFrame::onLoad() @@ -959,10 +864,7 @@ void wxContourMainFrame::onLoad() void wxContourMainFrame::SetZForAllContours(int pz) { - printf("EED wxContourMainFrame::SetZForAllContours\n"); - //-- Normal Contours - std::vector< std::string > lstNameThings; int i,sizeLstNameThings; int ii,sizeLstPoints; @@ -1018,17 +920,10 @@ void wxContourMainFrame::onLoadContours(std::string fileNameContourROI, bool int fscanf(pFileData,"%s",tmpD); // NumberOfContours fscanf(pFileData,"%s",tmpD); // # } - fscanf(pFile,"%s",tmp); // --CreaContour-- - fscanf(pFile,"%s",tmp); // Version fscanf(pFile,"%s",tmp); // 1.0.3 || 1.0.2 || 1.0.1 || 1.0.0 std::string version(tmp); - - -printf("EED wxContourMainFrame::onLoadContours version%s \n", version.c_str() ); - - //AD:02-06-09 _tmpReadFileTypeOfTransformation=-1; if (version=="1.0.3") @@ -1037,7 +932,6 @@ printf("EED wxContourMainFrame::onLoadContours version%s \n", version.c_str() ) openContours(pFile,pFileData,false); openContours(pFile,pFileData,true); //Load StaticContours } - if (version=="1.0.2") { //EED001 @@ -1047,7 +941,6 @@ printf("EED wxContourMainFrame::onLoadContours version%s \n", version.c_str() ) openContours(pFile,pFileData,true); // Load StaticContours SetZForAllContours(-900); } - //AD:02-06-09 else if (version=="1.0.1") { @@ -1463,14 +1356,16 @@ void wxContourMainFrame::openContours( FILE *pFile, FILE *pFileData, bool static } -void wxContourMainFrame::RefreshInterface(){ +void wxContourMainFrame::RefreshInterface() +{ changeInstant(); _theViewPanel->RefreshInterface(); //wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView(); //wxvtk2dbaseview->Refresh(); } -vtkImageData* wxContourMainFrame::getImageData(){ +vtkImageData* wxContourMainFrame::getImageData() +{ return _theViewPanel->getImageData(); } @@ -2439,29 +2334,33 @@ int wxContourMainFrame::getWindowLevel() return _theViewPanel->getWindowLevel(); } -void wxContourMainFrame::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel){ +void wxContourMainFrame::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel) +{ _theViewPanel->onBrigthnessColorWindowLevel(colorwindow, windowlevel); RefreshInterface(); } -void wxContourMainFrame::onInterpolation(bool interpolate){ +void wxContourMainFrame::onInterpolation(bool interpolate) +{ _theViewPanel->onInterpolation(interpolate); RefreshInterface(); } -void wxContourMainFrame::onChangeInstant(std::string name,int actual){ +void wxContourMainFrame::onChangeInstant(std::string name,int actual) +{ _instantPanel->setConceptValue( name, actual ); } -void wxContourMainFrame::resetAppend(){ +void wxContourMainFrame::resetAppend() +{ kernelManager->resetAppend(); - } -void wxContourMainFrame::onSpreadAdd(){ +void wxContourMainFrame::onSpreadAdd() +{ std::vector vecX; std::vector vecY; std::vector vecZ; @@ -2473,7 +2372,8 @@ void wxContourMainFrame::onSpreadAdd(){ } -void wxContourMainFrame::onSpreadAddAll(){ +void wxContourMainFrame::onSpreadAddAll() +{ //EED02 std::vector tempVector; _instantPanel->getInstant( tempVector ); @@ -2511,7 +2411,8 @@ void wxContourMainFrame::onSpreadAddAll(){ } -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 @@ -2566,11 +2467,12 @@ void wxContourMainFrame::onSpreadGo(int type){ //RefreshInterface(); } -void wxContourMainFrame::getInstantVector(std::vector& tempVector){ - +void wxContourMainFrame::getInstantVector(std::vector& tempVector) +{ } -std::vector wxContourMainFrame::getOutlinesName(int slide){ +std::vector wxContourMainFrame::getOutlinesName(int slide) +{ std::vector tempVector; _instantPanel->getInstant(tempVector); //Asignation of slide number should be different ex by name diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h index 934238e..546484a 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h @@ -96,7 +96,6 @@ #include "vtkMetaImageWriter.h" #include "vtkImageData.h" #include "vtkTransform.h" - #include "vtkCamera.h" #include "vtkImageActor.h" #include @@ -384,7 +383,7 @@ private: int _numberOfVariablesStatistics; // Contour Image Mask - ThresholdImageView *_viewMaskImage; + ThresholdImageView *_viewMaskImage; ThresholdImageViewPanel *_viewMaskImagePanel; // Threshold Image diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx index 4286054..b1d0567 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx @@ -52,65 +52,6 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE ) //------------------------------------------------------------------------------------------------------------ // Constructors & Destructors //------------------------------------------------------------------------------------------------------------ - /*{ - - showingVID = theShowingImage; - int gapH = 20; - int gapV = 10; - createHorizontalBar(1,80); - createVerticalBar(1,200); - createViewPanel(); - - wxFlexGridSizer * panelSizer = new wxFlexGridSizer(3,1,0,0); - panelSizer->AddSpacer(gapV); - panelSizer -> AddGrowableCol(1); - panelSizer->Add(theViewPanel, 1, wxEXPAND); - panelSizer->AddSpacer(gapV); - - wxFlexGridSizer * downSizer = new wxFlexGridSizer(1,3,gapV,gapH); - downSizer->Add(_verticalBar, 1, wxEXPAND); - //downSizer->AddSpacer(gapH); - downSizer -> AddGrowableCol(1); - downSizer->Add(panelSizer, 1, wxEXPAND|wxALL|wxCENTER); - //downSizer->AddSpacer(gapH); - outSizer = new wxFlexGridSizer(3,1,1,1); - outSizer->Add(_horizontalBar, 1, wxEXPAND); - outSizer -> AddGrowableRow(1); - outSizer -> AddGrowableCol(1); - outSizer->Add(downSizer, 1, wxEXPAND); - - _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + gapH, gapV); - _horizontalBar->setDeviceEndMargin( gapH+10 ); - - //Connecting the events to the horizontal bar - Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal ); - Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Horizontal ); - Connect(_horizontalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Horizontal ); - Connect(_horizontalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Horizontal ); - Connect(_horizontalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Horizontal ); - Connect(_horizontalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Horizontal ); - - //Connecting the events to the vertical bar - Connect(_verticalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Vertical ); - Connect(_verticalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onActualChange_Bar_Vertical ); - Connect(_verticalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onStartChange_Bar_Vertical ); - Connect(_verticalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onEndChange_Bar_Vertical ); - Connect(_verticalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onSelectionEnd_Vertical ); - Connect(_verticalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onMovedBar_Vertical ); - - - this->SetAutoLayout( true ); - SetSizer( outSizer ); - this->Layout(); - - SetSize(900,700); - theViewPanel->SetSize(800,600); - theViewPanel->GetWindow(1)->SetSize(800,600); - - outSizer->Fit( this ); - SetBackgroundColour(wxColour(255,0,0)); - - }*/ //:wxScrolledWindow(parent, -1, pos, size, style) wxContourViewPanel::wxContourViewPanel ( vtkImageData * theShowingImage, wxWindow *parent, const wxPoint& pos, const wxSize& size,long style, int vertStart, int vertEnd, int horzStart, int horzEnd ) :wxPanel(parent, -1, pos, size, style) @@ -126,31 +67,31 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE ) createViewPanel(); _eventHandler = NULL; + wxFlexGridSizer * panelSizer = new wxFlexGridSizer(1,4, gapV, gapH); //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 #if wxMAJOR_VERSION <= 2 - wxFlexGridSizer * panelSizer = new wxFlexGridSizer(1,4, gapV, gapH); panelSizer -> AddGrowableCol(2); panelSizer -> AddGrowableRow(2); #else - wxFlexGridSizer * panelSizer = new wxFlexGridSizer(4); - panelSizer -> AddGrowableCol(2); + panelSizer -> AddGrowableRow(0,1); + panelSizer -> AddGrowableCol(2,1); #endif - panelSizer->Add(_verticalBar, 1, wxGROW); + panelSizer->Add(_verticalBar, 0, wxEXPAND); panelSizer->AddSpacer(gapV); - panelSizer->Add(theViewPanel, 1, wxGROW); + panelSizer->Add(theViewPanel, 1, wxEXPAND); panelSizer->AddSpacer(gapV); + outSizer = new wxFlexGridSizer(3, 1, gapH, gapV); //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 #if wxMAJOR_VERSION <= 2 - outSizer = new wxFlexGridSizer(3, 1, gapH, gapV); outSizer -> AddGrowableCol(1); outSizer -> AddGrowableRow(1); #else - outSizer = new wxFlexGridSizer(3); - outSizer -> AddGrowableCol(1); + outSizer -> AddGrowableRow(1,1); + outSizer -> AddGrowableCol(0,1); #endif - outSizer->Add( _horizontalBar, 1, wxGROW); - outSizer->Add( panelSizer, 1, wxGROW); + outSizer->Add( _horizontalBar, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP); + outSizer->Add( panelSizer, 1, wxEXPAND); outSizer->AddSpacer(gapH); _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + 2*gapH, gapV); @@ -758,11 +699,13 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE ) } } - void wxContourViewPanel::removeSceneContours(){ + void wxContourViewPanel::removeSceneContours() + { _sceneManager->removeSceneContours(); } - void wxContourViewPanel::addNameWrapperToScene(){ + void wxContourViewPanel::addNameWrapperToScene() + { int size = wxContourMainFrame::getInstance()->getNamesWrappingSize(); for(int i = 0; i < size;i++){ std::string name = wxContourMainFrame::getInstance()->getNameWrapping(i); diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.h b/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.h index c8f7033..ecc5c97 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.h +++ b/lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.h @@ -360,39 +360,33 @@ private: //------------------------------------------------------------------------------------------------------------ // Attributtes //------------------------------------------------------------------------------------------------------------ - wxVtkBaseView_SceneManager* _sceneManager; + wxVtkBaseView_SceneManager *_sceneManager; /* * Represents the outer sizer of the ContourViewPanel */ - wxFlexGridSizer* outSizer; + wxFlexGridSizer *outSizer; /* * Represents the panel for viewing */ - wxMaracas_N_ViewersWidget * theViewPanel; + wxMaracas_N_ViewersWidget *theViewPanel; /* * Represents the vertical barrange */ - mBarRange * _verticalBar; + mBarRange *_verticalBar; /* * Represents the horizontal barrange */ - mBarRange * _horizontalBar; + mBarRange *_horizontalBar; + vtkImageData *showingVID; + std::string _verticalConceptName; + std::string _horizontalConceptName; + double last_spacing[3]; + bool _useVerticalBar; + bool _useHorizontalBar; - vtkImageData * showingVID; - - std::string _verticalConceptName; - - std::string _horizontalConceptName; - - double last_spacing[3]; - - bool _useVerticalBar; - - bool _useHorizontalBar; - - wxEvtHandler * _eventHandler; + wxEvtHandler *_eventHandler; //EED diff --git a/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx b/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx index 166f8ed..1d8f1e5 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx @@ -65,25 +65,21 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP ) wxVtkBaseView_SceneManager :: wxVtkBaseView_SceneManager( wxVtkBaseView * theWxBaseViewToManage, wxEvtHandler * theEventHandler, double * spc ) { - _lastInteraction = NULL; - _lastInteractionName = ""; + _lastInteractionName = ""; _eventHandler = theEventHandler; _leftClickCount = 0; _rigthClickCount = 0; - - _contours_ViewControl = new std::map< std::string, ContourWrap_ViewControl * >(); - _sceneContours_ViewControl = new std::map< std::string, ContourWrap_ViewControl * >(); + _contours_ViewControl = new std::map< std::string, ContourWrap_ViewControl * >(); + _sceneContours_ViewControl = new std::map< std::string, ContourWrap_ViewControl * >(); _workingGroup = new std::map< std::string, ContourWrap_ViewControl * >(); - _creatingMULT_ROI = false; - _editingROI = false; - _toIncludeAtInteractionGroup = false; - _waiting = false; + _editingROI = false; + _toIncludeAtInteractionGroup = false; + _waiting = false; _creatingROI = false; - _drawingSelectionROI = false; - SetWidthContour(1.0); - + _drawingSelectionROI = false; + SetWidthContour(1.0); _wxVtk_BaseView = theWxBaseViewToManage; if( _wxVtk_BaseView!=NULL ) { @@ -93,6 +89,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP ) } configureSelectionROI( spc ); } + //------------------------------------------------------------------------------------------------------------ wxVtkBaseView_SceneManager :: ~wxVtkBaseView_SceneManager() { @@ -102,7 +99,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP ) { _contours_ViewControl->erase( iter ); i++; - } + } // for _contours_ViewControl->clear(); delete _contours_ViewControl; _workingGroup->clear(); @@ -126,10 +123,9 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP ) wxCommandEvent cevent( theEventType ); cevent.SetString( wxString( text.c_str(), wxConvUTF8) ); _eventHandler->ProcessEvent( cevent ); - } + } // if } - //------------------------------------------------------------------------------------------------------------ // Attributes getters and setters //------------------------------------------------------------------------------------------------------------ @@ -137,6 +133,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP ) { _eventHandler = theEventHandler; } + //------------------------------------------------------------------------------------------------------------ void wxVtkBaseView_SceneManager :: setWxVtkViewBase( wxVtkBaseView * theBaseView ) { @@ -461,7 +458,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP ) } //------------------------------------------------------------------------------------------------------------ - void wxVtkBaseView_SceneManager :: removeSceneContours( ) + void wxVtkBaseView_SceneManager::removeSceneContours() { std::map ::iterator iter = _sceneContours_ViewControl->begin(); int size = _sceneContours_ViewControl->size(); @@ -471,8 +468,6 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP ) iter++; } _sceneContours_ViewControl->clear(); - - //Removing the selection rectangle to avoid showing when it's innecesary _controlerSelectionROI->SetActive( false ); _viewerSelectionROI->RemoveCompleteContourActor(); diff --git a/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.h b/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.h index e565266..ecc6a51 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.h +++ b/lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.h @@ -209,7 +209,7 @@ class wxVtkBaseView_SceneManager : public InteractorStyleMaracas { int GetImageDataSizeZ(); void GetImageDataRange( double *range ); - void SetWidthContour(double width); + void SetWidthContour(double width); //JCP 21 - 09 - 08 bool isEditableCControler(std::string theKeyName); @@ -232,35 +232,34 @@ private: // Attributtes //------------------------------------------------------------------------------------------------------------ - std::map * _contours_ViewControl; - std::map * _sceneContours_ViewControl; - wxVtkBaseView *_wxVtk_BaseView; - wxEvtHandler *_eventHandler; - ContourWrap_ViewControl *_lastInteraction; - std::string _lastInteractionName; - std::map * _workingGroup; - bool _creatingMULT_ROI; - bool _editingROI; - bool _toIncludeAtInteractionGroup; - bool _waiting; - bool _creatingROI; - int _enventID; - int _leftClickCount; - int _rigthClickCount; - int clickX; - int clickY; - char _lastKeyCode; - long int onCharCallBackTimeEnd; - long int onCharNeeded; - bool _drawingSelectionROI; - manualRoiControler *_controlerSelectionROI; - manualViewRoi *_viewerSelectionROI; - manualBaseModel *_modelSelectionROI; - double _widthOfContour; - double _widthOfControlPoint; - - bool _ctrlKey; - bool _shiftKey; + std::map *_contours_ViewControl; + std::map *_sceneContours_ViewControl; + wxVtkBaseView *_wxVtk_BaseView; + wxEvtHandler *_eventHandler; + ContourWrap_ViewControl *_lastInteraction; + std::string _lastInteractionName; + std::map *_workingGroup; + bool _creatingMULT_ROI; + bool _editingROI; + bool _toIncludeAtInteractionGroup; + bool _waiting; + bool _creatingROI; + int _enventID; + int _leftClickCount; + int _rigthClickCount; + int clickX; + int clickY; + char _lastKeyCode; + long int onCharCallBackTimeEnd; + long int onCharNeeded; + bool _drawingSelectionROI; + manualRoiControler *_controlerSelectionROI; + manualViewRoi *_viewerSelectionROI; + manualBaseModel *_modelSelectionROI; + double _widthOfContour; + double _widthOfControlPoint; + bool _ctrlKey; + bool _shiftKey; }; #endif // __wxVtkBaseView_SceneManager_HEADER_FILE__ -- 2.45.1