go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkImageSamplerBase.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
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 itkImageSamplerBase_h
19#define itkImageSamplerBase_h
20
22#include "itkImageSample.h"
24#include "itkSpatialObject.h"
25
26namespace itk
27{
41template <class TInputImage>
42class ITK_TEMPLATE_EXPORT ImageSamplerBase
43 : public ImageToVectorContainerFilter<TInputImage, VectorDataContainer<std::size_t, ImageSample<TInputImage>>>
44{
45public:
47
50 using Superclass =
52 using Pointer = SmartPointer<Self>;
53 using ConstPointer = SmartPointer<const Self>;
54
56 itkNewMacro(Self);
57
60
62 using typename Superclass::DataObjectPointer;
72 itkStaticConstMacro(InputImageDimension, unsigned int, InputImageType::ImageDimension);
78 using InputImageSizeType = typename InputImageType::SizeType;
79 using InputImageIndexType = typename InputImageType::IndexType;
80 using InputImagePointType = typename InputImageType::PointType;
81 using InputImagePointValueType = typename InputImagePointType::ValueType;
83 using MaskType = SpatialObject<Self::InputImageDimension>;
84 using MaskPointer = typename MaskType::Pointer;
85 using MaskConstPointer = typename MaskType::ConstPointer;
86 using MaskVectorType = std::vector<MaskConstPointer>;
87 using InputImageRegionVectorType = std::vector<InputImageRegionType>;
88
92 virtual void
93 SetMask(const MaskType * _arg, unsigned int pos);
94
98 virtual void
99 SetMask(const MaskType * _arg)
100 {
101 this->SetMask(_arg, 0);
102 }
103
104
106 virtual const MaskType *
107 GetMask(unsigned int pos) const;
108
110 virtual const MaskType *
111 GetMask() const
112 {
113 return this->GetMask(0);
114 }
115
116
118 virtual void
119 SetNumberOfMasks(const unsigned int _arg);
120
122 itkGetConstMacro(NumberOfMasks, unsigned int);
123
127 virtual void
128 SetInputImageRegion(const InputImageRegionType _arg, unsigned int pos);
129
131 virtual void
133 {
134 this->SetInputImageRegion(_arg, 0);
135 }
136
137
139 virtual const InputImageRegionType &
140 GetInputImageRegion(unsigned int pos) const;
141
143 virtual const InputImageRegionType &
145 {
146 return this->GetInputImageRegion(0);
147 }
148
149
151 virtual void
152 SetNumberOfInputImageRegions(const unsigned int _arg);
153
155 itkGetConstMacro(NumberOfInputImageRegions, unsigned int);
156
163 virtual bool
165
167 virtual bool
169 {
170 return true;
171 }
172
173
175 itkGetConstReferenceMacro(CroppedInputImageRegion, InputImageRegionType);
176
178 itkSetClampMacro(NumberOfSamples, unsigned long, 1, NumericTraits<unsigned long>::max());
179 itkGetConstMacro(NumberOfSamples, unsigned long);
180
182 itkSetMacro(UseMultiThread, bool);
183
184protected:
186 ImageSamplerBase() = default;
187
189 ~ImageSamplerBase() override = default;
190
192 void
193 PrintSelf(std::ostream & os, Indent indent) const override;
194
196 void
198
200 virtual bool
202
204 virtual void
206
210 virtual bool
212
214 void
216
218 void
220
221 void
223
224 /***/
225 unsigned long m_NumberOfSamples{ 0 };
226 std::vector<ImageSampleContainerPointer> m_ThreaderSampleContainer;
227
228 // tmp?
229 bool m_UseMultiThread{ false };
230
231private:
233 MaskConstPointer m_Mask{ nullptr };
235 unsigned int m_NumberOfMasks{ 0 };
238 unsigned int m_NumberOfInputImageRegions{ 0 };
239
242};
243
244} // end namespace itk
245
246#ifndef ITK_MANUAL_INSTANTIATION
247# include "itkImageSamplerBase.hxx"
248#endif
249
250#endif // end #ifndef itkImageSamplerBase_h
A class that defines an image sample, which is the coordinates of a point and its value.
typename NumericTraits< PixelType >::RealType RealType
This class is a base class for any image sampler.
std::vector< InputImageRegionType > InputImageRegionVectorType
virtual const InputImageRegionType & GetInputImageRegion() const
void AfterThreadedGenerateData() override
virtual const MaskType * GetMask(unsigned int pos) const
virtual bool CheckInputImageRegions()
~ImageSamplerBase() override=default
void GenerateInputRequestedRegion() override
virtual void UpdateAllMasks()
InputImageRegionType m_CroppedInputImageRegion
virtual void SetMask(const MaskType *_arg, unsigned int pos)
virtual const InputImageRegionType & GetInputImageRegion(unsigned int pos) const
virtual bool IsInsideAllMasks(const InputImagePointType &point) const
virtual const MaskType * GetMask() const
InputImageRegionType m_InputImageRegion
typename InputImageType::PointType InputImagePointType
std::vector< ImageSampleContainerPointer > m_ThreaderSampleContainer
virtual void SetMask(const MaskType *_arg)
virtual void SetInputImageRegion(const InputImageRegionType _arg)
ImageSamplerBase()=default
void PrintSelf(std::ostream &os, Indent indent) const override
typename InputImageType::SizeType InputImageSizeType
InputImageRegionVectorType m_InputImageRegionVector
virtual void SetNumberOfMasks(const unsigned int _arg)
ITK_DISALLOW_COPY_AND_MOVE(ImageSamplerBase)
typename MaskType::ConstPointer MaskConstPointer
typename InputImagePointType::ValueType InputImagePointValueType
virtual void SetNumberOfInputImageRegions(const unsigned int _arg)
SpatialObject< Self::InputImageDimension > MaskType
std::vector< MaskConstPointer > MaskVectorType
typename ImageSampleType::RealType ImageSampleValueType
typename InputImageType::IndexType InputImageIndexType
InputImageRegionType m_DummyInputImageRegion
SmartPointer< const Self > ConstPointer
virtual bool SelectingNewSamplesOnUpdateSupported() const
typename ImageSampleContainerType::Pointer ImageSampleContainerPointer
virtual void SetInputImageRegion(const InputImageRegionType _arg, unsigned int pos)
typename MaskType::Pointer MaskPointer
void BeforeThreadedGenerateData() override
virtual bool SelectNewSamplesOnUpdate()
Base class that takes in an image and pops out a vector container.
TOutputVectorContainer OutputVectorContainerType
typename OutputVectorContainerType::Pointer OutputVectorContainerPointer
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.


Generated on Wed 12 Apr 2023 for elastix by doxygen 1.9.6 elastix logo