go home Home | Main Page | Topics | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Loading...
Searching...
No Matches
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{
40
41template <typename TInputImage>
42class ITK_TEMPLATE_EXPORT ImageSamplerBase : public VectorContainerSource<VectorDataContainer<ImageSample<TInputImage>>>
43{
44public:
46
50 using Pointer = SmartPointer<Self>;
51 using ConstPointer = SmartPointer<const Self>;
52
54 itkNewMacro(Self);
55
58
60 using typename Superclass::DataObjectPointer;
65 using InputImageType = TInputImage;
66 using InputImagePointer = typename InputImageType::Pointer;
67 using InputImageConstPointer = typename InputImageType::ConstPointer;
68 using InputImageRegionType = typename InputImageType::RegionType;
69 using InputImagePixelType = typename InputImageType::PixelType;
70
72 itkStaticConstMacro(InputImageDimension, unsigned int, InputImageType::ImageDimension);
73
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 = ImageMaskSpatialObject<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
90 DataObject::Pointer
91 MakeOutput(ProcessObject::DataObjectPointerArraySizeType idx) override;
92
94 void
95 SetInput(unsigned int idx, const InputImageType * input);
96
98 void
99 SetInput(const InputImageType * input);
100
102 const InputImageType *
104
106 const InputImageType *
107 GetInput(unsigned int idx);
108
112
114 // virtual void GenerateOutputInformation();
115
117
119 virtual void
120 SetMask(const MaskType * _arg, unsigned int pos);
121
125 virtual void
126 SetMask(const MaskType * _arg)
127 {
128 this->SetMask(_arg, 0);
129 }
130
131
133 virtual const MaskType *
134 GetMask(unsigned int pos) const;
135
137 virtual const MaskType *
138 GetMask() const
139 {
140 return this->GetMask(0);
141 }
142
143
145 virtual void
146 SetNumberOfMasks(const unsigned int _arg);
147
149 itkGetConstMacro(NumberOfMasks, unsigned int);
150
152
154 virtual void
155 SetInputImageRegion(const InputImageRegionType _arg, unsigned int pos);
156
158 virtual void
160 {
161 this->SetInputImageRegion(_arg, 0);
162 }
163
164
166 virtual const InputImageRegionType &
167 GetInputImageRegion(unsigned int pos) const;
168
170 virtual const InputImageRegionType &
172 {
173 return this->GetInputImageRegion(0);
174 }
175
176
178 virtual void
179 SetNumberOfInputImageRegions(const unsigned int _arg);
180
182 itkGetConstMacro(NumberOfInputImageRegions, unsigned int);
183
185
190 virtual bool
192
194 virtual bool
196 {
197 return true;
198 }
199
200
202 itkGetConstReferenceMacro(CroppedInputImageRegion, InputImageRegionType);
203
205 itkSetClampMacro(NumberOfSamples, unsigned long, 1, NumericTraits<unsigned long>::max());
206 itkGetConstMacro(NumberOfSamples, unsigned long);
207
209 itkSetMacro(UseMultiThread, bool);
210
211protected:
214
216 ~ImageSamplerBase() override = default;
217
219 void
220 PrintSelf(std::ostream & os, Indent indent) const override;
221
223 void
225
227 virtual bool
229
231 virtual void
233
237 virtual bool
239
241 void
243
245 static std::vector<InputImageRegionType>
246 SplitRegion(const InputImageRegionType & inputRegion, const size_t requestedNumberOfSubregions);
247
248 /***/
249 unsigned long m_NumberOfSamples{ 0 };
250
253 bool m_UseMultiThread{ true };
254
255private:
256 // Private using-declarations, to avoid `-Woverloaded-virtual` warnings from GCC (GCC 11.4) or clang (macos-12).
257 using ProcessObject::MakeOutput;
258 using ProcessObject::SetInput;
259
263 unsigned int m_NumberOfMasks{ 0 };
267
270};
271
272} // end namespace itk
273
274#ifndef ITK_MANUAL_INSTANTIATION
275# include "itkImageSamplerBase.hxx"
276#endif
277
278#endif // end #ifndef itkImageSamplerBase_h
typename InputImageType::ConstPointer InputImageConstPointer
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
void SetInput(unsigned int idx, const InputImageType *input)
VectorDataContainer< ImageSampleType > ImageSampleContainerType
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
const InputImageType * GetInput()
virtual void UpdateAllMasks()
virtual void SetMask(const MaskType *_arg, unsigned int pos)
ImageSample< InputImageType > ImageSampleType
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
InputImageRegionVectorType m_InputImageRegionVector
virtual void SetNumberOfMasks(const unsigned int _arg)
ITK_DISALLOW_COPY_AND_MOVE(ImageSamplerBase)
itkStaticConstMacro(InputImageDimension, unsigned int, InputImageType::ImageDimension)
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
itkOverrideGetNameOfClassMacro(ImageSamplerBase)
VectorContainerSource< VectorDataContainer< ImageSample< FixedImageType > > > Superclass
typename InputImageType::RegionType InputImageRegionType
virtual bool SelectingNewSamplesOnUpdateSupported() const
typename ImageSampleContainerType::Pointer ImageSampleContainerPointer
virtual void SetInputImageRegion(const InputImageRegionType _arg, unsigned int pos)
VectorDataContainer< ImageSample< FixedImageType > > OutputVectorContainerType
ImageMaskSpatialObject< Self::InputImageDimension > MaskType
typename InputImageType::PixelType InputImagePixelType
virtual bool SelectNewSamplesOnUpdate()
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.


Generated on 1774142652 for elastix by doxygen 1.15.0 elastix logo