]> Creatis software - creaContours.git/commitdiff
*** empty log message ***
authordonadio <donadio>
Tue, 14 Apr 2009 17:19:34 +0000 (17:19 +0000)
committerdonadio <donadio>
Tue, 14 Apr 2009 17:19:34 +0000 (17:19 +0000)
data/Icons/Threshold.png [new file with mode: 0644]
lib/Interface_Icons_NDimensions/interfMainPanel.cxx
lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx
lib/Interface_Icons_NDimensions/interfNewContourMenu.h
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h
lib/Interface_ManagerContour_NDimensions/wxThresholdPanel.cxx [new file with mode: 0644]
lib/Interface_ManagerContour_NDimensions/wxThresholdPanel.h [new file with mode: 0644]

diff --git a/data/Icons/Threshold.png b/data/Icons/Threshold.png
new file mode 100644 (file)
index 0000000..cb6d36e
Binary files /dev/null and b/data/Icons/Threshold.png differ
index 47f763778d560b89a3c950e5344db3b61bb56017..4b8c16e9037c8b040bbeb4340c531f02a7b5d41b 100644 (file)
@@ -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);
                }
        }
index 697ed9823649578540fafbef8efcf6fb94cfe103..257fe8ce33f19324cf08bb2b4c39693b42199eda 100644 (file)
@@ -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
index 1a6364e007dc8319848fbd67d2480cd5a5fafc4f..21c1b5a7430e608f589f4995862ed2e133b644d8 100644 (file)
@@ -46,7 +46,7 @@ private:
        **/
        void onCreateContourLine( wxCommandEvent& event );
        
-       void onCreateContourPoints( wxCommandEvent& event );
+       //void onCreateContourPoints( wxCommandEvent& event );
        
 };
 
index bb5f01f8eab6ec0cf64e949ffde4294ad90b3064..d21f9a58b0c0b202d6768a10989a83f9407f3518 100644 (file)
@@ -112,7 +112,7 @@ void wxContourMainFrame::setVectImages( std::vector<vtkImageData*> images ){
        std::vector<std::string> conceptNameVect;
        std::vector<int> conceptSizeVect;
 
-       wxAuiNotebook * notebook = this->createNotebook();              
+       notebook = this->createNotebook();              
 
 
        kernelManager = new KernelManagerContour( images , _datadir+"/data/" , strCreaContourDataTmp );
@@ -133,7 +133,7 @@ void wxContourMainFrame::setVectImages( std::vector<vtkImageData*> 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<vtkImageData*> 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)
index 0bcb36cdab92826964598359697df408eba419e5..981eb92192ef7661359d25317c420d66bb6c68cd 100644 (file)
@@ -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<vtkImageData*> 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 (file)
index 0000000..9914cee
--- /dev/null
@@ -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 (file)
index 0000000..4815a25
--- /dev/null
@@ -0,0 +1,70 @@
+#ifndef __wxThresholdPanel_INCLUDED_H__
+#define __wxThresholdPanel_INCLUDED_H__
+
+
+// -----------------------------------------------------------------------------------------------------------
+// WX headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// -----------------------------------------------------------------------------------------------------------
+
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#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