ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkProgressAccumulator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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  typedef Object Superclass;
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 RegisterInternalFilter(GenericFilterType *filter, float weight);
83 
87  void UnregisterAllFilters();
88 
95 #if ! defined ( ITK_FUTURE_LEGACY_REMOVE )
96  void ResetProgress();
97 #endif
98 
111 #if ! defined ( ITK_FUTURE_LEGACY_REMOVE )
112  void ResetFilterProgressAndKeepAccumulatedProgress();
113 #endif
114 
115 protected:
117  virtual ~ProgressAccumulator();
118  virtual void PrintSelf(std::ostream & s, Indent indent) const ITK_OVERRIDE;
119 
120 private:
124 
126  struct FilterRecord {
127  // Pointer to the filter
129 
130  // The weight of the filter in total progress of the mini-pipeline
131  float Weight;
132 
133  // The tags for adding/removing observers to mini-pipeline filter
134  unsigned long ProgressObserverTag;
135  unsigned long StartObserverTag;
136  };
137 
139  void ReportProgress(Object *object, const EventObject & event);
140 
143 
145  typedef std::vector< struct FilterRecord > FilterRecordVector;
146 
149 
152 
158 
161 };
162 } // End namespace itk
163 
164 #endif // __itkProgressAccumulator_h_
Light weight base class for most itk classes.
GenericFilterPointer m_MiniPipelineFilter
GenericFilterType::Pointer GenericFilterPointer
SmartPointer< Self > Pointer
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
CommandType::Pointer CommandPointer
A Command subclass that calls a pointer to a member function.
Definition: itkCommand.h:85
std::vector< struct FilterRecord > FilterRecordVector
MemberCommand< Self > CommandType
SmartPointer< const Self > ConstPointer
Abstraction of the Events used to communicating among filters and with GUIs.
Facilitates progress reporting for filters that wrap around multiple other filters.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for most ITK classes.
Definition: itkObject.h:57