go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkImageFullSampler.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 itkImageFullSampler_h
19#define itkImageFullSampler_h
20
21#include "itkImageSamplerBase.h"
23
24namespace itk
25{
37template <class TInputImage>
38class ITK_TEMPLATE_EXPORT ImageFullSampler : public ImageSamplerBase<TInputImage>
39{
40public:
42
46 using Pointer = SmartPointer<Self>;
47 using ConstPointer = SmartPointer<const Self>;
48
50 itkNewMacro(Self);
51
54
56 using typename Superclass::DataObjectPointer;
59 using typename Superclass::InputImageType;
60 using typename Superclass::InputImagePointer;
64 using typename Superclass::ImageSampleType;
67
68 // Clang/macos-12/Xcode_14.2 does not like `using typename Superclass::MaskType`, saying "error: 'MaskType' is not a
69 // class, namespace, or enumeration"
71
73 itkStaticConstMacro(InputImageDimension, unsigned int, Superclass::InputImageDimension);
74
77 // using typename Superclass::InputImageSpacingType;
79
81 using InputImageSizeType = typename InputImageType::SizeType;
82
84 bool
86 {
87 return false;
88 }
89
90
92 bool
94 {
95 return false;
96 }
97
98
99protected:
101 ImageFullSampler() = default;
102
104 ~ImageFullSampler() override = default;
105
106 using Superclass::PrintSelf;
107
109 void
110 GenerateData() override;
111
112private:
113 struct WorkUnit
114 {
115 const InputImageRegionType imageRegion{};
116
117 // Should point to the first sample for this specific work unit.
118 ImageSampleType * const Samples{};
119
120 // The number of samples retrieved by this work unit. Only used when a mask is specified.
121 size_t NumberOfSamples{};
122 };
123
124 struct UserData
125 {
127
129 const MaskType * const Mask{};
130 std::vector<WorkUnit> WorkUnits{};
131 };
132
133 template <elastix::MaskCondition VMaskCondition>
134 static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
135 ThreaderCallback(void * arg);
136
138 static std::vector<WorkUnit>
139 GenerateWorkUnits(const ThreadIdType numberOfWorkUnits,
140 const InputImageRegionType & croppedInputImageRegion,
141 std::vector<ImageSampleType> & samples);
142
143 static void
144 SingleThreadedGenerateData(const TInputImage & inputImage,
145 const MaskType * const mask,
146 const InputImageRegionType & croppedInputImageRegion,
147 std::vector<ImageSampleType> & samples);
148 static void
149 MultiThreadedGenerateData(MultiThreaderBase & multiThreader,
150 const ThreadIdType numberOfWorkUnits,
151 const TInputImage & inputImage,
152 const MaskType * const mask,
153 const InputImageRegionType & croppedInputImageRegion,
154 std::vector<ImageSampleType> & samples);
155
157 template <elastix::MaskCondition VMaskCondition>
158 static void
160};
161
162} // end namespace itk
163
164#ifndef ITK_MANUAL_INSTANTIATION
165# include "itkImageFullSampler.hxx"
166#endif
167
168#endif // end #ifndef itkImageFullSampler_h
Samples all voxels in the InputImageRegion.
static void SingleThreadedGenerateData(const TInputImage &inputImage, const MaskType *const mask, const InputImageRegionType &croppedInputImageRegion, std::vector< ImageSampleType > &samples)
itkStaticConstMacro(InputImageDimension, unsigned int, Superclass::InputImageDimension)
static void GenerateDataForWorkUnit(WorkUnit &, const InputImageType &, const MaskType *)
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION ThreaderCallback(void *arg)
~ImageFullSampler() override=default
static std::vector< WorkUnit > GenerateWorkUnits(const ThreadIdType numberOfWorkUnits, const InputImageRegionType &croppedInputImageRegion, std::vector< ImageSampleType > &samples)
ITK_DISALLOW_COPY_AND_MOVE(ImageFullSampler)
void GenerateData() override
typename InputImageType::RegionType InputImageRegionType
typename Superclass::MaskType MaskType
bool SelectNewSamplesOnUpdate() override
bool SelectingNewSamplesOnUpdateSupported() const override
SmartPointer< const Self > ConstPointer
ImageFullSampler()=default
static void MultiThreadedGenerateData(MultiThreaderBase &multiThreader, const ThreadIdType numberOfWorkUnits, const TInputImage &inputImage, const MaskType *const mask, const InputImageRegionType &croppedInputImageRegion, std::vector< ImageSampleType > &samples)
typename InputImageType::SizeType InputImageSizeType
A class that defines an image sample, which is the coordinates of a point and its value.
This class is a base class for any image sampler.
typename InputImageType::ConstPointer InputImageConstPointer
typename InputImageType::PointType InputImagePointType
typename InputImageType::IndexType InputImageIndexType
typename InputImageType::RegionType InputImageRegionType
typename ImageSampleContainerType::Pointer ImageSampleContainerPointer
typename InputImageType::Pointer InputImagePointer
ImageMaskSpatialObject< Self::InputImageDimension > MaskType
typename InputImageType::PixelType InputImagePixelType
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