From cef231b63d21ad7ac9914306a0a012666c24f00a Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Mon, 6 Jun 2016 21:35:33 +0200 Subject: [PATCH] #2971 creaMaracasVisu Feature New Normal - ColorLayerImage ColorBar position --- bbtk/bbs/boxes/Measure3DLength_Widget.bbg | 29 +++- bbtk/bbs/boxes/Measure3DLength_Widget.bbs | 36 +++-- bbtk/bbs/boxes/SliderMinMax-flexible.bbg | 132 +++++++++++------- bbtk/bbs/boxes/SliderMinMax-flexible.bbs | 33 +++-- .../bbcreaMaracasVisuColorLayerImageView.cxx | 8 ++ .../bbcreaMaracasVisuColorLayerImageView.h | 3 + .../bbmaracasvisuImageChangeInformation.cxx | 16 +-- .../ColorLayerImageViewManager.cxx | 14 ++ .../ColorLayerImageViewManager.h | 1 + .../ColorLayerImageViewPanel.cxx | 4 +- .../ThresholdImageView/LayerImageBase.cxx | 43 +++--- .../ThresholdImageView/LayerImageBase.h | 4 + 12 files changed, 211 insertions(+), 112 deletions(-) diff --git a/bbtk/bbs/boxes/Measure3DLength_Widget.bbg b/bbtk/bbs/boxes/Measure3DLength_Widget.bbg index 169fd71..dd5cf9a 100644 --- a/bbtk/bbs/boxes/Measure3DLength_Widget.bbg +++ b/bbtk/bbs/boxes/Measure3DLength_Widget.bbg @@ -1,6 +1,6 @@ # ---------------------------------- # - BBTKGEditor v 1.4 BBG BlackBox Diagram file -# - /home/davila/Creatis/creaTools/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/Measure3DLength_Widget.bbg +# - /tmpEED/creaTools/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/Measure3DLength_Widget.bbg # ---------------------------------- APP_START @@ -32,7 +32,7 @@ COMPLEX_PORT point 16.233479:122.637795:-900.000000 FIN_COMPLEX_PORT -BOXES:13 +BOXES:14 BOX vtk:vtkImageDataPointerRelay:Box17 ISEXEC:FALSE @@ -68,8 +68,10 @@ FIN_BOX BOX wx:OutputText:Box34 ISEXEC:FALSE --115.357081:-42.579068:-900.000000 --69.782081:-52.579068:-900.000000 +-120.431062:-30.355387:-900.000000 +-74.856062:-40.355387:-900.000000 +PORT +Title:"Units" FIN_BOX BOX wx:LayoutLine:Box35 @@ -115,7 +117,15 @@ ISEXEC:FALSE -58.228353:0.397139:-900.000000 12.946647:-9.602861:-900.000000 FIN_BOX -CONNECTIONS:28 +BOX +wx:OutputText:Box13 +ISEXEC:FALSE +-105.274407:-45.411981:-900.000000 +-59.699407:-55.411981:-900.000000 +PORT +Title:"Voxels" +FIN_BOX +CONNECTIONS:31 CONNECTION vtkimagedata:vtkimagedata:Box17:In NumberOfControlPoints:0 @@ -200,4 +210,13 @@ NumberOfControlPoints:0 CONNECTION Box31:BoxChange:Box36:BoxExecute NumberOfControlPoints:0 +CONNECTION +Box42:LengthVoxels:Box13:In +NumberOfControlPoints:0 +CONNECTION +Box13:Widget:Box35:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box31:BoxChange:Box13:BoxExecute +NumberOfControlPoints:0 APP_END diff --git a/bbtk/bbs/boxes/Measure3DLength_Widget.bbs b/bbtk/bbs/boxes/Measure3DLength_Widget.bbs index ac4328d..2d9d86a 100644 --- a/bbtk/bbs/boxes/Measure3DLength_Widget.bbs +++ b/bbtk/bbs/boxes/Measure3DLength_Widget.bbs @@ -1,6 +1,6 @@ # ---------------------------------- # - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box) -# - /home/davila/Creatis/creaTools/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/Measure3DLength_Widget.bbs +# - /tmpEED/creaTools/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/Measure3DLength_Widget.bbs # ---------------------------------- include std @@ -17,33 +17,37 @@ description "Evaluates the sum of the Euclidean distances among the points in th category "example" -new vtkImageDataPointerRelay Box17 +new vtk:vtkImageDataPointerRelay Box17 -new MagicBox Box24 +new std:MagicBox Box24 -new ShowNPoints Box31 +new creaMaracasVisu:ShowNPoints Box31 -new LayoutSplit Box32 +new wx:LayoutSplit Box32 set Box32.Proportion "10" -new LayoutTab Box33 +new wx:LayoutTab Box33 -new OutputText Box34 +new wx:OutputText Box34 + set Box34.Title "Units" -new LayoutLine Box35 +new wx:LayoutLine Box35 -new DrawAxe3D Box36 +new creaMaracasVisu:DrawAxe3D Box36 -new ImageVtkProperties Box38 +new vtk:ImageVtkProperties Box38 -new Transform Box39 +new vtk:Transform Box39 -new UpdateRender Box41 +new vtk:UpdateRender Box41 set Box41.Active "true" -new MeasureLength Box42 +new vtk:MeasureLength Box42 -new PointsXYZtoVTKPoints Box43 +new vtk:PointsXYZtoVTKPoints Box43 + +new wx:OutputText Box13 + set Box13.Title "Voxels" connect Box17.Out Box31.Image @@ -69,6 +73,9 @@ connect Box31.lstPointsZ Box43.LstPointsZ connect Box31.BoxChange Box34.BoxExecute connect Box17.Out Box42.ImageData connect Box31.BoxChange Box36.BoxExecute +connect Box42.LengthVoxels Box13.In +connect Box13.Widget Box35.Widget2 +connect Box31.BoxChange Box13.BoxExecute # Complex input ports input vtkimagedata Box17.In " " @@ -79,5 +86,6 @@ input boxexecute Box31.BoxExecute " " # Complex output ports output widget Box33.Widget " " +message endefine diff --git a/bbtk/bbs/boxes/SliderMinMax-flexible.bbg b/bbtk/bbs/boxes/SliderMinMax-flexible.bbg index 9f6aace..8f21862 100644 --- a/bbtk/bbs/boxes/SliderMinMax-flexible.bbg +++ b/bbtk/bbs/boxes/SliderMinMax-flexible.bbg @@ -34,22 +34,26 @@ FIN_COMPLEX_PORT COMPLEXINPUTS:3 COMPLEX_PORT minIn --93.366735:127.318274:-900.000000 +-73.142665:123.211222:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT maxIn -59.415195:128.107845:-900.000000 +67.267728:127.270782:-900.000000 FIN_COMPLEX_PORT COMPLEX_PORT showactual --20.726231:117.843426:-900.000000 +-1.476857:124.516542:-900.000000 FIN_COMPLEX_PORT -BOXES:12 +BOXES:14 BOX creaMaracasVisu:SliderMinMax:Box02 ISEXEC:FALSE --13.746804:37.276148:-900.000000 -40.733196:27.276148:-900.000000 +-12.321577:26.349409:-900.000000 +42.158423:16.349409:-900.000000 +PORT +InMax:"2000" +PORT +InMaxShow:"2000" PORT ShowActual:"false" PORT @@ -68,8 +72,8 @@ FIN_BOX BOX wx:InputText:Box05 ISEXEC:FALSE --85.579149:90.776322:-900.000000 --40.004149:80.776322:-900.000000 +-86.792132:90.521284:-900.000000 +-41.217132:80.521284:-900.000000 PORT In:"0" PORT @@ -78,8 +82,8 @@ FIN_BOX BOX wx:InputText:Box06 ISEXEC:FALSE -30.105048:89.547704:-900.000000 -75.680048:79.547704:-900.000000 +31.125200:89.547704:-900.000000 +76.700200:79.547704:-900.000000 PORT In:"2000" PORT @@ -92,22 +96,18 @@ ISEXEC:FALSE 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 +97.529520:-38.318654:-900.000000 +143.104520:-48.318654:-900.000000 +PORT +In:"2000" FIN_BOX BOX wx:LayoutTab:Box11 ISEXEC:FALSE -13.169337:-39.363933:-900.000000 -70.729337:-49.363933:-900.000000 +21.747888:-40.059491:-900.000000 +79.307888:-50.059491:-900.000000 FIN_BOX BOX wx:LayoutLine:Box12 @@ -122,8 +122,8 @@ FIN_BOX BOX wx:InputText:Box13 ISEXEC:FALSE -76.212141:29.821233:-900.000000 -121.787141:19.821233:-900.000000 +72.106029:31.364213:-900.000000 +117.681029:21.364213:-900.000000 PORT In:"0.0" PORT @@ -142,10 +142,28 @@ FIN_BOX BOX std:MultipleInputs:Box15 ISEXEC:FALSE --25.248762:-32.262307:-900.000000 -20.326238:-42.262307:-900.000000 +-29.653964:-38.754183:-900.000000 +15.921036:-48.754183:-900.000000 +FIN_BOX +BOX +std:MagicBox:Box16 +ISEXEC:FALSE +-79.546253:108.370419:-900.000000 +-33.971253:98.370419:-900.000000 +FIN_BOX +BOX +std:MagicBox:Box17 +ISEXEC:FALSE +43.097521:111.309388:-900.000000 +88.672521:101.309388:-900.000000 +FIN_BOX +BOX +std:SharedMemory:Box18 +ISEXEC:FALSE +-106.391039:-33.391884:-900.000000 +-60.816039:-43.391884:-900.000000 FIN_BOX -CONNECTIONS:29 +CONNECTIONS:35 CONNECTION Box02:Widget:Box04:Widget2 NumberOfControlPoints:0 @@ -159,9 +177,6 @@ CONNECTION Box05:Out:Box02:InMin NumberOfControlPoints:0 CONNECTION -Box06:Out:Box02:InMax -NumberOfControlPoints:0 -CONNECTION Box09:BoxChange:Box02:BoxExecute NumberOfControlPoints:0 CONNECTION @@ -174,63 +189,84 @@ CONNECTION Box02:OutActual:outactual:outactual NumberOfControlPoints:0 CONNECTION -minIn:minIn:Box05:In +showactual:showactual:Box02:ShowActual NumberOfControlPoints:0 CONNECTION -maxIn:maxIn:Box06:In +Box02:OutEnd:Box10:In1 NumberOfControlPoints:0 CONNECTION -showactual:showactual:Box02:ShowActual +Box05:Out:Box02:InMinShow NumberOfControlPoints:0 CONNECTION -Box02:OutStart:Box08:In1 +Box10:Out:outend:outend NumberOfControlPoints:0 CONNECTION -Box02:OutEnd:Box10:In1 +Box04:Widget:Box11:Widget1 NumberOfControlPoints:0 CONNECTION -Box05:Out:Box02:InMinShow +Box11:Widget:widget:widget NumberOfControlPoints:0 CONNECTION -Box06:Out:Box02:InMaxShow +Box13:Widget:Box12:Widget1 NumberOfControlPoints:0 CONNECTION -Box10:Out:outend:outend +Box14:Widget:Box12:Widget2 NumberOfControlPoints:0 CONNECTION -Box08:Out:outstart:outstart +Box12:Widget:Box11:Widget2 NumberOfControlPoints:0 CONNECTION -Box04:Widget:Box11:Widget1 +Box13:BoxChange:Box15:In1 NumberOfControlPoints:0 CONNECTION -Box11:Widget:widget:widget +Box14:BoxChange:Box15:In2 NumberOfControlPoints:0 CONNECTION -Box13:Widget:Box12:Widget1 +Box02:BoxChange:Box15:In3 NumberOfControlPoints:0 CONNECTION -Box14:Widget:Box12:Widget2 +Box15:BoxChange:boxchange:boxchange NumberOfControlPoints:0 CONNECTION -Box12:Widget:Box11:Widget2 +Box06:Out:Box02:InMax NumberOfControlPoints:0 CONNECTION -Box13:Out:Box08:In +Box06:Out:Box02:InMaxShow NumberOfControlPoints:0 CONNECTION -Box14:Out:Box10:In +Box06:Out:Box10:In2 NumberOfControlPoints:0 CONNECTION -Box13:BoxChange:Box15:In1 +Box14:Out:Box10:In3 NumberOfControlPoints:0 CONNECTION -Box14:BoxChange:Box15:In2 +minIn:minIn:Box16:In NumberOfControlPoints:0 CONNECTION -Box02:BoxChange:Box15:In3 +Box16:Out:Box05:In NumberOfControlPoints:0 CONNECTION -Box15:BoxChange:boxchange:boxchange +maxIn:maxIn:Box17:In +NumberOfControlPoints:0 +CONNECTION +Box17:Out:Box06:In +NumberOfControlPoints:0 +CONNECTION +Box17:Out:Box10:In +NumberOfControlPoints:0 +CONNECTION +Box18:Out:outstart:outstart +NumberOfControlPoints:0 +CONNECTION +Box16:Out:Box18:In +NumberOfControlPoints:0 +CONNECTION +Box02:OutStart:Box18:In1 +NumberOfControlPoints:0 +CONNECTION +Box05:Out:Box18:In2 +NumberOfControlPoints:0 +CONNECTION +Box13:Out:Box18:In3 NumberOfControlPoints:0 APP_END diff --git a/bbtk/bbs/boxes/SliderMinMax-flexible.bbs b/bbtk/bbs/boxes/SliderMinMax-flexible.bbs index e9c304f..7ca223f 100644 --- a/bbtk/bbs/boxes/SliderMinMax-flexible.bbs +++ b/bbtk/bbs/boxes/SliderMinMax-flexible.bbs @@ -17,6 +17,8 @@ description "Description ??" category "" new creaMaracasVisu:SliderMinMax Box02 + set Box02.InMax "2000" + set Box02.InMaxShow "2000" set Box02.ShowActual "false" set Box02.ShowLabels "1" @@ -34,9 +36,8 @@ new wx:InputText Box06 new std:MultipleInputs Box09 -new std:SharedMemory Box08 - new std:SharedMemory Box10 + set Box10.In "2000" new wx:LayoutTab Box11 @@ -54,40 +55,52 @@ new wx:InputText Box14 new std:MultipleInputs Box15 +new std:MagicBox Box16 + +new std:MagicBox Box17 + +new std:SharedMemory Box18 + 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 +connect Box06.Out Box02.InMax +connect Box06.Out Box02.InMaxShow +connect Box06.Out Box10.In2 +connect Box14.Out Box10.In3 +connect Box16.Out Box05.In +connect Box17.Out Box06.In +connect Box17.Out Box10.In +connect Box16.Out Box18.In +connect Box02.OutStart Box18.In1 +connect Box05.Out Box18.In2 +connect Box13.Out Box18.In3 # Complex input ports -input minIn Box05.In " " -input maxIn Box06.In " " input showactual Box02.ShowActual " " +input minIn Box16.In " " +input maxIn Box17.In " " # Complex output ports output outactual Box02.OutActual " " output outend Box10.Out " " -output outstart Box08.Out " " output widget Box11.Widget " " output boxchange Box15.BoxChange " " +output outstart Box18.Out " " message diff --git a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx index e803c53..81391bf 100644 --- a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx +++ b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx @@ -57,6 +57,9 @@ void ColorLayerImageView::Process() 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 ); @@ -108,6 +111,11 @@ void ColorLayerImageView::bbUserSetDefaultValues() bbSetInputWxVtkBaseView(NULL); bbSetInputWxVtkBaseView1(NULL); bbSetInputWxVtkBaseView2(NULL); + + std::vector lstColorBarPosition; + lstColorBarPosition.push_back(10); + lstColorBarPosition.push_back(105); + bbSetInputColorBarPosition(lstColorBarPosition); } //===== // Don't edit this file. This file is generated from xml description.. diff --git a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h index 5fbe03e..c8ea6ea 100644 --- a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h +++ b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h @@ -57,6 +57,7 @@ class bbcreaMaracasVisu_EXPORT ColorLayerImageView BBTK_DECLARE_INPUT(lstRangeForColorBar,std::vector); BBTK_DECLARE_INPUT(PlainOrGradientColor,bool); BBTK_DECLARE_INPUT(FittingMode,int); + BBTK_DECLARE_INPUT(ColorBarPosition,std::vector); BBTK_DECLARE_OUTPUT(NewImage,vtkImageData*); BBTK_PROCESS(Process); void Process(); @@ -92,6 +93,8 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ColorLayerImageView,bbtk::WxBlackBox); BBTK_INPUT(ColorLayerImageView,PlainOrGradientColor,"true=Plane false=Gradient (Default 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_INPUT(ColorLayerImageView,ColorBarPosition,"default (10,80)",std::vector,""); + BBTK_OUTPUT(ColorLayerImageView,NewImage,"Image with correct Spacing",vtkImageData*,""); diff --git a/bbtk/src/bbmaracasvisuImageChangeInformation.cxx b/bbtk/src/bbmaracasvisuImageChangeInformation.cxx index de4e0fc..ed61f76 100644 --- a/bbtk/src/bbmaracasvisuImageChangeInformation.cxx +++ b/bbtk/src/bbmaracasvisuImageChangeInformation.cxx @@ -36,23 +36,21 @@ void ImageChangeInformation::Process() double spc[3]; vtkImageData* img = bbGetInputIn(); if(img!=NULL){ - if(mchange != NULL){ + if(mchange != NULL) + { mchange->Delete(); } mchange = vtkImageChangeInformation::New(); img->GetExtent( ext ); - double origin[3]; origin[0]=0.0; origin[1]=0.0; origin[2]=0.0; - img->SetOrigin(origin); - mchange->SetInput( img ); mchange->SetExtentTranslation( -ext[0], -ext[2], -ext[4] ); mchange->SetOutputOrigin (0, 0, 0); - + mchange->SetOutputExtentStart(0,0,0); if (bbGetInputNewSpacing().size()==3) { spc[0] = bbGetInputNewSpacing()[0]; @@ -60,15 +58,11 @@ void ImageChangeInformation::Process() spc[2] = bbGetInputNewSpacing()[2]; mchange->SetOutputSpacing( spc[0] , spc[1] , spc [2] ); //spacing } - - mchange->Update(); //important - bbSetOutputOut( mchange->GetOutput() ); - } - - + } } + void ImageChangeInformation::bbUserSetDefaultValues() { mchange = NULL; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.cxx index bc06bfd..8fdaa7c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.cxx @@ -207,6 +207,20 @@ void ColorLayerImageViewManager::SetRangeForColorBar(std::vector &range) } // for } +//---------------------------------------------------------------------------- +void ColorLayerImageViewManager::SetColorBarPosition(std::vector &colorbarposition) +{ + int i, size=_colorLayerImageViewLst.size(); + for (i=0;iSetColorBarPosition( colorbarposition ); + } // if + } // for +} + + //---------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.h index 06194fe..b086e9e 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.h @@ -57,6 +57,7 @@ class ColorLayerImageViewManager void SetGreyLevelBoundaries(std::vector & grey_level_boundary); void SetBaseTransparence(std::vector & base_transparence); void SetRangeForColorBar(std::vector & range); + void SetColorBarPosition(std::vector & colorbarposition); double GetGreyLevelBoundaries(unsigned int index); void SetPlainOrGradientColor(bool color_type); int GetBaseColorNb(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx index 5f08d62..ff0f053 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx @@ -163,7 +163,7 @@ ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, in _sl_SliceImageZ->Enable(false); _interpolationCheckBox = new wxCheckBox(this, -1, _T("Interpole") ); _interpolationCheckBox->SetValue(true); - _opacity = new wxSlider(this, wxID_ANY, 6, 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); + _opacity = new wxSlider(this, wxID_ANY, 1, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); // _histogram = new Histogram( this , -1, wxPoint(0,0), wxSize(400,400), /*wxNO_BORDER*/ wxBORDER_DEFAULT ); // _histogramMinMaxLevel = new HistogramMinMaxLevel( (HistogramBase*)_histogram ); @@ -218,7 +218,7 @@ ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, in sizer = new wxFlexGridSizer(2); _interpolationCheckBox = new wxCheckBox(this, -1, _T("Interpolate") ); _interpolationCheckBox->SetValue(true); - _opacity = new wxSlider(this, wxID_ANY, 6, 0, 10, wxDefaultPosition, wxSize(2,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); + _opacity = new wxSlider(this, wxID_ANY, 1, 0, 100, wxDefaultPosition, wxSize(2,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdInterpolation ); Connect( _opacity->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &ColorLayerImageViewPanel::onChangeOpacity ); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx index d7e3e72..f2ebd6f 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx @@ -67,7 +67,7 @@ class ColorLayerObserver : public vtkCommand{ _layerimagebase->SetX( vtkmprbasedata->GetX() ); _layerimagebase->SetY( vtkmprbasedata->GetY() ); _layerimagebase->SetZ( vtkmprbasedata->GetZ() ); - _layerimagebase->onThresholdChange(); + _layerimagebase->onThresholdChange(); } // if basedata } // if wxvtkbaseview @@ -191,6 +191,7 @@ void LayerImageBase::SetImage(vtkImageData* image) spcBase[5]=0; _image = image; + _image->Update(); _image->GetWholeExtent(ext); dimensionOriginalLayer[0] = ext[1]-ext[0]+1; dimensionOriginalLayer[1] = ext[3]-ext[2]+1; @@ -216,7 +217,6 @@ void LayerImageBase::SetImage(vtkImageData* image) SetZ( dimBase[2]*spcBase[2]/2 ); } // if imagebase } // if wxvtkbaseview - _image->Update(); _image->GetScalarRange( _range ); _thresholdTable = vtkLookupTable::New(); @@ -301,6 +301,12 @@ void LayerImageBase::GetDimensionBase(int *dim) } +//------------------------------------------------------------------------------ +void LayerImageBase::SetColorBarPosition(std::vector &colorbarposition) +{ + _colorBarPosition=colorbarposition; +} + //------------------------------------------------------------------------------ void LayerImageBase::SetRangeForColorBar(std::vector &range) { @@ -389,24 +395,6 @@ void LayerImageBase::CleanXYZ(double &x, double &y, double &z) z = maxSize; } -/* - - if ( x > (ext[1]-ext[0]) ) - { - z=ext[1]-ext[0]; - } - - if ( y > (ext[3]-ext[2]) ) - { - z=ext[3]-ext[2]; - } - - if ( z > (ext[5]-ext[4]) ) - { - z=ext[5]-ext[4]; - } -*/ - } //---------------------------------------------------------------------------- @@ -418,10 +406,12 @@ void LayerImageBase::onThreshold() double y=GetY(); double z=GetZ(); + x = x*_spcBase[0]; y = y*_spcBase[1]; z = z*_spcBase[2]; + CleanXYZ(x,y,z); vtkCamera *camera = _baseView->GetRenderer()->GetActiveCamera(); @@ -432,6 +422,7 @@ void LayerImageBase::onThreshold() directionViewer = wxvtk2dbasevie->GetDirection(); } // ParallelProjection + if (!GetActorPresent()) { if (_thresholdTable==NULL) @@ -449,8 +440,16 @@ void LayerImageBase::onThreshold() { _thresholdActor = vtkImageActor::New( ); _scalarbarActor = vtkScalarBarActor::New(); - _thresholdActor->SetOpacity( 0.6 ); + if (_colorBarPosition.size()==2) + { + _scalarbarActor->SetDisplayPosition(_colorBarPosition[0],_colorBarPosition[1]); + } else { + _scalarbarActor->SetDisplayPosition(0,0); + } + + _thresholdActor->SetOpacity( 0 ); _thresholdActor->InterpolateOn( ); + if (directionViewer==0) { _thresholdActor->SetPosition( 900-1,0,0 ); @@ -553,7 +552,7 @@ void LayerImageBase::onThresholdChangeOpacity (int opacity) { if (_actorPresent) { - _thresholdActor->SetOpacity(opacity*0.1); + _thresholdActor->SetOpacity(opacity/100.0); } } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h index 0a9f0c0..5e8dcac 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h @@ -92,8 +92,10 @@ class LayerImageBase vtkImageData* GetImage(); void SetRangeForColorBar(std::vector &range); void GetRangeForColorBar(double &minRange, double &maxRange); + void SetColorBarPosition(std::vector &colorbarposition); void SetwxVtkBaseView(wxVtkBaseView *baseview); + void onThreshold(); void onThresholdChange(); void onThresholdInterpolation(bool interpolate); @@ -151,6 +153,8 @@ class LayerImageBase vtkLookupTable *GetThresholdTable(); double _range[2]; std::vector _rangeForColorBar; + std::vector _colorBarPosition; + }; -- 2.45.0