]> Creatis software - creaContours.git/commitdiff
#3322 creaContours Feature New Normal - Show reference contour Befor After actual...
authorEduardo DAVILA <davila@ei-ed-606.univ-lyon1.fr>
Wed, 11 Dec 2019 15:44:30 +0000 (16:44 +0100)
committerEduardo DAVILA <davila@ei-ed-606.univ-lyon1.fr>
Wed, 11 Dec 2019 15:44:30 +0000 (16:44 +0100)
lib/Interface_Icons_NDimensions/interfMainPanel.cxx
lib/Interface_Icons_NDimensions/interfMainPanel.h
lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx
lib/Interface_Icons_NDimensions/interfToolsPanels.cxx
lib/Interface_Icons_NDimensions/interfToolsPanels.h
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h
lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx
lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.h
lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx
lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.h

index c54ec1191508657b7eef8590fcd912fe3167bd9e..bb87ee6803714f04120e848199ac0be3b9d05f49 100644 (file)
@@ -600,6 +600,11 @@ void interfMainPanel::onBeforAfterContour(bool before, bool after)
        wxContourMainFrame::getInstance()->onBeforeAfterContour(before,after);
 }
 
+void interfMainPanel::onShowTextContour(bool show)
+{
+       wxContourMainFrame::getInstance()->onShowTextContour(show);
+}
+
 
 void interfMainPanel::onConfigurationPressed()
 {
index c9267a7a3e7a6f6ab134d1099d5c1c9fa290b82b..d6a40a97c5f2846f293c01a1971da8e6228c83c4 100644 (file)
@@ -169,6 +169,7 @@ public:
        int getWindowLevel();
        void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
        void onInterpolation(bool interpolate);
+       void onShowTextContour(bool show);
        void onBeforAfterContour(bool before, bool after);
        void onSpreadPressed();
        void onConfigurationPressed();
index 46fb279043e0fdc75f50db7f168d8eabe252f071..55786964888d67ad28a41497a99f431c14a7ec38 100644 (file)
@@ -113,19 +113,19 @@ void  interfSegmentationPanelVTK::onSegmentationPressedITK(wxCommandEvent& event
 
 void interfSegmentationPanelVTK::onSegmentationOneSlice( wxCommandEvent& event )
 {
-       int isovalue = _isovalue->GetValue();
-       int sampling = _sampling->GetValue();
-       int method = methodRadiobox->GetSelection();
+       int isovalue    = _isovalue->GetValue();
+       int sampling    = _sampling->GetValue();
+       int method              = methodRadiobox->GetSelection();
        interfMainPanel::getInstance()->onSegmentationOneSlice(isovalue, sampling, method);
 }
 
 void interfSegmentationPanelVTK::onSegmentationAllSlice( wxCommandEvent& event )
 {
-       int minZ=_mbarrange->GetStart();
-       int maxZ=_mbarrange->GetEnd();
-       int isovalue = _isovalue->GetValue();
-       int sampling = _sampling->GetValue();
-       int method   = methodRadiobox->GetSelection();
+       int minZ                = _mbarrange->GetStart();
+       int maxZ                = _mbarrange->GetEnd();
+       int isovalue    = _isovalue->GetValue();
+       int sampling    = _sampling->GetValue();
+       int method      = methodRadiobox->GetSelection();
        interfMainPanel::getInstance()->onSegmentationAllSlice(minZ, maxZ, isovalue, sampling, method); 
 }
 
index b26ed89371a5082d90fdeefa08c73995f5f21e93..ea290acd2a6812d31c141fbbb5a1acd943c4c76f 100644 (file)
@@ -51,13 +51,17 @@ interfConfigurationPanel::interfConfigurationPanel(wxWindow * parent)
        _brithtnessWindowLevel                                  = new wxSlider(this, -1, windowlevel , min, max, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
        _brithtnessColorLevel                                   = new wxSlider(this, -1, colorwindow , min, max, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
 
-       _interpolationCheckBox = new wxCheckBox(this, -1, _T("Image Interpolation") );
+       _interpolationCheckBox                                  = new wxCheckBox(this, -1, _T("Image Interpolation") );
        _interpolationCheckBox->SetValue(true);
 
-       _beforContourCheckBox = new wxCheckBox(this, -1, _T("Befor Contour") );
+       _showTextContourCheckBox                                = new wxCheckBox(this, -1, _T("Labels Contours") );
+       _showTextContourCheckBox->SetValue(true);
+
+
+       _beforContourCheckBox                                   = new wxCheckBox(this, -1, _T("Befor Contour") );
        _beforContourCheckBox->SetValue(false);
 
-       _afterContourCheckBox = new wxCheckBox(this, -1, _T("After Contour") );
+       _afterContourCheckBox                                   = new wxCheckBox(this, -1, _T("After Contour") );
        _afterContourCheckBox->SetValue(false);
 
 
@@ -69,21 +73,31 @@ interfConfigurationPanel::interfConfigurationPanel(wxWindow * parent)
        Connect( _brithtnessColorLevel->GetId() , wxEVT_SCROLL_CHANGED,           (wxObjectEventFunction) &interfConfigurationPanel::onBrigthnessColorWindowLevel);
        Connect( _brithtnessColorLevel->GetId() , wxEVT_SCROLL_THUMBTRACK,        (wxObjectEventFunction) &interfConfigurationPanel::onBrigthnessColorWindowLevel);
        Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &interfConfigurationPanel::OnInterpolation);
+       Connect( _showTextContourCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &interfConfigurationPanel::OnShowTextContour);
        Connect( _beforContourCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &interfConfigurationPanel::OnBeforAfterContour);
        Connect( _afterContourCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &interfConfigurationPanel::OnBeforAfterContour);
 
-       wxFlexGridSizer * sizer                                 = new wxFlexGridSizer(1);
-       sizer -> Add( new wxStaticText(this,-1, _T("Contour width"))  , 1, wxGROW );
-       sizer -> Add( _withOfContourLine                , 1, wxGROW );
-       sizer -> Add( new wxStaticText(this,-1, _T(" "))  , 1, wxGROW );
-       sizer -> Add( new wxStaticText(this,-1, _T("Window level"))  , 1, wxGROW );
-       sizer -> Add( _brithtnessWindowLevel            , 1, wxGROW );
-       sizer -> Add( new wxStaticText(this,-1, _T("Color level"))  , 1, wxGROW );
-       sizer -> Add( _brithtnessColorLevel, 1, wxGROW );
-       sizer -> Add( new wxStaticText(this,-1, _T(" "))  , 1, wxGROW );
-       sizer -> Add( _interpolationCheckBox            , 1, wxGROW );
-       sizer -> Add( _beforContourCheckBox             , 1, wxGROW );
-       sizer -> Add( _afterContourCheckBox             , 1, wxGROW );
+       wxFlexGridSizer * sizerA                                        = new wxFlexGridSizer(1);
+       sizerA -> Add( new wxStaticText(this,-1, _T("Contour width"))  , 1, wxGROW );
+       sizerA -> Add( _withOfContourLine               , 1, wxGROW );
+       sizerA -> Add( new wxStaticText(this,-1, _T(" "))  , 1, wxGROW );
+       sizerA -> Add( new wxStaticText(this,-1, _T("Window level"))  , 1, wxGROW );
+       sizerA -> Add( _brithtnessWindowLevel           , 1, wxGROW );
+       sizerA -> Add( new wxStaticText(this,-1, _T("Color level"))  , 1, wxGROW );
+       sizerA -> Add( _brithtnessColorLevel, 1, wxGROW );
+       sizerA -> Add( new wxStaticText(this,-1, _T(" "))  , 1, wxGROW );
+
+       wxFlexGridSizer * sizerB                                        = new wxFlexGridSizer(1);
+       sizerB -> Add( _interpolationCheckBox           , 1, wxGROW );
+       sizerB -> Add( new wxStaticText(this,-1, _T(" "))  , 1, wxGROW );
+       sizerB -> Add( _showTextContourCheckBox         , 1, wxGROW );
+       sizerB -> Add( new wxStaticText(this,-1, _T(" "))  , 1, wxGROW );
+       sizerB -> Add( _beforContourCheckBox            , 1, wxGROW );
+       sizerB -> Add( _afterContourCheckBox            , 1, wxGROW );
+
+       wxFlexGridSizer * sizer                                         = new wxFlexGridSizer(2);
+       sizer -> Add( sizerA            , 1, wxGROW );
+       sizer -> Add( sizerB            , 1, wxGROW );
 
        this->SetSizer( sizer );
        //JCP 13-10-08
@@ -121,6 +135,11 @@ void interfConfigurationPanel::OnBeforAfterContour(wxCommandEvent& event)
        interfMainPanel::getInstance()->onBeforAfterContour(_beforContourCheckBox->GetValue() , _afterContourCheckBox->GetValue() );
 }
 
+void interfConfigurationPanel::OnShowTextContour(wxCommandEvent& event)
+{
+       interfMainPanel::getInstance()->onShowTextContour(_showTextContourCheckBox->GetValue() );
+}
+
 
 /**
 ** Begin of the spread panel
index d5c7815df87aa2d7ca06f68b7d648846949736bd..5ea04f21420b90034e7b88f912b0f28008e5d077 100644 (file)
@@ -41,11 +41,13 @@ private:
        void onWidthOfContour(wxScrollEvent& event);
        void onBrigthnessColorWindowLevel(wxScrollEvent& event);
        void OnInterpolation(wxCommandEvent& event);
+       void OnShowTextContour(wxCommandEvent& event);
        void OnBeforAfterContour(wxCommandEvent& event);
        wxSlider*       _withOfContourLine;
        wxSlider*       _brithtnessWindowLevel;
        wxSlider*       _brithtnessColorLevel;
        wxCheckBox* _interpolationCheckBox;
+       wxCheckBox* _showTextContourCheckBox;
        wxCheckBox* _beforContourCheckBox;
        wxCheckBox* _afterContourCheckBox;
 };
index f780b86c741d31df73826895a236ef25cc0acdf7..0e7bff41f9cd3939a1ef3ab49906833ce1c6ac99 100644 (file)
@@ -1899,21 +1899,17 @@ void wxContourMainFrame::onSegmentationOneSlice(int isovalue,int sampling,int me
 
 void wxContourMainFrame::SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method )
 {
-printf("EED wxContourMainFrame::SegmentationOneSlice   Start\n");
        int typeofcontour = 1;
        //--Extracting Contour
-       //vtkImageData  *imagedata      = _theViewPanel->getSceneManager()->GetImageData();
        vtkImageData    *imagedata      = getImageData();
-//             double                  *range          = imagedata->GetScalarRange();
-//             double                  thr                     = 1;
 
        vtkImageReslice *imageReslice = vtkImageReslice::New();
 //EED
-//             double spc[3];
-//             imagedata->GetSpacing(spc);
-//             x = x*spc[0];
-//             y = y*spc[1];
-//             z = z*spc[3];
+               double spc[3];
+               imagedata->GetSpacing(spc);
+               x = x*spc[0];
+               y = y*spc[1];
+               z = z;
 
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
@@ -1923,7 +1919,7 @@ printf("EED wxContourMainFrame::SegmentationOneSlice   Start\n");
 #endif
        imageReslice->SetInformationInput(imagedata);
        imageReslice->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1);
-       imageReslice->SetResliceAxesOrigin(0,0,z);
+       imageReslice->SetResliceAxesOrigin(0,0,z*spc[2]);
        imageReslice->SetOutputDimensionality(2);
        imageReslice->SetInterpolationModeToLinear();
 
@@ -1971,7 +1967,15 @@ printf("EED wxContourMainFrame::SegmentationOneSlice   Start\n");
        cpd->UpdateInformation();
 
        vtkPolyDataConnectivityFilter* conn = vtkPolyDataConnectivityFilter::New( );
-       conn->SetExtractionModeToClosestPointRegion( );
+
+//     conn->SetExtractionModeToPointSeededRegions();
+//     conn->SetExtractionModeToCellSeededRegions();
+//     conn->SetExtractionModeToSpecifiedRegions();
+//     conn->SetExtractionModeToLargestRegion();
+//     conn->SetExtractionModeToAllRegions();
+
+       conn->SetExtractionModeToClosestPointRegion();
+
        //conn->SetMaxRecursionDepth( 3000 );
 
 //EED 2017-01-01 Migration VTK7
@@ -1996,12 +2000,15 @@ printf("EED wxContourMainFrame::SegmentationOneSlice   Start\n");
        cpd2->UpdateInformation();
 
        vtkStripper* vtkstripper = vtkStripper::New( );
+vtkstripper->SetJoinContiguousSegments(true);
        vtkstripper->SetMaximumLength(20000);
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
        vtkstripper->SetInput( cpd2->GetOutput() );
 #else
        vtkstripper->SetInputData( cpd2->GetOutput() );
+//     vtkstripper->SetInputData( cntVTK->GetOutput() );
+
 #endif
        vtkstripper->Update();
        vtkstripper->UpdateInformation();
@@ -2026,24 +2033,19 @@ myfile << "-------------------------------------\n";
 polyDataResult->GetLines()->Print(myfile);
 myfile.close();
 */
-
-       cntVTK          -> Delete();
-       cpd2            -> Delete();
-       cpd                     -> Delete();
-       conn            -> Delete();
-
+       cntVTK  -> Delete();
+       cpd2    -> Delete();
+       cpd             -> Delete();
+       conn    -> Delete();
 
 //--Calculating control points
-
        std::vector<double> vecX;
        std::vector<double> vecY;
        std::vector<double> vecZ;
-
        std::vector<double> vecCtrlPointX;
        std::vector<double> vecCtrlPointY;
        std::vector<double> vecCtrlPointZ;
 
-
 printf("EED wxContourMainFrame::SegmentationOneSlice GetNumberOfLines=%d \n",polyDataResult->GetNumberOfLines() );
 
 int numberOfPointsInCell;
@@ -2060,84 +2062,90 @@ printf("EED wxContourMainFrame::SegmentationOneSlice PrintSelf \n");
 polyDataResult->PrintSelf( std::cout, vtkIndent(0) );
 
 
+       if (polyDataResult->GetNumberOfCells()>0)
+       {
+               double *p;
+       printf("EED wxContourMainFrame::SegmentationOneSlice A \n");
+               vtkCell* vtkcell = polyDataResult->GetCell( 0 );
+       printf("EED wxContourMainFrame::SegmentationOneSlice B \n");
+       //      int ii,size=polyDataResult->GetNumberOfPoints();
+               int ii,size=vtkcell->GetNumberOfPoints();
+       printf("EED wxContourMainFrame::SegmentationOneSlice C \n");
+               int id;
+               for (ii=1;ii<=size;ii++)
+               {
+       //              id      = polyDataResult->GetLines()->GetData()->GetValue(ii);
+       //              p       = polyDataResult->GetPoint(id);
+                       p       = vtkcell->GetPoints()->GetPoint(ii);
 
-       double *p;
-       int ii,size=polyDataResult->GetNumberOfPoints();
-       int id;
-       for (ii=1;ii<=size;ii++)
-       {
-               id      = polyDataResult->GetLines()->GetData()->GetValue(ii);
-               p       = polyDataResult->GetPoint(id);
-printf("EED wxContourMainFrame::SegmentationOneSlice (%d) id=%d  px=%f py=%f\n",ii,id, p[0],p[1]);
-//             double x=p[0];
-//             double y=p[1];
-               vecX.push_back( p[0] );
-               vecY.push_back( p[1] );
-//EED 2017-12-16
-               vecZ.push_back( -900 );
-//                     vecZ.push_back( p[2] );
-       }
-
+       printf("EED wxContourMainFrame::SegmentationOneSlice (%d) id=%d  px=%f py=%f\n",ii,id, p[0],p[1]);
+       //              double x=p[0];
+       //              double y=p[1];
+                       vecX.push_back( p[0] );
+                       vecY.push_back( p[1] );
+       //EED 2017-12-16
+                       vecZ.push_back( -900 );
+       //                      vecZ.push_back( p[2] );
+               }
 
-       ExtractControlPoints2D *extractcontrolpoints2d = new ExtractControlPoints2D();
-       extractcontrolpoints2d->SetContour( &vecX , &vecY , &vecZ );
+               ExtractControlPoints2D *extractcontrolpoints2d = new ExtractControlPoints2D();
+               extractcontrolpoints2d->SetContour( &vecX , &vecY , &vecZ );
 
-//PROOFS
-       /*if (methodRadiobox->GetSelection()==0){
-               extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
-       }
-       if (methodRadiobox->GetSelection()==1){
-               extractcontrolpoints2d->GetControlPoints(  &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
-       }
-       if (methodRadiobox->GetSelection()==2){
-               extractcontrolpoints2d->SetSamplingControlPoints( sampling );
-               extractcontrolpoints2d->GetSamplingControlPoints(  &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
-       }*/
+       //PROOFS
+               /*if (methodRadiobox->GetSelection()==0){
+                       extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+               }
+               if (methodRadiobox->GetSelection()==1){
+                       extractcontrolpoints2d->GetControlPoints(  &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+               }
+               if (methodRadiobox->GetSelection()==2){
+                       extractcontrolpoints2d->SetSamplingControlPoints( sampling );
+                       extractcontrolpoints2d->GetSamplingControlPoints(  &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+               }*/
 
-       if (method==0)
-       {
-               extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
-       } else if (method==1){
-               extractcontrolpoints2d->GetControlPoints(  &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
-       } else if (method==2){
-               extractcontrolpoints2d->SetSamplingControlPoints( sampling );
-               extractcontrolpoints2d->GetSamplingControlPoints(  &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
-       }
+               if (method==0)
+               {
+                       extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+               } else if (method==1){
+                       extractcontrolpoints2d->GetControlPoints(  &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+               } else if (method==2){
+                       extractcontrolpoints2d->SetSamplingControlPoints( sampling );
+                       extractcontrolpoints2d->GetSamplingControlPoints(  &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
+               }
 
-       //--Adding contour to the system
-       std::vector<int> actualInstantVector;
-       _instantPanel->getInstant( actualInstantVector );
-       actualInstantVector[1]=z;
+               //--Adding contour to the system
+               std::vector<int> actualInstantVector;
+               _instantPanel->getInstant( actualInstantVector );
+               actualInstantVector[1]=z;
 
-       int j,sizeCtrPt = vecCtrlPointX.size();
-       manualBaseModel *manModelContour =  kernelManager->factoryManualContourModel( typeofcontour );
-printf("EED  wxContourMainFrame::SegmentationOneSlice  sizeCtrPt=%d   %d  %d\n"        , sizeCtrPt
-                                                                                                                                                               , ((sizeCtrPt/100)+1)*100 *2
-                                                                                                                                                               , manModelContour->GetNumberOfPointsSpline()
-       );
-       manModelContour->SetNumberOfPointsSpline( ((sizeCtrPt/100)+1)*100 *2 );
-       if (sizeCtrPt>=3)
-       {
-               for (j=0 ; j<sizeCtrPt ; j++)
-               {
-                       manModelContour->AddPoint( vecCtrlPointX[j] , vecCtrlPointY[j] , vecCtrlPointZ[j]  );
-               } // for
-               std::string theName;
-               //theName = _modelManager->createOutline( manModelContour, actualInstantVector );
-               theName = kernelManager->createOutline( manModelContour, actualInstantVector );
-               bool addedModel = theName.compare("") != 0;
-               if( addedModel )
+               int j,sizeCtrPt = vecCtrlPointX.size();
+               manualBaseModel *manModelContour =  kernelManager->factoryManualContourModel( typeofcontour );
+               manModelContour->SetNumberOfPointsSpline( ((sizeCtrPt/100)+1)*100 *2 );
+               manModelContour->SetLabel2( std::to_string(z) );
+               if (sizeCtrPt>=3)
                {
-                       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->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
-                       //_theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc, typeofcontour ) ;
-               }       // if addedModel
-       } // if sizeCtrPt
-printf("EED wxContourMainFrame::SegmentationOneSlice   End\n");
+                       for (j=0 ; j<sizeCtrPt ; j++)
+                       {
+                               manModelContour->AddPoint( vecCtrlPointX[j] / spc[0], vecCtrlPointY[j] / spc[1], vecCtrlPointZ[j] );
+                       } // for
+                       std::string theName;
+                       //theName = _modelManager->createOutline( manModelContour, actualInstantVector );
+                       theName = kernelManager->createOutline( manModelContour, actualInstantVector );
+                       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->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
+                               //_theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc, typeofcontour ) ;
+                       }       // if addedModel
+               } // if sizeCtrPt
+       } // if NumberOfCells > 0
+
+printf("EED wxContourMainFrame::SegmentationOneSlice  End\n");
 }
 
 int wxContourMainFrame::GetImageDataSizeZ()
@@ -2157,12 +2165,12 @@ void wxContourMainFrame::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,i
        //JCP 20-10-08 Undo redo implementation
 
        wxBusyCursor wait;
-       int                                     x                                       = _theViewPanel->GetX();
-       int                                     y                                       = _theViewPanel->GetY();
-       int z;
-       double porcent;
-       wxString tmpString;
-       double totalZ = maxZ-minZ+1;
+       int                                     x = _theViewPanel->GetX();
+       int                                     y = _theViewPanel->GetY();
+       int                             z;
+       double                          porcent;
+       wxString                        tmpString;
+       double                          totalZ = maxZ-minZ+1;
        for( z=minZ ; z<=maxZ ; z++ )
        {
                porcent = 100.0* (z-minZ)/totalZ;
@@ -2407,19 +2415,22 @@ void wxContourMainFrame::onBeforeAfterContour(bool before,bool after)
        RefreshInterface();
 }
 
+void wxContourMainFrame::onShowTextContour(bool show)
+{
+       _theViewPanel->onShowTextContour(show);
+       RefreshInterface();
+}
 
 void wxContourMainFrame::onChangeInstant(std::string name,int actual)
 {
        _instantPanel->setConceptValue( name, actual );
 }
 
-
 void wxContourMainFrame::resetAppend()
 {
        kernelManager->resetAppend();
 }
 
-
 void wxContourMainFrame::onSpreadAdd()
 {
        std::vector<double> vecX;
index cceebd807b59ba75a1b6c77df7d56832b4181a2a..b83691aacfd59b9c61653a522378d86668c8fd60 100644 (file)
@@ -264,6 +264,7 @@ class wxContourMainFrame : public wxPanel {
        int getWindowLevel();
        void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
        void onInterpolation(bool interpolate);
+       void onShowTextContour(bool show);
        void onBeforeAfterContour(bool before, bool after);
        void onChangeInstant(std::string name,int actual);
        void resetAppend();
index de7b90660a8eb27c230f8b4a4736f2bcbef7fbeb..059d7cecd1edce39c9fecbaa7da8c5cfab3d6125 100644 (file)
@@ -58,8 +58,8 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
        {
                theShowingImage->GetSpacing(last_spacing);
                showingVID                              = theShowingImage;
-               _before                                 = false;
-               _after                                  = false;
+               _showBeforeContour              = false;
+               _showAfterContour               = false;
                int gapH                                = 20;
                int gapV                                = 10;
                _verticalConceptName    = "";
@@ -719,11 +719,14 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
                        _sceneManager->addToScene(name, true, true, true, false, false );
                } // for i
 
+               _sceneManager->SetLabelNumberOfContours( "contours:"+std::to_string(size) );
+
                std::vector<int> tempVector;
                wxContourMainFrame::getInstance()->getInstantVector( tempVector );
 
-               if (_before==true)
+               if (_showBeforeContour==true)
                {
+                       size=0;
                        std::vector<std::string> lstNameBefor;
                        // Contours Befor
                        for (i=tempVector[1]-1; i>=0; i--)
@@ -742,8 +745,10 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
                        } // for i
                } // if _before Contour
        
-               if (_after==true)
+printf("EED wxContourViewPanel::addNameWrapperToScene A\n");
+               if (_showAfterContour==true)
                {
+                       size=0;
                        std::vector<std::string> lstNameAfter;
                        // Contours After
                        int ext[6];
@@ -764,17 +769,22 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
                                _sceneManager->addToScene(lstNameAfter[i], true, true, false, false, false );
                        } // for i
                } // if _after Contour
+printf("EED wxContourViewPanel::addNameWrapperToScene B\n");
+
        }
 
-       std::vector<std::string> wxContourViewPanel::getSelectedObjects(){
+       std::vector<std::string> wxContourViewPanel::getSelectedObjects()
+       {
                return _sceneManager->getSelectedObjects();
        }
 
-       void wxContourViewPanel::RefreshInterface(){
+       void wxContourViewPanel::RefreshInterface()
+       {
                getWxVtkBaseView()->Refresh();
        }
 
-       vtkImageData* wxContourViewPanel::getImageData(){
+       vtkImageData* wxContourViewPanel::getImageData()
+       {
                return _sceneManager->GetImageData();
        }
 
@@ -829,8 +839,13 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
 
        void wxContourViewPanel::onBeforeAfterContour(bool before, bool after)
        {
-               _before = before;
-               _after  = after;
+               _showBeforeContour      = before;
+               _showAfterContour       = after;
+       }
+
+       void wxContourViewPanel::onShowTextContour(bool show)
+       {
+               _sceneManager->SetShowTextContour( show );
        }
 
        void wxContourViewPanel::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ )
@@ -838,7 +853,8 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
                _sceneManager->GetPointsOfActualContour(vecX, vecY, vecZ);
        }
 
-       void wxContourViewPanel::setImageSlice(int z){
+       void wxContourViewPanel::setImageSlice(int z)
+       {
                vtkInteractorStyleBaseView* stylebaseview = (vtkInteractorStyleBaseView*) _sceneManager->getWxVtkViewBase()->GetInteractorStyleBaseView();
                wxVtk2DBaseView* baseview = (wxVtk2DBaseView*)stylebaseview->GetWxVtk2DBaseView();
                baseview->SetActualSlice(z);
index 3e134a984796d68c63f56dd52bb8e5b93c6968ac..1ea6f2679af5a1a94340fc6952cd9ba0aa97d610 100644 (file)
@@ -279,19 +279,19 @@ class wxContourViewPanel : public wxPanel
        * Gets the vertical concept name
        * @return _verticalConcept The name of the concept for setting at the vertical bar
        */
-       std::string  getVerticalConceptName(  );
+       std::string     getVerticalConceptName(  );
        //------------------------------------------------------------------------------------------------------------
        //  Other functional methods
        //------------------------------------------------------------------------------------------------------------
-       void getSpacing( double * spacing );
-       wxVtkBaseView* getWxVtkBaseView();
-       double getCurrentDeep();
-       void    SetVisibleAxis(bool ok);
-       int             GetX();
-       int             GetY();
-       int             GetZ();
-       void    SetXY(int x, int y);
-       void    Refresh();
+       void                    getSpacing( double * spacing );
+       wxVtkBaseView*  getWxVtkBaseView();
+       double                  getCurrentDeep();
+       void                    SetVisibleAxis(bool ok);
+       int                             GetX();
+       int                             GetY();
+       int                             GetZ();
+       void                    SetXY(int x, int y);
+       void                    Refresh();
 
 
 //this method should be deleted
@@ -321,6 +321,7 @@ class wxContourViewPanel : public wxPanel
        int  getWindowLevel();
        void onBrigthnessColorWindowLevel(int colorwindow,int windowlevel);
        void onInterpolation(bool interpolate);
+       void onShowTextContour(bool show);
        void onBeforeAfterContour(bool before, bool after);
        void GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ );
        void changeImage(vtkImageData* img);
@@ -358,8 +359,8 @@ private:
        bool                                                    _useHorizontalBar;
 
        wxEvtHandler                                    *_eventHandler;
-       bool                                                    _before;
-       bool                                                    _after;
+       bool                                                    _showBeforeContour;
+       bool                                                    _showAfterContour;
        
 //EED
 
index d70557f6aed385d7a0eb11226b3ec6b60d71cc01..7d9c22cb8222b1524c5891e5d5537b6a14f1eee1 100644 (file)
@@ -79,6 +79,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
                _waiting                                                = false;
                _creatingROI                                    = false;
                _drawingSelectionROI                    = false;
+               _showTextContour                                = true;
                SetWidthContour(1.0);   
                _wxVtk_BaseView = theWxBaseViewToManage;
                if( _wxVtk_BaseView!=NULL )
@@ -88,6 +89,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
                        SetVtkInteractorStyleBaseView( theInteractorStyleBaseView );                    
                }
                configureSelectionROI( spc );
+               configureTextNumberOfContour();
        }
 
        //------------------------------------------------------------------------------------------------------------
@@ -237,9 +239,9 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
                manViewerContour->RefreshContour();                     
                addToScene( theKeyName );
        }
-       //------------------------------------------------------------------------------------------------------------
-       void wxVtkBaseView_SceneManager :: configureSelectionROI( double * spc )
-       {
+//------------------------------------------------------------------------------------------------------------
+void wxVtkBaseView_SceneManager :: configureSelectionROI( double * spc )
+{
                _controlerSelectionROI = new manualRoiControler();
                _viewerSelectionROI = new manualViewRoi();
                _modelSelectionROI = new manualContourModel();
@@ -255,10 +257,34 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
                _controlerSelectionROI->SetModelView( _modelSelectionROI , _viewerSelectionROI );
                ((vtkInteractorStyleBaseView*)_wxVtk_BaseView->GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _controlerSelectionROI );
                _controlerSelectionROI->SetActive(false);
-       }
+}
 
-       //------------------------------------------------------------------------------------------------------------
-       ContourWrap_ViewControl * wxVtkBaseView_SceneManager :: insertWrap( std::string theKeyName, manualContourBaseControler * manContourControl, manualViewBaseContour  * manViewerContour )
+//------------------------------------------------------------------------------------------------------------
+void wxVtkBaseView_SceneManager::configureTextNumberOfContour()
+{
+       // Text Window Level
+       vtkTextActor *textActor = vtkTextActor::New();
+       textActor->SetDisplayPosition(10, 85);
+       textActor->SetInput("contours:--");
+       // Set coordinates to match the old vtkScaledTextActor default value
+       textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();
+       textActor->GetPosition2Coordinate()->SetValue( 0.2 , 0.2 );
+       vtkTextProperty *tprop = textActor->GetTextProperty();
+       tprop->SetFontSize(14);
+       tprop->SetFontFamilyToArial();
+       tprop->SetColor(1, 1, 0);
+       _wxVtk_BaseView->GetRenderer()->AddActor2D(textActor);
+       _numberOfContoursTextActor=textActor;
+}
+
+//------------------------------------------------------------------------------------------------------------
+void wxVtkBaseView_SceneManager::SetLabelNumberOfContours( std::string label )
+{
+       _numberOfContoursTextActor->SetInput( label.c_str() );
+}
+
+//------------------------------------------------------------------------------------------------------------
+ContourWrap_ViewControl * wxVtkBaseView_SceneManager :: insertWrap( std::string theKeyName, manualContourBaseControler * manContourControl, manualViewBaseContour  * manViewerContour )
        {       
                ContourWrap_ViewControl * newContourWrap = new ContourWrap_ViewControl(manContourControl, manViewerContour);
                if(_contours_ViewControl == NULL)
@@ -522,30 +548,34 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
                if( !append )
                {
                        removeSceneContours();                  
-               }               
+               } // if !append
+
                _sceneContours_ViewControl->insert(std::pair <std::string, ContourWrap_ViewControl *> ( theKeyName, contourWRP ) );             
-               if ( visualization )
+
+               if ( visualization==true )
                {
                        contourWRP->getViewer()->AddCompleteContourActor( ifShowCtrlPoints );
-               }
+               } // if visualization
 
