From: donadio Date: Tue, 14 Apr 2009 17:19:34 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: EED.02Oct2009~50 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=26f06d2da9f31bca99fe2266d5b7e5c38a00bdbb;p=creaContours.git *** empty log message *** --- diff --git a/data/Icons/Threshold.png b/data/Icons/Threshold.png new file mode 100644 index 0000000..cb6d36e Binary files /dev/null and b/data/Icons/Threshold.png differ diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx index 47f7637..4b8c16e 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx @@ -721,7 +721,6 @@ void interfMainPanel::onThresholdPressed() { if(thresholdShown) { - wxContourMainFrame::getInstance()->refLineHide(); thresholdShown=false; panelThreshold->onThresholdStop(); @@ -730,9 +729,7 @@ void interfMainPanel::onThresholdPressed() else if (!thresholdShown) { - wxContourMainFrame::getInstance()->refLineShow(); thresholdShown=true; - showPanel(thresholdPanel); } } diff --git a/lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx b/lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx index 697ed98..257fe8c 100644 --- a/lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx +++ b/lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx @@ -43,12 +43,12 @@ void interfNewContourMenu::initButtons(wxEvtHandler* evtHandler) { nom.push_back("Create a Line"); funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourLine); hand.push_back(this); - +/* path.push_back(datadir + "/Line.png"); nom.push_back("Create Points"); funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourPoints); hand.push_back(this); - +*/ this->addButtons(path, nom); this->setVectorFunction(funct); @@ -90,7 +90,8 @@ void interfNewContourMenu::onCreateContourCircle( wxCommandEvent& event ){ void interfNewContourMenu::onCreateContourLine( wxCommandEvent& event ){ interfMainPanel::getInstance()->onCreateContourLine(); } - +/* void interfNewContourMenu::onCreateContourPoints( wxCommandEvent& event ){ interfMainPanel::getInstance()->onCreateContourLine(); } +*/ \ No newline at end of file diff --git a/lib/Interface_Icons_NDimensions/interfNewContourMenu.h b/lib/Interface_Icons_NDimensions/interfNewContourMenu.h index 1a6364e..21c1b5a 100644 --- a/lib/Interface_Icons_NDimensions/interfNewContourMenu.h +++ b/lib/Interface_Icons_NDimensions/interfNewContourMenu.h @@ -46,7 +46,7 @@ private: **/ void onCreateContourLine( wxCommandEvent& event ); - void onCreateContourPoints( wxCommandEvent& event ); + //void onCreateContourPoints( wxCommandEvent& event ); }; diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index bb5f01f..d21f9a5 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -112,7 +112,7 @@ void wxContourMainFrame::setVectImages( std::vector images ){ std::vector conceptNameVect; std::vector conceptSizeVect; - wxAuiNotebook * notebook = this->createNotebook(); + notebook = this->createNotebook(); kernelManager = new KernelManagerContour( images , _datadir+"/data/" , strCreaContourDataTmp ); @@ -133,7 +133,7 @@ void wxContourMainFrame::setVectImages( std::vector images ){ //*******************changeInstant(); _theViewPanel->setVerticalConcept( "Axe Depth", data->getMinValue(), data->getMaxValue(), data->getMinShowedValue(), data->getMaxShowedValue(), data->getActualValue() ); - this->configurePanels( notebook ); + this->configurePanels( ); } @@ -199,47 +199,32 @@ void wxContourMainFrame::setVectImages( std::vector images ){ //------------------------------------------------------------------------------------------------------------ // Creational and initialization methods //------------------------------------------------------------------------------------------------------------ - bool wxContourMainFrame :: configurePanels(wxAuiNotebook* theNoteBook) + bool wxContourMainFrame :: configurePanels( ) { bool configured = _theViewPanel!=NULL; configured &= _theViewPanel!=NULL; if( _theViewPanel!=NULL ) { - theNoteBook->AddPage( _theViewPanel, wxT(" View ") ); + notebook->AddPage( _theViewPanel, wxT(" View ") ); m_mgr.Update(); } if( configured ) { - theNoteBook->AddPage( _instantPanel, wxT("Instant Page") ); + notebook->AddPage( _instantPanel, wxT("Instant Page") ); m_mgr.Update(); } - m_mgr.AddPane(theNoteBook, wxAuiPaneInfo().Name(wxT("notebook_content")).CenterPane().PaneBorder(false)); + m_mgr.AddPane(notebook, wxAuiPaneInfo().Name(wxT("notebook_content")).CenterPane().PaneBorder(false)); m_mgr.Update(); -/* configured &= _buttonsBar!=NULL; - if( _buttonsBar!=NULL ) - { - m_mgr.AddPane(_buttonsBar, wxAuiPaneInfo(). - Name(wxT("TB")).Caption(wxT("Buttons Bar")). - ToolbarPane().Top(). - LeftDockable( ).RightDockable( false ).CloseButton(false)); - m_mgr.Update(); - }*/ - //CreateStatusBar(); - + SetMinSize(wxSize(300,300)); m_mgr.Update(); return configured; } - void wxContourMainFrame :: setNotebook( wxAuiNotebook * noteBook ) - { - - } - //------------------------------------------------------------------------------------------------------------ // Attributes getters and setters //------------------------------------------------------------------------------------------------------------ @@ -1708,7 +1693,7 @@ void wxContourMainFrame::onThreshold(int minVal, int maxVal) //Lookup Table vtkLookupTable *lookup = vtkLookupTable::New(); - lookup->SetNumberOfTableValues(range[1]); + lookup->SetNumberOfTableValues(range[1]+1); lookup->SetTableRange(range); lookup->SetAlphaRange(0, 1); lookup->SetValueRange(0, 1); @@ -1716,9 +1701,12 @@ void wxContourMainFrame::onThreshold(int minVal, int maxVal) lookup->SetRampToLinear( ); + //Assign a fake color for the upper image, and set the white as transparent for(int i = range[0]; i < range[1]; i++) { + //std::cout<<"Int equal: " << i << std::endl; + if( i >= minVal && i <= maxVal ) { lookup->SetTableValue(i, 1.0, 0.0, 0.0, 1); @@ -1736,19 +1724,43 @@ void wxContourMainFrame::onThreshold(int minVal, int maxVal) lookup->Build( ); vtkImageMapToColors *mapperImage = vtkImageMapToColors::New( ); - mapperImage->SetInput( img ); mapperImage->SetLookupTable( lookup ); + mapperImage->SetInput( img ); + //mapperImage->SetOutputFormatToRGBA( ); vtkImageActor * upperImageActor = vtkImageActor::New( ); upperImageActor->SetInput( mapperImage->GetOutput() ); upperImageActor->SetOpacity( 1 ); - //viewer->SetInput( myImage ); viewer->GetRenderer()->AddActor( myActor );ACTOR!!! + vtkImageViewer2* viewer = vtkImageViewer2::New(); + viewer->SetInput( upperImageActor->GetInput() ); + viewer->SetColorLevel((range[1]-range[0])/2); + viewer->SetColorWindow(range[1]); + viewer->GetRenderer()->AddActor( upperImageActor ); + viewer->Render(); + + //wxThresholdPanel * panel = new wxThresholdPanel( viewer, notebook ); + + //onThresholdPanel(panel); + + RefreshInterface(); //baseImageActor = vtkImageActor::New( ); //baseImageActor->SetInput( mBox->bbGetInputImage1() ); +} - RefreshInterface(); + +bool wxContourMainFrame::onThresholdPanel(wxPanel* panel) + { + bool configured = panel!=NULL; + configured &= panel!=NULL; + + if( configured ) + { + notebook->AddPage( panel, wxT(" Threshold "), true ); + m_mgr.Update(); + } + return configured; } void wxContourMainFrame::showAxis(bool show) diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h index 0bcb36c..981eb92 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h @@ -27,6 +27,7 @@ //#include "wxVtkBaseView_SceneManager.h" #include "wxInstantChooserPanel.h" #include "wxContourViewPanel.h" +#include "wxThresholdPanel.h" @@ -136,9 +137,7 @@ class wxContourMainFrame : public wxPanel { void setVectImages( std::vector images ); - bool configurePanels(wxAuiNotebook * theNoteBook ); - - void setNotebook( wxAuiNotebook * theNoteBook ); + bool configurePanels( ); wxAuiNotebook * createNotebook(); @@ -262,6 +261,10 @@ class wxContourMainFrame : public wxPanel { void onThreshold(int minVal, int maxVal); + bool onThresholdPanel(wxPanel* panel); + +//==================================================================================================== + void showAxis(bool show); void onRigidPressed(); @@ -336,6 +339,8 @@ private: wxArrayString m_perspectives; wxMenu* m_perspectives_menu; */ + + wxAuiNotebook * notebook; long m_notebook_style; long m_notebook_theme; int _numberOfVariablesStatistics; diff --git a/lib/Interface_ManagerContour_NDimensions/wxThresholdPanel.cxx b/lib/Interface_ManagerContour_NDimensions/wxThresholdPanel.cxx new file mode 100644 index 0000000..9914cee --- /dev/null +++ b/lib/Interface_ManagerContour_NDimensions/wxThresholdPanel.cxx @@ -0,0 +1,40 @@ +//---------------------------------------------------------------------------------------------------------------- +// Class definition include +//---------------------------------------------------------------------------------------------------------------- +#include "wxThresholdPanel.h" + + +//---------------------------------------------------------------------------------------------------------------- +// Other includes +//---------------------------------------------------------------------------------------------------------------- + + //------------------------------------------------------------------------------------------------------------ + // Constructors & Destructors + //------------------------------------------------------------------------------------------------------------ + + wxThresholdPanel :: wxThresholdPanel ( vtkImageViewer2 * theViewer, wxWindow *parent, const wxPoint& pos, const wxSize& size,long style, int vertStart, int vertEnd, int horzStart, int horzEnd ) + :wxPanel(parent, -1, pos, size, style) + { + //wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL); + + vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New(); + theViewer->SetupInteractor(iren); + + //crea::creawxVTKRenderWindowInteractor * mInteractor = new crea::creawxVTKRenderWindowInteractor(this,-1); + //mInteractor->UseCaptureMouseOn(); + //theViewer->SetupInteractor ( mInteractor ); + + //theViewer->Render(); + //theViewer->GetRenderer()->ResetCamera(); + + //topsizer-> Add( iren ,1,wxGROW ,0); + SetAutoLayout( true ); + //SetSizer( topsizer ); + Layout(); + } + + + wxThresholdPanel :: ~wxThresholdPanel() + { + + } \ No newline at end of file diff --git a/lib/Interface_ManagerContour_NDimensions/wxThresholdPanel.h b/lib/Interface_ManagerContour_NDimensions/wxThresholdPanel.h new file mode 100644 index 0000000..4815a25 --- /dev/null +++ b/lib/Interface_ManagerContour_NDimensions/wxThresholdPanel.h @@ -0,0 +1,70 @@ +#ifndef __wxThresholdPanel_INCLUDED_H__ +#define __wxThresholdPanel_INCLUDED_H__ + + +// ----------------------------------------------------------------------------------------------------------- +// WX headers inclusion. +// For compilers that support precompilation, includes . +// ----------------------------------------------------------------------------------------------------------- + +#include +#ifdef __BORLANDC__ +#pragma hdrstop +#endif +#ifndef WX_PRECOMP +#include +#endif + + +//------------------------------------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------------------------------------ + +#include "creawxVTKRenderWindowInteractor.h" +#include "vtkImageViewer2.h" +#include "vtkRenderWindowInteractor.h" + +//------------------------------------------------------------------------------------------------------------ +// Class definition +//------------------------------------------------------------------------------------------------------------ + +class wxThresholdPanel : public wxPanel +{ +public: + + //------------------------------------------------------------------------------------------------------------ + // Constructors & Destructors + //------------------------------------------------------------------------------------------------------------ + + wxThresholdPanel( vtkImageViewer2 * theViewer, wxWindow *parent, const wxPoint& pos=wxDefaultPosition, const wxSize& size = wxDefaultSize,long style= wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER, int vertStart=1, int vertEnd=1, int horzStart=1, int horzEnd=1 ); + + ~wxThresholdPanel(); + + //------------------------------------------------------------------------------------------------------------ + // Creational and initialization methods + //------------------------------------------------------------------------------------------------------------ + + + //------------------------------------------------------------------------------------------------------------ + // Methods for capturing events from the horizontal bar + //------------------------------------------------------------------------------------------------------------ + + + + //------------------------------------------------------------------------------------------------------------ + // Other functional methods + //------------------------------------------------------------------------------------------------------------ + + + + //------------------------------------------------------------------------------------------------------------ + // Attributtes + //------------------------------------------------------------------------------------------------------------ +private: + + //------------------------------------------------------------------------------------------------------------ + // Private methods + //------------------------------------------------------------------------------------------------------------ + +}; +#endif