18#ifndef itkImageGridSampler_h
19#define itkImageGridSampler_h
44template <
class TInputImage>
63 using typename Superclass::DataObjectPointer;
148 PrintSelf(std::ostream & os, Indent indent)
const override;
164 size_t NumberOfSamples{};
174 std::vector<WorkUnit> WorkUnits{};
177 template <elastix::MaskCondition VMaskCondition>
178 static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
182 template <
unsigned int VIndex>
186 if constexpr (VIndex < InputImageDimension)
188 return gridSize[VIndex];
197 template <
unsigned int VIndex>
203 static_assert(VIndex > 0);
205 if constexpr (VIndex < InputImageDimension)
207 index[VIndex - 1] = gridIndex[VIndex - 1];
208 index[VIndex] += gridSpacing[VIndex];
214 static std::pair<SampleGridIndexType, SampleGridSizeType>
219 static std::vector<WorkUnit>
224 std::vector<ImageSampleType> & samples);
231 std::vector<ImageSampleType> & samples);
234 const ThreadIdType numberOfWorkUnits,
235 const TInputImage & inputImage,
239 std::vector<ImageSampleType> & samples);
242 template <elastix::MaskCondition VMaskCondition>
250 unsigned long m_RequestedNumberOfSamples{ 0 };
255#ifndef ITK_MANUAL_INSTANTIATION
256# include "itkImageGridSampler.hxx"
Samples image voxels on a regular grid.
SmartPointer< const Self > ConstPointer
static void MultiThreadedGenerateData(MultiThreaderBase &multiThreader, const ThreadIdType numberOfWorkUnits, const TInputImage &inputImage, const MaskType *const mask, const InputImageRegionType &croppedInputImageRegion, const SampleGridSpacingType &gridSpacing, std::vector< ImageSampleType > &samples)
typename Superclass::MaskType MaskType
static void GenerateDataForWorkUnit(WorkUnit &, const InputImageType &, const MaskType *, const SampleGridSpacingType &)
itkStaticConstMacro(InputImageDimension, unsigned int, Superclass::InputImageDimension)
~ImageGridSampler() override=default
typename InputImageType::OffsetType SampleGridSpacingType
bool SelectNewSamplesOnUpdate() override
static unsigned int GetGridSizeValue(const SampleGridSizeType &gridSize)
typename InputImageType::SizeType SampleGridSizeType
static std::vector< WorkUnit > GenerateWorkUnits(const ThreadIdType numberOfWorkUnits, const InputImageRegionType &croppedInputImageRegion, const SampleGridIndexType gridIndex, const SampleGridSpacingType gridSpacing, std::vector< ImageSampleType > &samples)
static void SingleThreadedGenerateData(const TInputImage &inputImage, const MaskType *const mask, const InputImageRegionType &croppedInputImageRegion, const SampleGridSpacingType &gridSpacing, std::vector< ImageSampleType > &samples)
static std::pair< SampleGridIndexType, SampleGridSizeType > DetermineGridIndexAndSize(const InputImageRegionType &croppedInputImageRegion, const SampleGridSpacingType &gridSpacing)
bool SelectingNewSamplesOnUpdateSupported() const override
void GenerateData() override
void SetSampleGridSpacing(const SampleGridSpacingType &arg)
ImageGridSampler()=default
void PrintSelf(std::ostream &os, Indent indent) const override
TInputImage InputImageType
typename InputImageType::IndexType InputImageIndexType
ITK_DISALLOW_COPY_AND_MOVE(ImageGridSampler)
static void JumpToNextGridPosition(SampleGridIndexType &index, const SampleGridIndexType &gridIndex, const SampleGridSpacingType &gridSpacing)
InputImageIndexType SampleGridIndexType
typename InputImageType::SizeType InputImageSizeType
typename InputImageType::RegionType InputImageRegionType
typename SampleGridSpacingType::OffsetValueType SampleGridSpacingValueType
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION ThreaderCallback(void *arg)
void SetNumberOfSamples(unsigned long nrofsamples) override
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
TInputImage InputImageType
typename InputImageType::IndexType InputImageIndexType
typename InputImageType::RegionType InputImageRegionType
typename ImageSampleContainerType::Pointer ImageSampleContainerPointer
typename InputImageType::Pointer InputImagePointer
ImageMaskSpatialObject< Self::InputImageDimension > MaskType
typename InputImageType::PixelType InputImagePixelType
typename OutputVectorContainerType::Pointer OutputVectorContainerPointer
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
ITK_DISALLOW_COPY_AND_MOVE(UserData)
const InputImageType & InputImage