Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkSlicerScalarBarActor.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Portions (c) Copyright Brigham and Women's Hospital (BWH) All Rights Reserved.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  This file was originally developed by Kevin Wang, Princess Margaret Cancer Centre
17  and was supported by Cancer Care Ontario (CCO)'s ACRU program
18  with funds provided by the Ontario Ministry of Health and Long-Term Care
19  and Ontario Consortium for Adaptive Interventions in Radiation Oncology (OCAIRO)
20 
21 ==============================================================================*/
22 
27 
28 #ifndef __vtkSlicerScalarBarActor_h
29 #define __vtkSlicerScalarBarActor_h
30 
31 // VTK includes
32 #include "vtkScalarBarActor.h"
33 #include "vtkStringArray.h"
34 #include "vtkVersion.h"
35 
36 // MRMLLogic includes
37 #include "vtkSlicerColorsModuleVTKWidgetsExport.h"
38 
40 class VTK_SLICER_COLORS_VTKWIDGETS_EXPORT vtkSlicerScalarBarActor
41  : public vtkScalarBarActor
42 {
43 public:
44  // The usual VTK class functions
45  static vtkSlicerScalarBarActor *New();
46  vtkTypeMacro(vtkSlicerScalarBarActor,vtkScalarBarActor);
47  void PrintSelf(ostream& os, vtkIndent indent) override;
48 
50  vtkGetMacro(UseAnnotationAsLabel, int);
52  vtkSetMacro(UseAnnotationAsLabel, int);
54  vtkBooleanMacro(UseAnnotationAsLabel, int);
55 
58  vtkGetMacro(CenterLabel, bool);
61  vtkSetMacro(CenterLabel, bool);
64  vtkBooleanMacro(CenterLabel, bool);
65 
66 protected:
68  ~vtkSlicerScalarBarActor() override;
69 
70  // Description:
71  // Determine the size and placement of any tick marks to be rendered.
72  //
73  // This method must set this->P->TickBox.
74  // It may depend on layout performed by ComputeScalarBarLength.
75  //
76  // The default implementation creates exactly this->NumberOfLabels
77  // tick marks, uniformly spaced on a linear or logarithmic scale.
78  //
79  // It centers labels on color swatches instead of placing labels
80  // at the edge.
81  void LayoutTicks() override;
82 
83  // It centers labels on color swatches instead of placing labels
84  // at the edge.
85  void ConfigureTicks() override;
86 
87  // Modify original behavior by aligning title to the left/right when orientation is vertical.
88  // This allows moving the color bar to the edge of the view, even if the title is long.
89  void PrepareTitleText() override;
90  void ConfigureTitle() override;
91 
94 
96 
97 private:
99  void operator=(const vtkSlicerScalarBarActor&) = delete;
100 };
101 
102 #endif
int UseAnnotationAsLabel
flag for setting color name as label