From 794fbd4c4e96dd9792942301bd31dd0262eda5e2 Mon Sep 17 00:00:00 2001 From: davila Date: Tue, 12 Aug 2014 16:31:09 +0200 Subject: [PATCH] #2440 creaMaracasVisu Feature New Normal - Add Active option to the ColorLayer Box --- .../bbcreaMaracasVisuAddContainerSettings.cxx | 68 +++++++++++-------- .../bbcreaMaracasVisuColorLayerImageView.cxx | 8 ++- .../bbcreaMaracasVisuColorLayerImageView.h | 28 ++++---- .../ColorLayerImageViewPanel.cxx | 27 +++++--- .../ColorLayerImageViewPanel.h | 2 + .../ThresholdImageView/LayerImageBase.cxx | 17 ----- 6 files changed, 78 insertions(+), 72 deletions(-) diff --git a/bbtk/src/bbcreaMaracasVisuAddContainerSettings.cxx b/bbtk/src/bbcreaMaracasVisuAddContainerSettings.cxx index cadab5d..f98873d 100644 --- a/bbtk/src/bbcreaMaracasVisuAddContainerSettings.cxx +++ b/bbtk/src/bbcreaMaracasVisuAddContainerSettings.cxx @@ -8,40 +8,48 @@ BBTK_BLACK_BOX_IMPLEMENTATION(AddContainerSettings,bbtk::AtomicBlackBox); void AddContainerSettings::Process() { - if(bbGetInputIn1()!=NULL){ - m_BCSettingsVector.push_back( bbGetInputIn1() ); - } - if(bbGetInputIn2()!=NULL){ - m_BCSettingsVector.push_back( bbGetInputIn2() ); - } - if(bbGetInputIn3()!=NULL){ - m_BCSettingsVector.push_back( bbGetInputIn3() ); - } - if(bbGetInputIn4()!=NULL){ - m_BCSettingsVector.push_back( bbGetInputIn4() ); - } - if(bbGetInputIn5()!=NULL){ - m_BCSettingsVector.push_back( bbGetInputIn5() ); - } - if(bbGetInputIn6()!=NULL){ - m_BCSettingsVector.push_back( bbGetInputIn6() ); - } - if(bbGetInputIn7()!=NULL){ - m_BCSettingsVector.push_back( bbGetInputIn7() ); - } - if(bbGetInputIn8()!=NULL){ - m_BCSettingsVector.push_back( bbGetInputIn8() ); - } - if(bbGetInputIn9()!=NULL){ - m_BCSettingsVector.push_back( bbGetInputIn9() ); - } - bbSetOutputOut( m_BCSettingsVector ); - + m_BCSettingsVector.clear(); + if(bbGetInputIn1()!=NULL){ + m_BCSettingsVector.push_back( bbGetInputIn1() ); + } + if(bbGetInputIn2()!=NULL){ + m_BCSettingsVector.push_back( bbGetInputIn2() ); + } + if(bbGetInputIn3()!=NULL){ + m_BCSettingsVector.push_back( bbGetInputIn3() ); + } + if(bbGetInputIn4()!=NULL){ + m_BCSettingsVector.push_back( bbGetInputIn4() ); + } + if(bbGetInputIn5()!=NULL){ + m_BCSettingsVector.push_back( bbGetInputIn5() ); + } + if(bbGetInputIn6()!=NULL){ + m_BCSettingsVector.push_back( bbGetInputIn6() ); + } + if(bbGetInputIn7()!=NULL){ + m_BCSettingsVector.push_back( bbGetInputIn7() ); + } + if(bbGetInputIn8()!=NULL){ + m_BCSettingsVector.push_back( bbGetInputIn8() ); + } + if(bbGetInputIn9()!=NULL){ + m_BCSettingsVector.push_back( bbGetInputIn9() ); + } + bbSetOutputOut( m_BCSettingsVector ); } void AddContainerSettings::bbUserSetDefaultValues() { - + bbSetInputIn1(NULL); + bbSetInputIn2(NULL); + bbSetInputIn3(NULL); + bbSetInputIn4(NULL); + bbSetInputIn5(NULL); + bbSetInputIn6(NULL); + bbSetInputIn7(NULL); + bbSetInputIn8(NULL); + bbSetInputIn9(NULL); } void AddContainerSettings::bbUserInitializeProcessing() diff --git a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx index 95b0409..de5de6e 100644 --- a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx +++ b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx @@ -41,10 +41,11 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ColorLayerImageView,bbtk::WxBlackBox); //===== void ColorLayerImageView::Process() { -printf("ColorLayerImageView::Process start\n"); ColorLayerImageViewPanel *clivp = (ColorLayerImageViewPanel*)bbGetOutputWidget(); + clivp->SetActive( bbGetInputActive() ); + clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 0 , bbGetInputWxVtkBaseView() ); clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 1 , bbGetInputWxVtkBaseView1() ); clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 2 , bbGetInputWxVtkBaseView2() ); @@ -60,6 +61,8 @@ printf("ColorLayerImageView::Process start\n"); clivp->SetImage( bbGetInputIn() ); + + // std::string msg; // if (bbGetInputTitle()!="") // { @@ -69,8 +72,6 @@ printf("ColorLayerImageView::Process start\n"); // } // ((wxStaticText*)bbGetOutputWidget())->SetLabel( bbtk::std2wx( msg ) ); -printf("ColorLayerImageView::Process end\n"); - } //===== // Don't edit this file. This file is generated from xml description.. @@ -86,6 +87,7 @@ void ColorLayerImageView::CreateWidget(wxWindow* parent) void ColorLayerImageView::bbUserSetDefaultValues() { bbSetInputIn(NULL); + bbSetInputActive(true); bbSetInputWxVtkBaseView(NULL); bbSetInputWxVtkBaseView1(NULL); bbSetInputWxVtkBaseView2(NULL); diff --git a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h index a7ab2d0..e12f2dd 100644 --- a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h +++ b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h @@ -45,10 +45,11 @@ class bbcreaMaracasVisu_EXPORT ColorLayerImageView //===== // Don't edit this file. This file is generated from xml description.. //===== + BBTK_DECLARE_INPUT(In,vtkImageData*); + BBTK_DECLARE_INPUT(Active,bool); BBTK_DECLARE_INPUT(WxVtkBaseView,wxVtkBaseView *); BBTK_DECLARE_INPUT(WxVtkBaseView1,wxVtkBaseView *); BBTK_DECLARE_INPUT(WxVtkBaseView2,wxVtkBaseView *); - BBTK_DECLARE_INPUT(In,vtkImageData*); BBTK_DECLARE_INPUT(lstBaseColor,std::vector); BBTK_DECLARE_INPUT(lstGreyLevelBoundaries,std::vector); BBTK_DECLARE_INPUT(PlainOrGradientColor,bool); @@ -64,18 +65,19 @@ class bbcreaMaracasVisu_EXPORT ColorLayerImageView }; BBTK_BEGIN_DESCRIBE_BLACK_BOX(ColorLayerImageView,bbtk::WxBlackBox); -BBTK_NAME("ColorLayerImageView"); -BBTK_AUTHOR("Eduardo DAVILA (Creatis)"); -BBTK_DESCRIPTION("Color Layer Image View"); -BBTK_CATEGORY("__CategoryBlackBox__"); -BBTK_INPUT(ColorLayerImageView,WxVtkBaseView," 0 creaMaracasVisuViewer viewer XY,YZ ou XZ",wxVtkBaseView*,""); -BBTK_INPUT(ColorLayerImageView,WxVtkBaseView1," 1 creaMaracasVisuViewer viewer XY,YZ ou XZ",wxVtkBaseView*,""); -BBTK_INPUT(ColorLayerImageView,WxVtkBaseView2," 2 creaMaracasVisuViewer viewer XY,YZ ou XZ",wxVtkBaseView*,""); -BBTK_INPUT(ColorLayerImageView,In,"Input Image",vtkImageData*,""); -BBTK_INPUT(ColorLayerImageView,lstBaseColor,"List of Base Colors in RGB format to define the color map. Requirement: must be of a size being a multiple of 3, with values between 0 and 1. For example, for 2 colors: \"1 0 0 0 0 1\". If not provided as required, the histogram is equally split into three areas, blue, yellow and red.",std::vector,""); -BBTK_INPUT(ColorLayerImageView,lstGreyLevelBoundaries,"List of the Grey Level Boundaries to define the color map (grey level outside the color boundaries will not be disayed). Requirement: Must have one more element than the number of colours. For example, for 2 colors: \"50 150 250\". If not provided as required, the histogram is equally split into areas, which number corresponds to the number of colors provided (3 by default).",std::vector,""); -BBTK_INPUT(ColorLayerImageView,PlainOrGradientColor,"Choose between Plain (true) or Gradient (false) colors. Default is false.",bool,""); -BBTK_INPUT(ColorLayerImageView,FittingMode,"Choose the fitting mode between the images, the transformation can be either by Dimension (1), by Spacing (2) or by Pixel (3). If you want to make the choice through a dialog box, choose (-1). Default is by Pixel (3).",int,""); + BBTK_NAME("ColorLayerImageView"); + BBTK_AUTHOR("Eduardo DAVILA (Creatis)"); + BBTK_DESCRIPTION("Color Layer Image View"); + BBTK_CATEGORY("__CategoryBlackBox__"); + BBTK_INPUT(ColorLayerImageView,In,"Input Image",vtkImageData*,""); + BBTK_INPUT(ColorLayerImageView,Active,"Active True/False (default True)",bool,""); + BBTK_INPUT(ColorLayerImageView,WxVtkBaseView," 0 creaMaracasVisuViewer viewer XY,YZ ou XZ",wxVtkBaseView*,""); + BBTK_INPUT(ColorLayerImageView,WxVtkBaseView1," 1 creaMaracasVisuViewer viewer XY,YZ ou XZ",wxVtkBaseView*,""); + BBTK_INPUT(ColorLayerImageView,WxVtkBaseView2," 2 creaMaracasVisuViewer viewer XY,YZ ou XZ",wxVtkBaseView*,""); + BBTK_INPUT(ColorLayerImageView,lstBaseColor,"List of Base Colors in RGB format to define the color map. Requirement: must be of a size being a multiple of 3, with values between 0 and 1. For example, for 2 colors: \"1 0 0 0 0 1\". If not provided as required, the histogram is equally split into three areas, blue, yellow and red.",std::vector,""); + BBTK_INPUT(ColorLayerImageView,lstGreyLevelBoundaries,"List of the Grey Level Boundaries to define the color map (grey level outside the color boundaries will not be disayed). Requirement: Must have one more element than the number of colours. For example, for 2 colors: \"50 150 250\". If not provided as required, the histogram is equally split into areas, which number corresponds to the number of colors provided (3 by default).",std::vector,""); + BBTK_INPUT(ColorLayerImageView,PlainOrGradientColor,"Choose between Plain (true) or Gradient (false) colors. Default is false.",bool,""); + BBTK_INPUT(ColorLayerImageView,FittingMode,"Choose the fitting mode between the images, the transformation can be either by Dimension (1), by Spacing (2) or by Pixel (3). If you want to make the choice through a dialog box, choose (-1). Default is by Pixel (3).",int,""); BBTK_END_DESCRIBE_BLACK_BOX(ColorLayerImageView); //===== // Don't edit this file. This file is generated from xml description.. diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx index 963a51c..eb38e09 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx @@ -127,28 +127,28 @@ ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, in Connect( _btn_ReadImage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &ColorLayerImageViewPanel::onReadImage ); - Connect( _cb_ShowHide->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdShow ); + Connect( _cb_ShowHide->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdShow ); Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdInterpolation ); Connect( _opacity->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &ColorLayerImageViewPanel::onChangeOpacity ); Connect( _cb_SliceFixDinamic->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceFixDinamic ); Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_LINEUP , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); - Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_LINEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); + Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_LINEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_PAGEUP , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); - Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_PAGEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); + Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_PAGEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_LINEUP , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); - Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_LINEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); + Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_LINEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_PAGEUP , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); - Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_PAGEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); + Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_PAGEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_LINEUP , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); - Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_LINEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); + Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_LINEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_PAGEUP , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); - Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_PAGEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); + Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_PAGEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage ); @@ -307,8 +307,11 @@ void ColorLayerImageViewPanel::SetImage(vtkImageData *img) //EED01 if (_colorLayerImageView!=NULL) //EED01 { //EED01 _colorLayerImageView->onThreshold(); - _colorLayerImageViewManager->onThreshold(); - RefreshView(); + if (_active==true) + { + _colorLayerImageViewManager->onThreshold(); + RefreshView(); + } //EED01 } @@ -471,6 +474,12 @@ bool ColorLayerImageViewPanel::IsVisible() return _thresholdGo; } +//---------------------------------------------------------------------------- +void ColorLayerImageViewPanel::SetActive(bool active) +{ + _active=active; + _cb_ShowHide->SetValue( _active ); +} // EOF diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h index da8489c..35a1c49 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h @@ -75,8 +75,10 @@ class ColorLayerImageViewPanel void SetImage(vtkImageData *img); void SetFittingMode(int fitting_mode); int GetFittingMode(); + void SetActive(bool active); private: + bool _active; int _fitting_mode; int _dimBase[3]; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx index c963498..3884a64 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx @@ -217,14 +217,12 @@ void LayerImageBase::SetImage(vtkImageData* image) //---------------------------------------------------------------------------- void LayerImageBase::SetwxVtkBaseView(wxVtkBaseView *baseview) { - printf("EED LayerImageBase::SetwxVtkBaseView start baseview:%p \n", baseview); if (_baseView==NULL) { _baseView = baseview; vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*)(_baseView->GetInteractorStyleBaseView()); isbv->AddInteractorStyleMaracas( new ColorLayerImageBasevtkInteractor(this) ); } // if _baseView - printf("EED LayerImageBase::SetwxVtkBaseView end \n"); } //---------------------------------------------------------------------------- @@ -236,7 +234,6 @@ wxVtkBaseView *LayerImageBase::GetwxVtkBaseView() //---------------------------------------------------------------------------- void LayerImageBase::Refresh() { - printf("EED LayerImageBase::Refresh\n"); if (_baseView!=NULL) { _baseView->Refresh(); @@ -292,9 +289,6 @@ void LayerImageBase::CleanXYZ(double &x, double &y, double &z) //---------------------------------------------------------------------------- void LayerImageBase::onThreshold() { - - printf("EED LayerImageBase::onThreshold start \n"); - if ((_image!=NULL) && (_baseView!=NULL)) { double spc[3]; @@ -307,10 +301,6 @@ void LayerImageBase::onThreshold() x = x*spc[0]; y = y*spc[1]; z = z*spc[2]; - - - printf("EED LayerImageBase::onThreshold z = %d spcZ%f\n" , z, spc[2]); - vtkCamera *camera = _baseView->GetRenderer()->GetActiveCamera(); int directionViewer=0; @@ -320,9 +310,6 @@ void LayerImageBase::onThreshold() directionViewer = wxvtk2dbasevie->GetDirection(); } // ParallelProjection -printf("EED LayerImageBase::onThreshold projection = %d\n" , camera->GetParallelProjection() ); -printf("EED LayerImageBase::onThreshold direction = %d\n" , directionViewer ); - if (!GetActorPresent()) { @@ -395,12 +382,8 @@ printf("EED LayerImageBase::onThreshold direction = %d\n" , directionViewer ); _thresholdMapper->SetInput( img ); _thresholdMapper->SetLookupTable( _thresholdTable ); _thresholdActor->SetInput( _thresholdMapper->GetOutput() ); - - printf("EED LayerImageBase::onThreshold working \n"); - } // _image - printf("EED LayerImageBase::onThreshold end \n"); } -- 2.47.1