Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
39class VTK_SLICER_COLORS_VTKWIDGETS_EXPORT vtkSlicerScalarBarActor
40 : public vtkScalarBarActor
41{
42public:
43 // The usual VTK class functions
45 vtkTypeMacro(vtkSlicerScalarBarActor,vtkScalarBarActor);
46 void PrintSelf(ostream& os, vtkIndent indent) override;
47
49 vtkGetMacro(UseAnnotationAsLabel, int);
51 vtkSetMacro(UseAnnotationAsLabel, int);
53 vtkBooleanMacro(UseAnnotationAsLabel, int);
54
57 vtkGetMacro(CenterLabel, bool);
60 vtkSetMacro(CenterLabel, bool);
63 vtkBooleanMacro(CenterLabel, bool);
64
65protected:
68
69 // Description:
70 // Determine the size and placement of any tick marks to be rendered.
71 //
72 // This method must set this->P->TickBox.
73 // It may depend on layout performed by ComputeScalarBarLength.
74 //
75 // The default implementation creates exactly this->NumberOfLabels
76 // tick marks, uniformly spaced on a linear or logarithmic scale.
77 //
78 // It centers labels on color swatches instead of placing labels
79 // at the edge.
80 void LayoutTicks() override;
81
82 // It centers labels on color swatches instead of placing labels
83 // at the edge.
84 void ConfigureTicks() override;
85
86 // Modify original behavior by aligning title to the left/right when orientation is vertical.
87 // This allows moving the color bar to the edge of the view, even if the title is long.
88 void PrepareTitleText() override;
89 void ConfigureTitle() override;
90
94 static bool ValidateFormatString(std::string& validatedFormat, std::string& prefix, std::string& suffix,
95 const std::string& requestedFormat, const std::string& typeString);
96
99
101
102private:
104 void operator=(const vtkSlicerScalarBarActor&) = delete;
105};
106
107#endif
static bool ValidateFormatString(std::string &validatedFormat, std::string &prefix, std::string &suffix, const std::string &requestedFormat, const std::string &typeString)
void LayoutTicks() override
void PrepareTitleText() override
void ConfigureTitle() override
void PrintSelf(ostream &os, vtkIndent indent) override
int UseAnnotationAsLabel
flag for setting color name as label
void ConfigureTicks() override
static vtkSlicerScalarBarActor * New()
~vtkSlicerScalarBarActor() override