From: Eduardo DAVILA Date: Mon, 16 Sep 2019 13:23:37 +0000 (+0200) Subject: #3306 creaMaracasVisu Feature New Normal - Clean Code X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=542063db4a06b1a74587bcab7d5c450ebdd53272;p=creaMaracasVisu.git #3306 creaMaracasVisu Feature New Normal - Clean Code --- diff --git a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx index 0fc2242..6681598 100644 --- a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx +++ b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx @@ -42,46 +42,34 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ColorLayerImageView,bbtk::WxBlackBox); void ColorLayerImageView::Process() { ColorLayerImageViewPanel *clivp = (ColorLayerImageViewPanel*)bbGetOutputWidget(); - if (firsttime==true) { // firsttime=false; clivp->SetActive( bbGetInputActive() ); } - clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 0 , bbGetInputWxVtkBaseView() ); clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 1 , bbGetInputWxVtkBaseView1() ); clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 2 , bbGetInputWxVtkBaseView2() ); - std::vector range = bbGetInputlstRangeForColorBar(); clivp->GetColorLayerImageViewManager()->SetRangeForColorBar( range ); - std::vector colorbarposition = bbGetInputColorBarPosition(); clivp->GetColorLayerImageViewManager()->SetColorBarPosition( colorbarposition ); - std::vector base_color = bbGetInputlstBaseColor(); clivp->GetColorLayerImageViewManager()->SetBaseColors( base_color ); - std::vector grey_level_boundaries = bbGetInputlstGreyLevelBoundaries(); clivp->GetColorLayerImageViewManager()->SetGreyLevelBoundaries( grey_level_boundaries ); - std::vector transparence_level_boundaries = bbGetInputlstTransparenceBoundaries(); clivp->GetColorLayerImageViewManager()->SetBaseTransparence( transparence_level_boundaries ); - clivp->GetColorLayerImageViewManager()->SetPlainOrGradientColor( bbGetInputPlainOrGradientColor() ); clivp->SetFittingMode( bbGetInputFittingMode() ); - clivp->SetImage( bbGetInputIn() ); - bbSetOutputNewImage( clivp->GetColorLayerImageViewManager()->GetImageChangeInformation(0) ); bbSetOutputLookupTable( clivp->GetColorLayerImageViewManager()->GetLookupTable(0) ); - if (firsttime==true) { firsttime=false; clivp->ChangeOpacity(); } - } //===== // Don't edit this file. This file is generated from xml description.. diff --git a/bbtk/src/bbmaracasvisuViewerNV.cxx b/bbtk/src/bbmaracasvisuViewerNV.cxx index fd98d87..4a8cd28 100644 --- a/bbtk/src/bbmaracasvisuViewerNV.cxx +++ b/bbtk/src/bbmaracasvisuViewerNV.cxx @@ -57,13 +57,11 @@ void bbwxMaracas_N_ViewersWidget::OnRefreshView(wxCommandEvent & event) { //printf("CPR: bbwxMaracas_N_ViewersWidget::OnRefreshView -> actualiza X, Y y Z\n"); mbbViewerNV->_point.clear(); - mbbViewerNV->_point.push_back( (int)GetX() ); mbbViewerNV->_point.push_back( (int)GetY() ); mbbViewerNV->_point.push_back( (int)GetZ() ); mbbViewerNV->bbSetOutputPoint( mbbViewerNV->_point ); mbbViewerNV->bbSignalOutputModification(std::string("Point")); - wxMaracas_N_ViewersWidget::OnRefreshView(event); } @@ -104,8 +102,7 @@ void ViewerNV::Process() _point.push_back((int)_mwxwidget->GetY()); _point.push_back((int)_mwxwidget->GetZ()); bbSetOutputPoint(_point); - // WxBlackBox::Process(); -// mwxwidget->SetImage(img ); + wxVtkBaseView *wvbv1 = _mwxwidget->GetwxVtkBaseView(1); wxVtkBaseView *wvbv2 = _mwxwidget->GetwxVtkBaseView(2); wxVtkBaseView *wvbv3 = _mwxwidget->GetwxVtkBaseView(3); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx index 75fa8c3..a40409e 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx @@ -76,18 +76,14 @@ wxwindow4 = NULL; _currentwxw = NULL; mvtkmprbasedata = NULL; - wxSizer *sizer = new wxBoxSizer(wxVERTICAL); this->SetSizer(sizer); this->SetAutoLayout(true); - - - if(imagedata!=NULL && nTypeView!=NULL ){ + if(imagedata!=NULL && nTypeView!=NULL ) + { this->SetType(nTypeView); this->UpdateLayout(imagedata); } - - } /** * @pre A wxWindow* object must be provided as a parent for the viewer and the type of layout for the viewer @@ -318,7 +314,6 @@ //this->Layout(); //this->Refresh(); - // I don't undestand how this works and not the opposite ... if (wxwindow4!=NULL) {wxwindow4->ConfigureVTK(); } if (wxwindow3!=NULL) {wxwindow3->ConfigureVTK(); } @@ -341,7 +336,6 @@ if (wxwindow2!=NULL) { wxwindow2->SetImage(image); } if (wxwindow3!=NULL) { wxwindow3->SetImage(image); } if (wxwindow4!=NULL) { wxwindow4->SetImage(image); } - // ConfigureVTK(); } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx index b90dbaf..a9e9e1d 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx @@ -410,56 +410,51 @@ void wxMaracas_ViewerWidget::Refresh(bool eraseBackground ,const wxRect* rect ) //------------------------------------------------------------------------- - void wxMaracas_ViewerWidget::SetImage( vtkImageData *image ) +void wxMaracas_ViewerWidget::SetImage( vtkImageData *image ) +{ + if(mvtkmprbasedata !=NULL) + { + marImageData* mar = mvtkmprbasedata->GetMarImageData(); + mar->removeImageData(0); + mar->AddImageData(image); + } + if (mvtk2Dbaseview!=NULL) { - if(mvtkmprbasedata !=NULL) - { - marImageData* mar = mvtkmprbasedata->GetMarImageData(); - mar->removeImageData(0); - mar->AddImageData(image); - } - - if (mvtk2Dbaseview!=NULL) - { mvtk2Dbaseview->SetImageToVtkViewer(image); - } - - if (mvtkmpr2Dview_X!=NULL) - { - mvtkmpr2Dview_X->SetImageToVtkViewer(image); - } - if (mvtkmpr2Dview_Y!=NULL) - { - mvtkmpr2Dview_Y->SetImageToVtkViewer(image); - } - if (mvtkmpr2Dview_Z!=NULL) - { - mvtkmpr2Dview_Z->SetImageToVtkViewer(image); - } - - if (mvtkplane2Dview!=NULL) - { - // ??? EED 10 oct 2012 - } - if (mwxsphereview!=NULL) - { - mwxsphereview->SetImage(); - } - if (mwxvtkclipping3Dview!=NULL) - { - mwxvtkclipping3Dview->GetVtkClipping3DDataViewer()->SetImage(); - } - - if (mwxvtkmpr3Dview!=NULL) - { - mwxvtkmpr3Dview->SetImage(); - } + } + if (mvtkmpr2Dview_X!=NULL) + { + mvtkmpr2Dview_X->SetImageToVtkViewer(image); + } + if (mvtkmpr2Dview_Y!=NULL) + { + mvtkmpr2Dview_Y->SetImageToVtkViewer(image); + } + if (mvtkmpr2Dview_Z!=NULL) + { + mvtkmpr2Dview_Z->SetImageToVtkViewer(image); + } + if (mvtkplane2Dview!=NULL) + { + // ??? EED 10 oct 2012 + } + if (mwxsphereview!=NULL) + { + mwxsphereview->SetImage(); + } + if (mwxvtkclipping3Dview!=NULL) + { + mwxvtkclipping3Dview->GetVtkClipping3DDataViewer()->SetImage(); + } + if (mwxvtkmpr3Dview!=NULL) + { + mwxvtkmpr3Dview->SetImage(); + } //EED 26/11/2009 // ConfigureVTK(); // RefreshView(); - - } +} //------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx index 2377256..c32af32 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx @@ -336,7 +336,6 @@ void wxVtkMPR3DView::SetImage() // -- Plane widget _probe->SetSourceData( imageData ); #endif - _vtkmpr3Ddataviewer->SetImage(); } diff --git a/lib/maracasVisuLib/src/kernel/marImageData.cpp b/lib/maracasVisuLib/src/kernel/marImageData.cpp index 3dfa8d4..db028be 100644 --- a/lib/maracasVisuLib/src/kernel/marImageData.cpp +++ b/lib/maracasVisuLib/src/kernel/marImageData.cpp @@ -114,19 +114,21 @@ vtkImageData *marImageData::GetImageData() void marImageData::removeImageData(int index) { - if(index < _imagedataLST.size()){ + if(index < _imagedataLST.size()) + { /*vtkImageData* img = _imagedataLST[index]; if(img->GetReferenceCount()>1){ img->SetReferenceCount(img->GetReferenceCount()-1); //img->Delete(); }*/ - for(int i = index; i < _imagedataLST.size()-1; i++){ + for(int i = index; i < _imagedataLST.size()-1; i++) + { _imagedataLST[i] = _imagedataLST[i+1]; - } + }// for _imagedataLST.pop_back(); //delete img; - } + } // if } // ---------------------------------------------------------------------------------------------- int marImageData::GetXOriginal(int value)