Loading...
Searching...
No Matches
itkImageFullSampler.h
Go to the documentation of this file.
/*=========================================================================
*
* Copyright UMC Utrecht and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkImageFullSampler_h
#define itkImageFullSampler_h
#include "itkImageSamplerBase.h"
#include "elxMaskHasSameImageDomain.h"
namespace itk
{
template <class TInputImage>
class ITK_TEMPLATE_EXPORT ImageFullSampler : public ImageSamplerBase<TInputImage>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(ImageFullSampler);
using Self = ImageFullSampler;
using Superclass = ImageSamplerBase<TInputImage>;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;
itkNewMacro(Self);
itkTypeMacro(ImageFullSampler, ImageSamplerBase);
using typename Superclass::DataObjectPointer;
using typename Superclass::OutputVectorContainerType;
using typename Superclass::OutputVectorContainerPointer;
using typename Superclass::InputImageType;
using typename Superclass::InputImagePointer;
using typename Superclass::InputImageConstPointer;
using typename Superclass::InputImageRegionType;
using typename Superclass::InputImagePixelType;
using typename Superclass::ImageSampleType;
using typename Superclass::ImageSampleContainerType;
using typename Superclass::ImageSampleContainerPointer;
// Clang/macos-12/Xcode_14.2 does not like `using typename Superclass::MaskType`, saying "error: 'MaskType' is not a
// class, namespace, or enumeration"
using MaskType = typename Superclass::MaskType;
itkStaticConstMacro(InputImageDimension, unsigned int, Superclass::InputImageDimension);
using typename Superclass::InputImageIndexType;
// using typename Superclass::InputImageSpacingType;
using typename Superclass::InputImagePointType;
using InputImageSizeType = typename InputImageType::SizeType;
bool
SelectNewSamplesOnUpdate() override
{
return false;
}
bool
SelectingNewSamplesOnUpdateSupported() const override
{
return false;
}
protected:
ImageFullSampler() = default;
~ImageFullSampler() override = default;
using Superclass::PrintSelf;
void
GenerateData() override;
private:
struct WorkUnit
{
const InputImageRegionType imageRegion{};
// Should point to the first sample for this specific work unit.
ImageSampleType * const Samples{};
// The number of samples retrieved by this work unit. Only used when a mask is specified.
size_t NumberOfSamples{};
};
struct UserData
{
ITK_DISALLOW_COPY_AND_MOVE(UserData);
const InputImageType & InputImage;
const MaskType * const Mask{};
std::vector<WorkUnit> WorkUnits{};
};
template <elastix::MaskCondition VMaskCondition>
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
ThreaderCallback(void * arg);
static std::vector<WorkUnit>
GenerateWorkUnits(const ThreadIdType numberOfWorkUnits,
const InputImageRegionType & croppedInputImageRegion,
std::vector<ImageSampleType> & samples);
static void
SingleThreadedGenerateData(const TInputImage & inputImage,
const MaskType * const mask,
const InputImageRegionType & croppedInputImageRegion,
std::vector<ImageSampleType> & samples);
static void
MultiThreadedGenerateData(MultiThreaderBase & multiThreader,
const ThreadIdType numberOfWorkUnits,
const TInputImage & inputImage,
const MaskType * const mask,
const InputImageRegionType & croppedInputImageRegion,
std::vector<ImageSampleType> & samples);
template <elastix::MaskCondition VMaskCondition>
static void
GenerateDataForWorkUnit(WorkUnit &, const InputImageType &, const MaskType *);
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
# include "itkImageFullSampler.hxx"
#endif
#endif // end #ifndef itkImageFullSampler_h
itk::ImageFullSampler::SingleThreadedGenerateData
static void SingleThreadedGenerateData(const TInputImage &inputImage, const MaskType *const mask, const InputImageRegionType &croppedInputImageRegion, std::vector< ImageSampleType > &samples)
itk::ImageFullSampler::itkStaticConstMacro
itkStaticConstMacro(InputImageDimension, unsigned int, Superclass::InputImageDimension)
itk::ImageFullSampler::ImageSampleType
ImageSample< InputImageType > ImageSampleType
Definition itkImageSamplerBase.h:76
itk::ImageFullSampler::GenerateDataForWorkUnit
static void GenerateDataForWorkUnit(WorkUnit &, const InputImageType &, const MaskType *)
itk::ImageFullSampler::ThreaderCallback
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION ThreaderCallback(void *arg)
itk::ImageFullSampler::Superclass
ImageSamplerBase< TInputImage > Superclass
Definition itkImageFullSampler.h:45
itk::ImageFullSampler::Pointer
SmartPointer< Self > Pointer
Definition itkImageFullSampler.h:46
itk::ImageFullSampler::~ImageFullSampler
~ImageFullSampler() override=default
itk::ImageFullSampler::GenerateWorkUnits
static std::vector< WorkUnit > GenerateWorkUnits(const ThreadIdType numberOfWorkUnits, const InputImageRegionType &croppedInputImageRegion, std::vector< ImageSampleType > &samples)
itk::ImageFullSampler::InputImageType
TInputImage InputImageType
Definition itkImageSamplerBase.h:66
itk::ImageFullSampler::ITK_DISALLOW_COPY_AND_MOVE
ITK_DISALLOW_COPY_AND_MOVE(ImageFullSampler)
itk::ImageFullSampler::Self
ImageFullSampler Self
Definition itkImageFullSampler.h:44
itk::ImageFullSampler::GenerateData
void GenerateData() override
itk::ImageFullSampler::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition itkImageSamplerBase.h:69
itk::ImageFullSampler::MaskType
typename Superclass::MaskType MaskType
Definition itkImageFullSampler.h:70
itk::ImageFullSampler::SelectNewSamplesOnUpdate
bool SelectNewSamplesOnUpdate() override
Definition itkImageFullSampler.h:85
itk::ImageFullSampler::SelectingNewSamplesOnUpdateSupported
bool SelectingNewSamplesOnUpdateSupported() const override
Definition itkImageFullSampler.h:93
itk::ImageFullSampler::ConstPointer
SmartPointer< const Self > ConstPointer
Definition itkImageFullSampler.h:47
itk::ImageFullSampler::ImageFullSampler
ImageFullSampler()=default
itk::ImageFullSampler::MultiThreadedGenerateData
static void MultiThreadedGenerateData(MultiThreaderBase &multiThreader, const ThreadIdType numberOfWorkUnits, const TInputImage &inputImage, const MaskType *const mask, const InputImageRegionType &croppedInputImageRegion, std::vector< ImageSampleType > &samples)
itk::ImageFullSampler::InputImageSizeType
typename InputImageType::SizeType InputImageSizeType
Definition itkImageFullSampler.h:81
itk::ImageSamplerBase< InputImageType >::OutputVectorContainerPointer
typename OutputVectorContainerType::Pointer OutputVectorContainerPointer
itk::ImageSamplerBase< InputImageType >::OutputVectorContainerType
VectorDataContainer< std::vcl_size_t, ImageSample< InputImageType > > OutputVectorContainerType
itk::ImageSamplerBase< InputImageType >::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition itkImageSamplerBase.h:68
itk::ImageSamplerBase< InputImageType >::ImageSampleType
ImageSample< InputImageType > ImageSampleType
Definition itkImageSamplerBase.h:76
itk::ImageSamplerBase< InputImageType >::ImageSampleContainerType
VectorDataContainer< std::vcl_size_t, ImageSampleType > ImageSampleContainerType
Definition itkImageSamplerBase.h:77
itk::ImageSamplerBase< InputImageType >::InputImagePointType
typename InputImageType::PointType InputImagePointType
Definition itkImageSamplerBase.h:81
itk::ImageSamplerBase< InputImageType >::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const override
itk::ImageSamplerBase< InputImageType >::InputImageType
InputImageType InputImageType
Definition itkImageSamplerBase.h:66
itk::ImageSamplerBase< InputImageType >::InputImageIndexType
typename InputImageType::IndexType InputImageIndexType
Definition itkImageSamplerBase.h:80
itk::ImageSamplerBase< InputImageType >::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition itkImageSamplerBase.h:69
itk::ImageSamplerBase::ImageSamplerBase
ImageSamplerBase()
itk::ImageSamplerBase< InputImageType >::ImageSampleContainerPointer
typename ImageSampleContainerType::Pointer ImageSampleContainerPointer
Definition itkImageSamplerBase.h:78
itk::ImageSamplerBase< InputImageType >::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition itkImageSamplerBase.h:67
itk::ImageSamplerBase::MaskType
ImageMaskSpatialObject< Self::InputImageDimension > MaskType
Definition itkImageSamplerBase.h:84
itk::ImageSamplerBase< InputImageType >::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition itkImageSamplerBase.h:70
elxMaskHasSameImageDomain.h
itkImageSamplerBase.h
itk
Definition itkAdvancedImageToImageMetric.h:43
itk::ImageFullSampler::UserData
Definition itkImageFullSampler.h:125
itk::ImageFullSampler::UserData::InputImage
const InputImageType & InputImage
Definition itkImageFullSampler.h:128
itk::ImageFullSampler::UserData::ITK_DISALLOW_COPY_AND_MOVE
ITK_DISALLOW_COPY_AND_MOVE(UserData)
itk::ImageFullSampler::UserData::Mask
const MaskType *const Mask
Definition itkImageFullSampler.h:129
itk::ImageFullSampler::UserData::WorkUnits
std::vector< WorkUnit > WorkUnits
Definition itkImageFullSampler.h:130
itk::ImageFullSampler::WorkUnit
Definition itkImageFullSampler.h:114
itk::ImageFullSampler::WorkUnit::imageRegion
const InputImageRegionType imageRegion
Definition itkImageFullSampler.h:115
itk::ImageFullSampler::WorkUnit::NumberOfSamples
vcl_size_t NumberOfSamples
Definition itkImageFullSampler.h:121
itk::ImageFullSampler::WorkUnit::Samples
ImageSampleType *const Samples
Definition itkImageFullSampler.h:118

Generated on 1768596610 for elastix by 1.15.0 |