File: itkStreamingProcessObject.h

package info (click to toggle)
insighttoolkit5 5.4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 704,404 kB
  • sloc: cpp: 783,697; ansic: 628,724; xml: 44,704; fortran: 34,250; python: 22,874; sh: 4,078; pascal: 2,636; lisp: 2,158; makefile: 461; yacc: 328; asm: 205; perl: 203; lex: 146; tcl: 132; javascript: 98; csh: 81
file content (124 lines) | stat: -rw-r--r-- 3,804 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*=========================================================================
 *
 *  Copyright NumFOCUS
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *         https://www.apache.org/licenses/LICENSE-2.0.txt
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 *=========================================================================*/
#ifndef itkStreamingProcessObject_h
#define itkStreamingProcessObject_h

#include "itkProcessObject.h"

namespace itk
{

/** \class StreamingProcessObject
 * \brief Base class interface to process data on multiple requested input chunks.
 *
 * Streaming allows the data to be split into chunks and processed
 * separately. The StreamingProcessObject class extends functionally
 * to execute the primary input's pipeline multiple times over
 * different requested regions. After each requested region is
 * generated by the upstream pipeline the StreamedGenerateData method
 * is called.
 *
 * \ingroup ITKSystemObjects
 * \ingroup DataProcessing
 * \ingroup ITKCommon
 */
class ITKCommon_EXPORT StreamingProcessObject : public ProcessObject
{
public:
  ITK_DISALLOW_COPY_AND_MOVE(StreamingProcessObject);

  /** Standard class types. */
  using Self = StreamingProcessObject;
  using Superclass = ProcessObject;
  using Pointer = SmartPointer<Self>;
  using ConstPointer = SmartPointer<const Self>;

  /** \see LightObject::GetNameOfClass() */
  itkOverrideGetNameOfClassMacro(StreamingProcessObject);

  /** Override PropagateRequestedRegion from ProcessObject
   *  Since inside UpdateOutputData we iterate over streaming pieces
   *  we don't need to propagate up the pipeline
   */
  void
  PropagateRequestedRegion(DataObject * output) override;

  void
  GenerateData() override;

  /** Override UpdateOutputData() from ProcessObject to divide upstream
   * updates into pieces. */
  void
  UpdateOutputData(DataObject * output) override;

  /** The current requested region number during execution.  The value
   * -1, is used when the pipeline is not currently being updated.  */
  virtual int
  GetCurrentRequestNumber() const;

  void
  ResetPipeline() override;

protected:
  StreamingProcessObject();
  ~StreamingProcessObject() override;

  void
  PrintSelf(std::ostream & os, Indent indent) const override;

  /** \brief Return the actual number of regions to request upstream.
   *
   * This method can be overloaded to return one, when a derived
   * filter is unable stream.
   */
  virtual unsigned int
  GetNumberOfInputRequestedRegions() = 0;


  /** \brief For each streamed region, propagate request to all inputs.
   *
   * Derived classes should overload this method to compute regions
   * splits and propagate to the particular DataObject types used for
   * the input.
   */
  virtual void
  GenerateNthInputRequestedRegion(unsigned int inputRequestedRegionNumber) = 0;

  /** This method will be called multiple times for each requested
   * region generated by the input. */
  virtual void
  StreamedGenerateData(unsigned int inputRequestedRegionNumber) = 0;

  /** Called before the input's first requested region is set or
   * updated.
   */
  virtual void
  BeforeStreamedGenerateData();

  /** Called after all requested regions have been process.
   */
  virtual void
  AfterStreamedGenerateData();

private:
  int m_CurrentRequestNumber{ -1 };
};

} // end namespace itk

#endif // itkStreamingProcessObject_h