]> Creatis software - creaContours.git/blobdiff - lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
*** empty log message ***
[creaContours.git] / lib / Interface_ManagerContour_NDimensions / wxContourMainFrame.cxx
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)