Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
mitkStepper.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkStepper_h
14 #define mitkStepper_h
15 
16 #include "mitkNumericTypes.h"
17 #include <MitkCoreExports.h>
18 #include <mitkCommon.h>
19 
20 #include <itkObject.h>
21 #include <itkObjectFactory.h>
22 
23 #include <string>
24 
25 namespace mitk
26 {
47  class MITKCORE_EXPORT Stepper : public itk::Object
48  {
49  public:
51  itkFactorylessNewMacro(Self);
52  itkCloneMacro(Self);
53  itkGetConstMacro(Pos, unsigned int);
54 
55  virtual void SetPos(unsigned int pos)
56  {
57  // copied from itkMacro.h, itkSetClampMacro(...)
58  unsigned int newPos;
59  if (m_Steps != 0)
60  {
61  newPos = (pos > m_Steps - 1 ? m_Steps - 1 : pos);
62  }
63  else
64  {
65  newPos = 0;
66  }
67 
68  if (this->m_Pos != newPos)
69  {
70  this->m_Pos = newPos;
71  this->Modified();
72  }
73  }
74 
75  itkGetConstMacro(Steps, unsigned int);
76  itkSetMacro(Steps, unsigned int);
77 
78  itkGetConstMacro(AutoRepeat, bool);
79  itkSetMacro(AutoRepeat, bool);
80  itkBooleanMacro(AutoRepeat);
81 
83  itkSetMacro(PingPong, bool);
84  itkGetConstMacro(PingPong, bool);
85  itkBooleanMacro(PingPong);
86 
89  itkSetMacro(InverseDirection, bool);
90  itkGetConstMacro(InverseDirection, bool);
91  itkBooleanMacro(InverseDirection);
92 
93  void SetRange(ScalarType min, ScalarType max);
94  void InvalidateRange();
95  ScalarType GetRangeMin() const;
96  ScalarType GetRangeMax() const;
97  bool HasValidRange() const;
98  void RemoveRange();
99  bool HasRange() const;
100 
101  void SetUnitName(const char *unitName);
102  const char *GetUnitName() const;
103  void RemoveUnitName();
104  bool HasUnitName() const;
105 
106  virtual void Next();
107 
108  virtual void Previous();
109 
110  virtual void MoveSlice(int sliceDelta);
111 
112  virtual void First();
113 
114  virtual void Last();
115 
116  protected:
117  Stepper();
118  ~Stepper() override;
119 
120  void Increase();
121 
122  void Decrease();
123 
124  unsigned int m_Pos;
125 
126  unsigned int m_Steps;
127 
129 
132 
137 
138  std::string m_UnitName;
140  };
141 
142 } // namespace mitk
143 
144 #endif
mitk::Stepper::m_RangeMin
ScalarType m_RangeMin
Definition: mitkStepper.h:133
mitk::Stepper::SetPos
virtual void SetPos(unsigned int pos)
Definition: mitkStepper.h:55
mitk::Stepper::m_Steps
unsigned int m_Steps
Definition: mitkStepper.h:126
mitk::Stepper::m_UnitName
std::string m_UnitName
Definition: mitkStepper.h:138
mitkClassMacroItkParent
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::Stepper::m_InverseDirection
bool m_InverseDirection
Definition: mitkStepper.h:131
mitk::Stepper::m_RangeValid
bool m_RangeValid
Definition: mitkStepper.h:135
mitk::Stepper::m_AutoRepeat
bool m_AutoRepeat
Definition: mitkStepper.h:128
MitkCoreExports.h
mitk::Stepper
Helper class to step through a list.
Definition: mitkStepper.h:47
mitkNumericTypes.h
mitkCommon.h
mitk::Stepper::m_HasUnitName
bool m_HasUnitName
Definition: mitkStepper.h:139
mitk::Stepper::m_HasRange
bool m_HasRange
Definition: mitkStepper.h:136
mitk::Stepper::m_RangeMax
ScalarType m_RangeMax
Definition: mitkStepper.h:134
mitk::Stepper::m_PingPong
bool m_PingPong
Definition: mitkStepper.h:130
mitk::Stepper::m_Pos
unsigned int m_Pos
Definition: mitkStepper.h:124
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20