ITK  5.3.0
Insight Toolkit
itkProgressAccumulator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkProgressAccumulator_h
19 #define itkProgressAccumulator_h
20 
21 #include "itkCommand.h"
22 #include "itkProcessObject.h"
23 #include <vector>
24 
25 namespace itk
26 {
40 class ITKCommon_EXPORT ProgressAccumulator : public Object
41 {
42 public:
43 
46  using Superclass = Object;
49 
53 
55  itkNewMacro(Self);
56 
58  itkTypeMacro(ProgressAccumulator, Object);
59 
61  itkGetConstMacro(AccumulatedProgress, float);
62 
64  itkSetObjectMacro(MiniPipelineFilter, ProcessObject);
65 
67  itkGetModifiableObjectMacro(MiniPipelineFilter, ProcessObject);
68 
82  void
83  RegisterInternalFilter(GenericFilterType * filter, float weight);
84 
88  void
89  UnregisterAllFilters();
90 
97 #if !defined(ITK_LEGACY_REMOVE)
98  void
99  ResetProgress();
100 #endif
101 
114 #if !defined(ITK_LEGACY_REMOVE)
115  void
116  ResetFilterProgressAndKeepAccumulatedProgress();
117 #endif
118 
119 protected:
121  ~ProgressAccumulator() override;
122  void
123  PrintSelf(std::ostream & os, Indent indent) const override;
124 
125 private:
129 
132  {
133  // Pointer to the filter
135 
136  // The weight of the filter in total progress of the mini-pipeline
137  float Weight;
138 
139  // The tags for adding/removing observers to mini-pipeline filter
140  unsigned long ProgressObserverTag;
141  unsigned long StartObserverTag;
142  };
143 
145  void
146  ReportProgress(Object * who, const EventObject & event);
147 
150 
152  using FilterRecordVector = std::vector<struct FilterRecord>;
153 
156 
159 
165 
168 };
169 } // End namespace itk
170 
171 #endif // itkProgressAccumulator_h_
itk::ProgressAccumulator::FilterRecord::Filter
GenericFilterPointer Filter
Definition: itkProgressAccumulator.h:134
itk::ProgressAccumulator::m_BaseAccumulatedProgress
float m_BaseAccumulatedProgress
Definition: itkProgressAccumulator.h:158
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ProgressAccumulator::FilterRecord::Weight
float Weight
Definition: itkProgressAccumulator.h:137
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::ProgressAccumulator::m_AccumulatedProgress
float m_AccumulatedProgress
Definition: itkProgressAccumulator.h:155
itk::ProgressAccumulator::m_FilterRecord
FilterRecordVector m_FilterRecord
Definition: itkProgressAccumulator.h:164
itkProcessObject.h
itk::ProgressAccumulator
Facilitates progress reporting for filters that wrap around multiple other filters.
Definition: itkProgressAccumulator.h:40
itk::MemberCommand
A Command subclass that calls a pointer to a member function.
Definition: itkCommand.h:86
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProgressAccumulator::FilterRecord
Definition: itkProgressAccumulator.h:131
itk::ProgressAccumulator::m_MiniPipelineFilter
GenericFilterPointer m_MiniPipelineFilter
Definition: itkProgressAccumulator.h:149
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::ProcessObject
class ITK_FORWARD_EXPORT ProcessObject
Definition: itkDataObject.h:41
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
itk::EventObject
Abstraction of the Events used to communicating among filters and with GUIs.
Definition: itkEventObject.h:57
itkCommand.h
itk::ProgressAccumulator::FilterRecord::StartObserverTag
unsigned long StartObserverTag
Definition: itkProgressAccumulator.h:141
itk::ProgressAccumulator::FilterRecord::ProgressObserverTag
unsigned long ProgressObserverTag
Definition: itkProgressAccumulator.h:140
itk::ProgressAccumulator::m_CallbackCommand
CommandPointer m_CallbackCommand
Definition: itkProgressAccumulator.h:167
itk::ProgressAccumulator::FilterRecordVector
std::vector< struct FilterRecord > FilterRecordVector
Definition: itkProgressAccumulator.h:152