From 2154a89395b7e9869b0e3dea859425d52a5aa9bd Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Fri, 27 May 2016 15:33:30 +0200 Subject: [PATCH] #2961 creaMaracasVisu Feature New Normal - new SliderMinMax-flexible complexbox --- bbtk/bbs/boxes/SliderMinMax-flexible.bbg | 236 ++++++++++++++++++ bbtk/bbs/boxes/SliderMinMax-flexible.bbs | 94 +++++++ bbtk/src/bbmaracasvisuSliderMinMax.cxx | 2 +- .../ColorLayerImageView.cxx | 5 +- .../ThresholdImageView/LayerImageBase.cxx | 31 ++- 5 files changed, 353 insertions(+), 15 deletions(-) create mode 100644 bbtk/bbs/boxes/SliderMinMax-flexible.bbg create mode 100644 bbtk/bbs/boxes/SliderMinMax-flexible.bbs diff --git a/bbtk/bbs/boxes/SliderMinMax-flexible.bbg b/bbtk/bbs/boxes/SliderMinMax-flexible.bbg new file mode 100644 index 0000000..9f6aace --- /dev/null +++ b/bbtk/bbs/boxes/SliderMinMax-flexible.bbg @@ -0,0 +1,236 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /tmpEED/creaTools/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/SliderMinMax-flexible.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:TRUE +COMPLEXBOXNAME:SliderMinMax-flexible +PACKAGENAME:creaMaracasVisu +COMPLEXOUTPUTS:5 +COMPLEX_PORT +outstart +-6.908744:-75.660317:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +outend +14.459976:-71.566034:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +outactual +-27.760752:-75.746436:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +boxchange +-55.446038:-81.180513:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +widget +48.417303:-81.270796:-900.000000 +FIN_COMPLEX_PORT +COMPLEXINPUTS:3 +COMPLEX_PORT +minIn +-93.366735:127.318274:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +maxIn +59.415195:128.107845:-900.000000 +FIN_COMPLEX_PORT +COMPLEX_PORT +showactual +-20.726231:117.843426:-900.000000 +FIN_COMPLEX_PORT +BOXES:12 +BOX +creaMaracasVisu:SliderMinMax:Box02 +ISEXEC:FALSE +-13.746804:37.276148:-900.000000 +40.733196:27.276148:-900.000000 +PORT +ShowActual:"false" +PORT +ShowLabels:"1" +FIN_BOX +BOX +wx:LayoutLine:Box04 +ISEXEC:FALSE +6.780515:-8.164363:-900.000000 +64.340515:-18.164363:-900.000000 +PORT +Orientation:"H" +PORT +WinTitle:"integer" +FIN_BOX +BOX +wx:InputText:Box05 +ISEXEC:FALSE +-85.579149:90.776322:-900.000000 +-40.004149:80.776322:-900.000000 +PORT +In:"0" +PORT +Title:"Min" +FIN_BOX +BOX +wx:InputText:Box06 +ISEXEC:FALSE +30.105048:89.547704:-900.000000 +75.680048:79.547704:-900.000000 +PORT +In:"2000" +PORT +Title:"Max" +FIN_BOX +BOX +std:MultipleInputs:Box09 +ISEXEC:FALSE +-22.255748:65.999804:-900.000000 +23.319252:55.999804:-900.000000 +FIN_BOX +BOX +std:SharedMemory:Box08 +ISEXEC:FALSE +-85.227892:-39.232829:-900.000000 +-39.652892:-49.232829:-900.000000 +FIN_BOX +BOX +std:SharedMemory:Box10 +ISEXEC:FALSE +97.336689:-38.318654:-900.000000 +142.911689:-48.318654:-900.000000 +FIN_BOX +BOX +wx:LayoutTab:Box11 +ISEXEC:FALSE +13.169337:-39.363933:-900.000000 +70.729337:-49.363933:-900.000000 +FIN_BOX +BOX +wx:LayoutLine:Box12 +ISEXEC:FALSE +97.179346:10.704674:-900.000000 +154.739346:0.704674:-900.000000 +PORT +Orientation:"H" +PORT +WinTitle:"float" +FIN_BOX +BOX +wx:InputText:Box13 +ISEXEC:FALSE +76.212141:29.821233:-900.000000 +121.787141:19.821233:-900.000000 +PORT +In:"0.0" +PORT +Title:"Min" +FIN_BOX +BOX +wx:InputText:Box14 +ISEXEC:FALSE +132.435429:31.145617:-900.000000 +178.010429:21.145617:-900.000000 +PORT +In:"1.0" +PORT +Title:"Max" +FIN_BOX +BOX +std:MultipleInputs:Box15 +ISEXEC:FALSE +-25.248762:-32.262307:-900.000000 +20.326238:-42.262307:-900.000000 +FIN_BOX +CONNECTIONS:29 +CONNECTION +Box02:Widget:Box04:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box06:Widget:Box04:Widget3 +NumberOfControlPoints:0 +CONNECTION +Box05:Widget:Box04:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box05:Out:Box02:InMin +NumberOfControlPoints:0 +CONNECTION +Box06:Out:Box02:InMax +NumberOfControlPoints:0 +CONNECTION +Box09:BoxChange:Box02:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box06:BoxChange:Box09:In2 +NumberOfControlPoints:0 +CONNECTION +Box05:BoxChange:Box09:In1 +NumberOfControlPoints:0 +CONNECTION +Box02:OutActual:outactual:outactual +NumberOfControlPoints:0 +CONNECTION +minIn:minIn:Box05:In +NumberOfControlPoints:0 +CONNECTION +maxIn:maxIn:Box06:In +NumberOfControlPoints:0 +CONNECTION +showactual:showactual:Box02:ShowActual +NumberOfControlPoints:0 +CONNECTION +Box02:OutStart:Box08:In1 +NumberOfControlPoints:0 +CONNECTION +Box02:OutEnd:Box10:In1 +NumberOfControlPoints:0 +CONNECTION +Box05:Out:Box02:InMinShow +NumberOfControlPoints:0 +CONNECTION +Box06:Out:Box02:InMaxShow +NumberOfControlPoints:0 +CONNECTION +Box10:Out:outend:outend +NumberOfControlPoints:0 +CONNECTION +Box08:Out:outstart:outstart +NumberOfControlPoints:0 +CONNECTION +Box04:Widget:Box11:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box11:Widget:widget:widget +NumberOfControlPoints:0 +CONNECTION +Box13:Widget:Box12:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box14:Widget:Box12:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box12:Widget:Box11:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box13:Out:Box08:In +NumberOfControlPoints:0 +CONNECTION +Box14:Out:Box10:In +NumberOfControlPoints:0 +CONNECTION +Box13:BoxChange:Box15:In1 +NumberOfControlPoints:0 +CONNECTION +Box14:BoxChange:Box15:In2 +NumberOfControlPoints:0 +CONNECTION +Box02:BoxChange:Box15:In3 +NumberOfControlPoints:0 +CONNECTION +Box15:BoxChange:boxchange:boxchange +NumberOfControlPoints:0 +APP_END diff --git a/bbtk/bbs/boxes/SliderMinMax-flexible.bbs b/bbtk/bbs/boxes/SliderMinMax-flexible.bbs new file mode 100644 index 0000000..e9c304f --- /dev/null +++ b/bbtk/bbs/boxes/SliderMinMax-flexible.bbs @@ -0,0 +1,94 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box) +# - /tmpEED/creaTools/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/SliderMinMax-flexible.bbs +# ---------------------------------- + +include std +include itkvtk +include creaMaracasVisu +include wx +include std + +define SliderMinMax-flexible creaMaracasVisu + +author "Author ??" +description "Description ??" + +category "" + +new creaMaracasVisu:SliderMinMax Box02 + set Box02.ShowActual "false" + set Box02.ShowLabels "1" + +new wx:LayoutLine Box04 + set Box04.Orientation "H" + set Box04.WinTitle "integer" + +new wx:InputText Box05 + set Box05.In "0" + set Box05.Title "Min" + +new wx:InputText Box06 + set Box06.In "2000" + set Box06.Title "Max" + +new std:MultipleInputs Box09 + +new std:SharedMemory Box08 + +new std:SharedMemory Box10 + +new wx:LayoutTab Box11 + +new wx:LayoutLine Box12 + set Box12.Orientation "H" + set Box12.WinTitle "float" + +new wx:InputText Box13 + set Box13.In "0.0" + set Box13.Title "Min" + +new wx:InputText Box14 + set Box14.In "1.0" + set Box14.Title "Max" + +new std:MultipleInputs Box15 + + +connect Box02.Widget Box04.Widget2 +connect Box06.Widget Box04.Widget3 +connect Box05.Widget Box04.Widget1 +connect Box05.Out Box02.InMin +connect Box06.Out Box02.InMax +connect Box09.BoxChange Box02.BoxExecute +connect Box06.BoxChange Box09.In2 +connect Box05.BoxChange Box09.In1 +connect Box02.OutStart Box08.In1 +connect Box02.OutEnd Box10.In1 +connect Box05.Out Box02.InMinShow +connect Box06.Out Box02.InMaxShow +connect Box04.Widget Box11.Widget1 +connect Box13.Widget Box12.Widget1 +connect Box14.Widget Box12.Widget2 +connect Box12.Widget Box11.Widget2 +connect Box13.Out Box08.In +connect Box14.Out Box10.In +connect Box13.BoxChange Box15.In1 +connect Box14.BoxChange Box15.In2 +connect Box02.BoxChange Box15.In3 + +# Complex input ports +input minIn Box05.In " " +input maxIn Box06.In " " +input showactual Box02.ShowActual " " + +# Complex output ports +output outactual Box02.OutActual " " +output outend Box10.Out " " +output outstart Box08.Out " " +output widget Box11.Widget " " +output boxchange Box15.BoxChange " " + +message + +endefine diff --git a/bbtk/src/bbmaracasvisuSliderMinMax.cxx b/bbtk/src/bbmaracasvisuSliderMinMax.cxx index 0b22df7..16cd7e2 100644 --- a/bbtk/src/bbmaracasvisuSliderMinMax.cxx +++ b/bbtk/src/bbmaracasvisuSliderMinMax.cxx @@ -111,10 +111,10 @@ void SliderMinMax::Process() if (firsttime==true) { firsttime=false; - mwxwidget -> setRepresentedValues( bbGetInputInMin(), bbGetInputInMax() ); mwxwidget -> SetStart(bbGetInputInMinShow()); mwxwidget -> SetEnd(bbGetInputInMaxShow()); } + mwxwidget -> setRepresentedValues( bbGetInputInMin(), bbGetInputInMax() ); bbSetOutputOutStart(mwxwidget->GetStart()); bbSetOutputOutEnd(mwxwidget->GetEnd()); bbSetOutputOutActual(mwxwidget->GetActual()); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx index 38f25f3..f3760e9 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageView.cxx @@ -318,8 +318,11 @@ void ColorLayerImageView::ConfigLookupTable() // virtual SetDefaultBaseColorAndGreyLevelBoundary(); } else { // If at least one color has been set, set the grey level boundaries to build an equipartition of the image grey levels, keeping the base colors defined. - if (GetBaseColorNb() != (int)_grey_level_boundary.size() ) + if (GetBaseColorNb() != (int)_grey_level_boundary.size()-1 ) { + +printf("EED ColorLayerImageView::ConfigLookupTable() %d %d\n", GetBaseColorNb() , (int)_grey_level_boundary.size()+1 ); + std::cout << "CM ColorLayerImageView::ConfigLookupTable : ERROR!!! Inconsistency between the sizes of vectors _base_color and _grey_level_boundary. _base_color.size()/3 (=" <<_base_color.size()/3 << ") should be equal to _grey_level_boundary.size() - 1 (=" << _grey_level_boundary.size() - 1 << ")." << std::endl; std::cout << "CM The default values for the base colors and the grey level boundaries will be set." << std::endl; SetDefaultGreyLevelBoundary(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx index 8f1fc5e..d7e3e72 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx @@ -173,7 +173,23 @@ bool LayerImageBase::GetActorPresent() void LayerImageBase::SetImage(vtkImageData* image) { int ext[6]; + double spcBase[3]; int dimensionOriginalLayer[3]; + int dimBase[6]; + + ext[0]=0; + ext[1]=0; + ext[2]=0; + ext[3]=0; + ext[4]=0; + ext[5]=0; + spcBase[0]=0; + spcBase[1]=0; + spcBase[2]=0; + spcBase[3]=0; + spcBase[4]=0; + spcBase[5]=0; + _image = image; _image->GetWholeExtent(ext); dimensionOriginalLayer[0] = ext[1]-ext[0]+1; @@ -188,13 +204,11 @@ void LayerImageBase::SetImage(vtkImageData* image) vtkImageData *imagebase = GetwxVtkBaseView()->GetVtkBaseData()->GetImageData(); if (imagebase!=NULL) { - int dimBase[6]; imagebase->GetWholeExtent(ext); dimBase[0]=ext[1]-ext[0]+1; dimBase[1]=ext[3]-ext[2]+1; dimBase[2]=ext[5]-ext[4]+1; SetDimensionBase(dimBase); - double spcBase[3]; imagebase->GetSpacing(spcBase); SetSpcBase(spcBase); SetX( dimBase[0]*spcBase[0]/2 ); @@ -318,7 +332,6 @@ void LayerImageBase::SetwxVtkBaseView(wxVtkBaseView *baseview) ColorLayerObserver *colorlayerobserver = ColorLayerObserver::New(); _baseView->GetVtkBaseData()->AddObserver( 1, colorlayerobserver ); colorlayerobserver->SetLayerImageBase(this); - } // if _baseView } @@ -347,42 +360,34 @@ vtkLookupTable* LayerImageBase::GetThresholdTable() //---------------------------------------------------------------------------- void LayerImageBase::CleanXYZ(double &x, double &y, double &z) { - if (x<0) { x=0; } - if (y<0) { y=0; } - if (z<0) { z=0; } - double maxSize; - maxSize=_dimOriginalLayer[0]*_newSpcLayer[0]; if ( x > maxSize ) { x=maxSize; } - maxSize=_dimOriginalLayer[1]*_newSpcLayer[1]; if ( y > maxSize ) { y = maxSize; } - maxSize=_dimOriginalLayer[2]*_newSpcLayer[2]; if ( z > maxSize ) { z = maxSize; } - /* @@ -503,8 +508,8 @@ void LayerImageBase::onThreshold() _thresholdMapper->SetLookupTable( _thresholdTable ); _thresholdActor->SetInput( _thresholdMapper->GetOutput() ); -// _scalarbarActor->SetLookupTable( _thresholdTable ); - _scalarbarActor->SetLookupTable( _thresholdMapper->GetLookupTable() ); + _scalarbarActor->SetLookupTable( _thresholdTable ); +// _scalarbarActor->SetLookupTable( _thresholdMapper->GetLookupTable() ); _scalarbarActor->SetTitle("Value"); _scalarbarActor->SetNumberOfLabels(4); int fontsize = _scalarbarActor->GetLabelTextProperty()->GetFontSize(); -- 2.47.1