-               if( control )
+               if( control==true )
                {
                        ((vtkInteractorStyleBaseView*)_wxVtk_BaseView->GetInteractorStyleBaseView())->AddInteractorStyleMaracas( contourWRP->getControler() );
-               }
+               } // if contour
 
                if( !control )
                {
                        contourWRP->getViewer()->SetColorNormalContour(1,0,0);
                } else {
                        contourWRP->getViewer()->SetColorNormalContour(0,0,1);
-               }
+               } // if !contour
 
-               if( ifActive )
+               if( ifActive==true )
                {
                        contourWRP->getControler()->SetActive( true );  
                        contourWRP->getViewer()->RemoveTextActor();
-               }
+               } // if ifActive
+
+               contourWRP->getViewer()->SetShowText(_showTextContour);
        }
 
        //------------------------------------------------------------------------------------------------------------
@@ -1241,6 +1271,11 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
                } // if 
        }
 
+       void wxVtkBaseView_SceneManager::SetShowTextContour(bool show)
+       {
+               _showTextContour = show;
+       }
+
        bool wxVtkBaseView_SceneManager::isEditableCControler(std::string theKeyName){
                
                ContourWrap_ViewControl* ccon = getContourWrap_ViewControlOf(theKeyName);
index ecc6a5111afd3a193d295e287d3d212b35731495..219962f5b46efadd640e7c08a87f6fe608875576 100644 (file)
@@ -210,6 +210,7 @@ class wxVtkBaseView_SceneManager : public InteractorStyleMaracas {
        int                       GetImageDataSizeZ();
        void              GetImageDataRange( double *range );
        void              SetWidthContour(double width);
+       void              SetShowTextContour(bool show);
 
 //JCP 21 - 09 - 08
        bool isEditableCControler(std::string theKeyName);
@@ -217,10 +218,14 @@ class wxVtkBaseView_SceneManager : public InteractorStyleMaracas {
        bool isCtrlPressed();
        bool isShiftPressed();
        char getLastKeyCode();
+
+       void SetLabelNumberOfContours( std::string label );
+
 private:
        //------------------------------------------------------------------------------------------------------------
        //  Private methods
        //------------------------------------------------------------------------------------------------------------
+       void configureTextNumberOfContour();
 
        
        //------------------------------------------------------------------------------------------------------------
@@ -260,6 +265,8 @@ private:
        double                                                                                          _widthOfControlPoint;
        bool                                                                                            _ctrlKey;
        bool                                                                                            _shiftKey;
+       bool                                                                                            _showTextContour;
+       vtkTextActor                                                                            *_numberOfContoursTextActor;
 };
 #endif // __wxVtkBaseView_SceneManager_HEADER_FILE__