]> Creatis software - creaMaracasVisu.git/commitdiff
#2971 creaMaracasVisu Feature New Normal - ColorLayerImage ColorBar position
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Mon, 6 Jun 2016 19:35:33 +0000 (21:35 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Mon, 6 Jun 2016 19:35:33 +0000 (21:35 +0200)
12 files changed:
bbtk/bbs/boxes/Measure3DLength_Widget.bbg
bbtk/bbs/boxes/Measure3DLength_Widget.bbs
bbtk/bbs/boxes/SliderMinMax-flexible.bbg
bbtk/bbs/boxes/SliderMinMax-flexible.bbs
bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx
bbtk/src/bbcreaMaracasVisuColorLayerImageView.h
bbtk/src/bbmaracasvisuImageChangeInformation.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewManager.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h

index 169fd71aa32aae0a0f2809adeab34a5c8cf353f9..dd5cf9aa53edc8fefbf6f88f3ac3fbc30efa291f 100644 (file)
@@ -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
index ac4328dea5a661e98fc6df4ca205dae825293f40..2d9d86a31619760bf4c3080d326bdce688c7197c 100644 (file)
@@ -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
index 9f6aace6f02f9de46bbb7990e57c65d21591eac4..8f218627d6bea6ec8b7f394dd7d9a0760b147dd3 100644 (file)
@@ -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
index e9c304f8e628c65c29139210f30cf864d6c496f9..7ca223f6e1c97a4b45961731913ed90db9ca6136 100644 (file)
@@ -17,6 +17,8 @@ description "Description ??"
 category "<VOID>"
 
 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    
 
index e803c5347ac4791e8cb963fe9262f669ef7c4d5d..81391bf0baadec91bfca4ac8771a0ec40e7601fe 100644 (file)
@@ -57,6 +57,9 @@ void ColorLayerImageView::Process()
     std::vector<double> range = bbGetInputlstRangeForColorBar();
     clivp->GetColorLayerImageViewManager()->SetRangeForColorBar( range );
 
+    std::vector<int> colorbarposition = bbGetInputColorBarPosition();
+    clivp->GetColorLayerImageViewManager()->SetColorBarPosition( colorbarposition );
+
     std::vector<double> base_color = bbGetInputlstBaseColor();
     clivp->GetColorLayerImageViewManager()->SetBaseColors( base_color );
 
@@ -108,6 +111,11 @@ void ColorLayerImageView::bbUserSetDefaultValues()
     bbSetInputWxVtkBaseView(NULL);
     bbSetInputWxVtkBaseView1(NULL);
     bbSetInputWxVtkBaseView2(NULL);
+
+       std::vector<int> lstColorBarPosition;
+       lstColorBarPosition.push_back(10);
+       lstColorBarPosition.push_back(105);
+       bbSetInputColorBarPosition(lstColorBarPosition);
 }
 //=====
 // Don't edit this file. This file is generated from xml description..
index 5fbe03e67c134aa31ff68a588b7c8c55bd202c30..c8ea6eab1a6736ffeced6b2bccf068ec7cff7e00 100644 (file)
@@ -57,6 +57,7 @@ class bbcreaMaracasVisu_EXPORT ColorLayerImageView
   BBTK_DECLARE_INPUT(lstRangeForColorBar,std::vector<double>);
   BBTK_DECLARE_INPUT(PlainOrGradientColor,bool);
   BBTK_DECLARE_INPUT(FittingMode,int);
+  BBTK_DECLARE_INPUT(ColorBarPosition,std::vector<int>);
   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<int>,"");
+
   BBTK_OUTPUT(ColorLayerImageView,NewImage,"Image with correct Spacing",vtkImageData*,"");
 
 
index de4e0fc125400976ae792f080943cdeae05eb4c9..ed61f7630ec4b9b713be65fe7080722a0503038b 100644 (file)
@@ -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;
index bc06bfded77c992a6d614819ed56fb3889a7c2ff..8fdaa7c2b4a53befbf1fc84cdeac8e8ea0bfef25 100644 (file)
@@ -207,6 +207,20 @@ void ColorLayerImageViewManager::SetRangeForColorBar(std::vector<double> &range)
   } // for 
 }
 
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::SetColorBarPosition(std::vector<int> &colorbarposition)
+{
+  int i, size=_colorLayerImageViewLst.size();
+  for (i=0;i<size;i++)
+  {
+       if (_colorLayerImageViewLst[i]!=NULL)
+       {
+          _colorLayerImageViewLst[i]->SetColorBarPosition( colorbarposition );
+       } // if 
+  } // for 
+}
+
+
 
 
 //----------------------------------------------------------------------------
index 06194feac52723a90d9bbb1976e5b42753282013..b086e9e78a9376074ae95b8b120483e4ce25df9a 100644 (file)
@@ -57,6 +57,7 @@ class  ColorLayerImageViewManager
          void                          SetGreyLevelBoundaries(std::vector<double> & grey_level_boundary);
          void                          SetBaseTransparence(std::vector<double> & base_transparence);
          void                          SetRangeForColorBar(std::vector<double> & range);
+         void                          SetColorBarPosition(std::vector<int> & colorbarposition);
          double                        GetGreyLevelBoundaries(unsigned int index);
          void                          SetPlainOrGradientColor(bool color_type);
          int                           GetBaseColorNb();
index 5f08d62021a081d794c46d1884032c0c7265303a..ff0f0531493e72e61115a0f300fa40ccce1cb7d0 100644 (file)
@@ -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 );
index d7e3e7284cfb40319a7f7f6176bcbccf876ae29a..f2ebd6f981d0099dcfbbb481bcefa969de89ec17 100644 (file)
@@ -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<int> &colorbarposition)
+{
+   _colorBarPosition=colorbarposition;
+}
+
 //------------------------------------------------------------------------------
 void LayerImageBase::SetRangeForColorBar(std::vector<double> &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);
        }
 }
 
index 0a9f0c0327505c44dac943cbeeb2dcbea726e64c..5e8dcac9a9df2912ba3979206d1e1d1c3c2e3f6b 100644 (file)
@@ -92,8 +92,10 @@ class LayerImageBase
                vtkImageData*   GetImage();
                void                    SetRangeForColorBar(std::vector<double> &range);
                void                    GetRangeForColorBar(double &minRange, double &maxRange);
+               void                    SetColorBarPosition(std::vector<int> &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<double>             _rangeForColorBar;
+               std::vector<int>                        _colorBarPosition;
+
  };