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 "itkImageMaskSpatialObject.h"
25
26namespace itk
27{
41template <class TInputImage>
42class ITK_TEMPLATE_EXPORT ImageSamplerBase
43 : public VectorContainerSource<VectorDataContainer<std::size_t, ImageSample<TInputImage>>>
44{
45public:
47
51 using Pointer = SmartPointer<Self>;
52 using ConstPointer = SmartPointer<const Self>;
53
55 itkNewMacro(Self);
56
61 using typename Superclass::DataObjectPointer;
66 using InputImageType = TInputImage;
67 using InputImagePointer = typename InputImageType::Pointer;
68 using InputImageConstPointer = typename InputImageType::ConstPointer;
69 using InputImageRegionType = typename InputImageType::RegionType;
70 using InputImagePixelType = typename InputImageType::PixelType;
73 itkStaticConstMacro(InputImageDimension, unsigned int, InputImageType::ImageDimension);
74
79 using InputImageSizeType = typename InputImageType::SizeType;
80 using InputImageIndexType = typename InputImageType::IndexType;
81 using InputImagePointType = typename InputImageType::PointType;
82 using InputImagePointValueType = typename InputImagePointType::ValueType;
84 using MaskType = ImageMaskSpatialObject<Self::InputImageDimension>;
85 using MaskPointer = typename MaskType::Pointer;
86 using MaskConstPointer = typename MaskType::ConstPointer;
87 using MaskVectorType = std::vector<MaskConstPointer>;
88 using InputImageRegionVectorType = std::vector<InputImageRegionType>;
89
91 DataObject::Pointer
92 MakeOutput(ProcessObject::DataObjectPointerArraySizeType idx) override;
93
95 void
96 SetInput(unsigned int idx, const InputImageType * input);
97
99 void
100 SetInput(const InputImageType * input);
101
103 const InputImageType *
105
107 const InputImageType *
108 GetInput(unsigned int idx);
109
113
115 // virtual void GenerateOutputInformation();
116
120 virtual void
121 SetMask(const MaskType * _arg, unsigned int pos);
122
126 virtual void
127 SetMask(const MaskType * _arg)
128 {
129 this->SetMask(_arg, 0);
130 }
131
132
134 virtual const MaskType *
135 GetMask(unsigned int pos) const;
136
138 virtual const MaskType *
139 GetMask() const
140 {
141 return this->GetMask(0);
142 }
143
144
146 virtual void
147 SetNumberOfMasks(const unsigned int _arg);
148
150 itkGetConstMacro(NumberOfMasks, unsigned int);
151
155 virtual void
156 SetInputImageRegion(const InputImageRegionType _arg, unsigned int pos);
157
159 virtual void
161 {
162 this->SetInputImageRegion(_arg, 0);
163 }
164
165
167 virtual const InputImageRegionType &
168 GetInputImageRegion(unsigned int pos) const;
169
171 virtual const InputImageRegionType &
173 {
174 return this->GetInputImageRegion(0);
175 }
176
177
179 virtual void
180 SetNumberOfInputImageRegions(const unsigned int _arg);
181
183 itkGetConstMacro(NumberOfInputImageRegions, unsigned int);
184
191 virtual bool
193
195 virtual bool
197 {
198 return true;
199 }
200
201
203 itkGetConstReferenceMacro(CroppedInputImageRegion, InputImageRegionType);
204
206 itkSetClampMacro(NumberOfSamples, unsigned long, 1, NumericTraits<unsigned long>::max());
207 itkGetConstMacro(NumberOfSamples, unsigned long);
208
210 itkSetMacro(UseMultiThread, bool);
211
212protected:
215
217 ~ImageSamplerBase() override = default;
218
220 void
221 PrintSelf(std::ostream & os, Indent indent) const override;
222
224 void
226
228 virtual bool
230
232 virtual void
234
238 virtual bool
240
242 void
244
246 static std::vector<InputImageRegionType>
247 SplitRegion(const InputImageRegionType & inputRegion, const size_t requestedNumberOfSubregions);
248
249 /***/
250 unsigned long m_NumberOfSamples{ 0 };
251
254 bool m_UseMultiThread{ true };
255
256private:
257 // Private using-declarations, to avoid `-Woverloaded-virtual` warnings from GCC (GCC 11.4) or clang (macos-12).
258 using ProcessObject::MakeOutput;
259 using ProcessObject::SetInput;
260
262 MaskConstPointer m_Mask{ nullptr };
263 MaskVectorType m_MaskVector{};
264 unsigned int m_NumberOfMasks{ 0 };
265 InputImageRegionType m_InputImageRegion{};
266 InputImageRegionVectorType m_InputImageRegionVector{};
267 unsigned int m_NumberOfInputImageRegions{ 0 };
268
269 InputImageRegionType m_CroppedInputImageRegion{};
270 InputImageRegionType m_DummyInputImageRegion{};
271};
272
273} // end namespace itk
274
275#ifndef ITK_MANUAL_INSTANTIATION
276# include "itkImageSamplerBase.hxx"
277#endif
278
279#endif // end #ifndef itkImageSamplerBase_h
typename InputImageType::Pointer InputImagePointer
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.
void SetInput(unsigned int idx, const InputImageType *input)
std::vector< InputImageRegionType > InputImageRegionVectorType
virtual const InputImageRegionType & GetInputImageRegion() const
virtual const MaskType * GetMask(unsigned int pos) const
const InputImageType * GetInput(unsigned int idx)
virtual bool CheckInputImageRegions()
DataObject::Pointer MakeOutput(ProcessObject::DataObjectPointerArraySizeType idx) override
~ImageSamplerBase() override=default
void GenerateInputRequestedRegion() override
typename InputImageType::ConstPointer InputImageConstPointer
const InputImageType * GetInput()
virtual void UpdateAllMasks()
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
OutputVectorContainerType * GetOutput()
static std::vector< InputImageRegionType > SplitRegion(const InputImageRegionType &inputRegion, const vcl_size_t requestedNumberOfSubregions)
void SetInput(const InputImageType *input)
typename InputImageType::PointType InputImagePointType
virtual void SetMask(const MaskType *_arg)
virtual void SetInputImageRegion(const InputImageRegionType _arg)
void PrintSelf(std::ostream &os, Indent indent) const override
typename InputImageType::SizeType InputImageSizeType
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)
std::vector< MaskConstPointer > MaskVectorType
typename ImageSampleType::RealType ImageSampleValueType
typename InputImageType::IndexType InputImageIndexType
SmartPointer< const Self > ConstPointer
typename InputImageType::RegionType InputImageRegionType
virtual bool SelectingNewSamplesOnUpdateSupported() const
typename ImageSampleContainerType::Pointer ImageSampleContainerPointer
virtual void SetInputImageRegion(const InputImageRegionType _arg, unsigned int pos)
typename MaskType::Pointer MaskPointer
ImageMaskSpatialObject< Self::InputImageDimension > MaskType
typename InputImageType::PixelType InputImagePixelType
virtual bool SelectNewSamplesOnUpdate()
A base class for creating an ImageToVectorContainerFilter.
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.


Generated on 2024-07-17 for elastix by doxygen 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) elastix logo