00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkProgressAccumulator_h_
00018 #define __itkProgressAccumulator_h_
00019
00020 #include "itkCommand.h"
00021 #include "itkObject.h"
00022 #include "itkProcessObject.h"
00023 #include <vector>
00024
00025 namespace itk {
00026
00039 class ITKCommon_EXPORT ProgressAccumulator : public Object
00040 {
00041 public:
00043 typedef ProgressAccumulator Self;
00044 typedef Object Superclass;
00045 typedef SmartPointer<Self> Pointer;
00046 typedef SmartPointer<const Self> ConstPointer;
00047
00049 typedef ProcessObject GenericFilterType;
00050 typedef GenericFilterType::Pointer GenericFilterPointer;
00051
00053 itkNewMacro(Self);
00054
00056 itkTypeMacro(ProgressAccumulator,Object);
00057
00059 itkGetMacro(AccumulatedProgress,float);
00060
00062 itkSetObjectMacro(MiniPipelineFilter,ProcessObject);
00063
00065 itkGetConstObjectMacro(MiniPipelineFilter,ProcessObject);
00066
00071 void RegisterInternalFilter(GenericFilterType *filter, float weight);
00072
00076 void UnregisterAllFilters();
00077
00083 void ResetProgress();
00084 void ResetFilterProgressAndKeepAccumulatedProgress();
00085
00086 protected:
00087 ProgressAccumulator();
00088 virtual ~ProgressAccumulator();
00089 void PrintSelf(std::ostream &s, Indent indent) const;
00090
00091 private:
00093 typedef MemberCommand< Self > CommandType;
00094 typedef CommandType::Pointer CommandPointer;
00095
00097 struct FilterRecord
00098 {
00099
00100 GenericFilterPointer Filter;
00101
00102
00103 float Weight;
00104
00105
00106 unsigned long ProgressObserverTag;
00107 unsigned long IterationObserverTag;
00108
00109
00110 float Progress;
00111 };
00112
00114 void ReportProgress(Object * object, const EventObject & event);
00115
00117 GenericFilterPointer m_MiniPipelineFilter;
00118
00120 typedef std::vector<struct FilterRecord> FilterRecordVector;
00121
00123 float m_AccumulatedProgress;
00124
00126 float m_BaseAccumulatedProgress;
00127
00132 FilterRecordVector m_FilterRecord;
00133
00135 CommandPointer m_CallbackCommand;
00136 };
00137
00138 }
00139
00140 #endif // __itkProgressAccumulator_h_
00141