KWStyle - itkLightProcessObject.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkLightProcessObject.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:41 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 #ifndef __itkLightProcessObject_h
18 #define __itkLightProcessObject_h
19
20 #include "itkObject.h"
21 #include "itkObjectFactory.h"
22
23 namespace itk
24 {
25
26 /** \class LightProcessObject
27  * \brief LightProcessObject is the base class for all process objects (source,
28           filters, mappers) in the Insight data processing pipeline.
29  *
30  * LightProcessObject is an abstract object that specifies behavior and
31  * interface of visualization network process objects (sources, filters,
32  * mappers). Source objects are creators of visualization data; filters
33  * input, process, and output visualization data; and mappers transform data
34  * into another form (like rendering primitives or write data to a file).
35  *
36  * A major role of LightProcessObject is to define the inputs and outputs
37  * of a filter. More than one input and/or output may exist for a given
38  * filter. Some classes (e.g., source objects or mapper objects) will
39  * not use inputs (the source) or outputs (mappers). In this case, the
40  * inputs or outputs is just ignored.
41  *
42  * LightProcessObject invokes the following events: 
43  * , Command::StartEvent, Command::EndEvent
44  * These are convenience events you can use for any purpose
45  * (e.g., debugging info, highlighting/notifying user interface, etc.) 
46  * See Command and LightObject for information on using AddObserver.
47  *
48  * Another event Command::ProgressEvent can be observed. Some filters invoke
49  * this event periodically during their execution (with the progress,
50  * parameter, the fraction of work done). The use is similar to that of
51  * StartEvent and EndEvent. Filters may also check their
52  * AbortGenerateData flag to determine whether to prematurally end their
53  * execution.
54  *
55  * An important feature of subclasses of LightProcessObject is that it is
56  * possible to control the memory-management model (i.e., retain output
57  * versus delete output data). If enabled the ReleaseDataFlag enables the
58  * deletion of the output data once the downstream process object finishes
59  * processing the data (please see text).
60  *
61  * Subclasses of LightProcessObject may override 4 of the methods of this class
62  * to control how a given filter may interact with the pipeline (dataflow).
63  * These methods are: GenerateOutputInformation(),
64  * EnlargeOutputRequestedRegion(), GenerateInputRequestedRegion(), and
65  * GenerateOutputRequestedRegion(). By overriding these methods, a filter
66  * can deviate from the base assumptions of the pipeline execution model.
67  *
68  * \ingroup ITKSystemObjects
69  * \ingroup DataProcessing
70  */
71 class ITKCommon_EXPORT LightProcessObject : public Object
72 {
73 public:
74   /** Standard class typedefs. */
75   typedef LightProcessObject       Self;
76 TDA   typedef Object  Superclass;
77 TDA   typedef SmartPointer<Self>  Pointer;
78 TDA   typedef SmartPointer<const Self>  ConstPointer;
79   
80   /** Method for creation through the object factory. */
81   itkNewMacro(Self);
82
83   /** Run-time type information (and related methods). */
84   itkTypeMacro(LightProcessObject,Object);
85
86   /** Set the AbortGenerateData flag for the process object. Process objects
87    *  may handle premature termination of execution in different ways.  */
88   itkSetMacro(AbortGenerateData,bool);
89
90   /** Get the AbortGenerateData flag for the process object. Process objects
91    *  may handle premature termination of execution in different ways.  */
92   itkGetConstReferenceMacro(AbortGenerateData,bool);
93   
94   /** Turn on and off the AbortGenerateData flag. */
95   itkBooleanMacro(AbortGenerateData); 
96   
97   /** Set the execution progress of a process object. The progress is
98    * a floating number between (0,1), 0 meaning no progress; 1 meaning
99    * the filter has completed execution. */
100   itkSetClampMacro(Progress,float,0.0,1.0);
101
102   /** Get the execution progress of a process object. The progress is
103    * a floating number between (0,1), 0 meaning no progress; 1 meaning
104    * the filter has completed execution. */
105   itkGetConstReferenceMacro(Progress,float);
106
107   /** Update the progress of the process object. If a ProgressMethod exists,
108    * executes it.  Then set the Progress ivar to amount. The parameter amount
109    * should range between (0,1).  */
110   void UpdateProgress(float amount);
111   
112   /** Actually generate new output.  */
113   virtual void UpdateOutputData();
114
115 protected:
116   LightProcessObject();
117   ~LightProcessObject();
118   void PrintSelf(std::ostream& os, Indent indent) const;
119   
120   /** This method causes the filter to generate its output. */
121   virtual void GenerateData() {}
122
123
124 private:
125   LightProcessObject(const Self&); //purposely not implemented
126   void operator=(const Self&); //purposely not implemented
127
128   /**
129    * These support the progress method and aborting filter execution.
130    */
131   bool  m_AbortGenerateData;
132   float m_Progress;
133 };
134
135 // end namespace itk
136
137 #endif
138
139 EOF

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:19PM
© Kitware Inc.