ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkFiniteDifferenceSparseImageFilter.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 __itkFiniteDifferenceSparseImageFilter_h
19 #define __itkFiniteDifferenceSparseImageFilter_h
20 
23 #include "itkMultiThreader.h"
24 #include "itkSparseImage.h"
25 
26 namespace itk
27 {
62 template< typename TInputImageType, typename TSparseOutputImageType >
64  public FiniteDifferenceImageFilter< TInputImageType,
65  TSparseOutputImageType >
66 {
67 public:
71  TInputImageType, TSparseOutputImageType > Superclass;
72 
75 
78 
82  typedef typename Superclass::PixelType PixelType;
85  // the PixelType is from output image; therefore, it is a pointer
86 
89  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
90 
92  typedef typename SparseOutputImageType::IndexType IndexType;
93  typedef typename SparseOutputImageType::SizeType SizeType;
94  typedef typename SparseOutputImageType::NodeType OutputNodeType;
95  typedef typename SparseOutputImageType::NodeListType NodeListType;
96 
98  typedef typename OutputNodeType::NodeDataType NodeDataType;
99 
103  typedef typename OutputNodeType::NodeValueType NodeValueType;
104 
108 
111 
112  itkSetMacro(PrecomputeFlag, bool);
113  itkGetConstMacro(PrecomputeFlag, bool);
114 
115 protected:
118  void PrintSelf(std::ostream & os, Indent indent) const;
119 
123  virtual void Initialize();
124 
127  virtual void AllocateUpdateBuffer() {}
128 
131  virtual NodeDataType DataConstraint(const NodeDataType & data) const
132  { return data; }
133 
134 private:
137  // this is the first element
138  typename NodeListType::Iterator first;
139  // this is one past the last element
140  typename NodeListType::Iterator last;
141  };
142 
143 protected:
146 
149  virtual void ApplyUpdate(const TimeStepType& dt);
150 
153 
154  virtual void ThreadedApplyUpdate(const TimeStepType& dt,
155  const ThreadRegionType & regionToProcess,
156  ThreadIdType threadId);
157 
160  virtual TimeStepType CalculateChange();
161 
164 
166  (const ThreadRegionType & regionToProcess, ThreadIdType threadId);
167 
171  virtual void PrecalculateChange();
172 
175 
176  virtual void ThreadedPrecalculateChange
177  (const ThreadRegionType & regionToProcess, ThreadIdType threadId);
178 
181  struct FDThreadStruct {
184  std::vector< TimeStepType > TimeStepList;
185  std::vector< bool > ValidTimeStepList;
186  };
187 
188 private:
191 
194 
197  typename NodeListType::RegionListType m_RegionList;
198 
199  FiniteDifferenceSparseImageFilter(const Self &); //purposely not implemented
200  void operator=(const Self &); //purposely not implemented
201 };
202 } // end namespace itk
203 
204 #ifndef ITK_MANUAL_INSTANTIATION
205 #include "itkFiniteDifferenceSparseImageFilter.hxx"
206 #endif
207 
208 #endif
void SetSparseFunction(SparseFunctionType *sf)
Light weight base class for most itk classes.
virtual TimeStepType ThreadedCalculateChange(const ThreadRegionType &regionToProcess, ThreadIdType threadId)
static ITK_THREAD_RETURN_TYPE ApplyUpdateThreaderCallback(void *arg)
virtual TimeStepType CalculateChange()
virtual NodeDataType DataConstraint(const NodeDataType &data) const
ThreadIdType GetSplitRegion(ThreadIdType i, ThreadIdType num, ThreadRegionType &splitRegion)
#define ITK_THREAD_RETURN_TYPE
static ITK_THREAD_RETURN_TYPE PrecalculateChangeThreaderCallback(void *arg)
void PrintSelf(std::ostream &os, Indent indent) const
static ITK_THREAD_RETURN_TYPE CalculateChangeThreaderCallback(void *arg)
FiniteDifferenceImageFilter< TInputImageType, TSparseOutputImageType > Superclass
virtual void ThreadedPrecalculateChange(const ThreadRegionType &regionToProcess, ThreadIdType threadId)
This class implements a multi-threaded base class for Image to SparseImage finite difference processe...
This is the base class for function classes that can be used with filters derived from FiniteDifferen...
virtual void ApplyUpdate(const TimeStepType &dt)
virtual void ThreadedApplyUpdate(const TimeStepType &dt, const ThreadRegionType &regionToProcess, ThreadIdType threadId)
Control indentation during Print() invocation.
Definition: itkIndent.h:49
FiniteDifferenceSparseImageFunction< SparseOutputImageType > SparseFunctionType
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
Superclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType