ITK  6.0.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 * https://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
25namespace itk
26{
40class ITKCommon_EXPORT ProgressAccumulator : public Object
41{
42public:
43
49
53
55 itkNewMacro(Self);
56
58 itkOverrideGetNameOfClassMacro(ProgressAccumulator);
59
61 itkGetConstMacro(AccumulatedProgress, float);
62
64 itkSetObjectMacro(MiniPipelineFilter, ProcessObject);
65
67 itkGetModifiableObjectMacro(MiniPipelineFilter, ProcessObject);
68
82 void
84
88 void
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
119protected:
122 void
123 PrintSelf(std::ostream & os, Indent indent) const override;
124
125private:
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 float AccumulatedProgress{ 0.0 };
144 };
145
147 void
148 ReportProgress(Object * who, const EventObject & event);
149
151 GenericFilterPointer m_MiniPipelineFilter{};
152
154 using FilterRecordVector = std::vector<struct FilterRecord>;
155
157 float m_AccumulatedProgress{};
158
160 float m_BaseAccumulatedProgress{};
161
166 FilterRecordVector m_FilterRecord{};
167
169 CommandPointer m_CallbackCommand{};
170};
171} // End namespace itk
172
173#endif // itkProgressAccumulator_h_
Abstraction of the Events used to communicating among filters and with GUIs.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
A Command subclass that calls a pointer to a member function.
Definition: itkCommand.h:87
Base class for most ITK classes.
Definition: itkObject.h:62
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Facilitates progress reporting for filters that wrap around multiple other filters.
~ProgressAccumulator() override
void RegisterInternalFilter(GenericFilterType *filter, float weight)
std::vector< struct FilterRecord > FilterRecordVector
void ReportProgress(Object *who, const EventObject &event)
void PrintSelf(std::ostream &os, Indent indent) const override
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
class ITK_FORWARD_EXPORT ProcessObject
Definition: itkDataObject.h:41