Loading...
Searching...
No Matches
itkImageSamplerBase.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 itkImageSamplerBase_h
#define itkImageSamplerBase_h
#include "itkVectorContainerSource.h"
#include "itkImageSample.h"
#include "itkVectorDataContainer.h"
#include "itkImageMaskSpatialObject.h"
namespace itk
{
template <class TInputImage>
class ITK_TEMPLATE_EXPORT ImageSamplerBase
: public VectorContainerSource<VectorDataContainer<std::size_t, ImageSample<TInputImage>>>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(ImageSamplerBase);
using Self = ImageSamplerBase;
using Superclass = VectorContainerSource<VectorDataContainer<std::size_t, ImageSample<TInputImage>>>;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;
itkNewMacro(Self);
itkTypeMacro(ImageSamplerBase, Superclass);
using typename Superclass::DataObjectPointer;
using typename Superclass::OutputVectorContainerType;
using typename Superclass::OutputVectorContainerPointer;
using InputImageType = TInputImage;
using InputImagePointer = typename InputImageType::Pointer;
using InputImageConstPointer = typename InputImageType::ConstPointer;
using InputImageRegionType = typename InputImageType::RegionType;
using InputImagePixelType = typename InputImageType::PixelType;
itkStaticConstMacro(InputImageDimension, unsigned int, InputImageType::ImageDimension);
using ImageSampleType = ImageSample<InputImageType>;
using ImageSampleContainerType = VectorDataContainer<std::size_t, ImageSampleType>;
using ImageSampleContainerPointer = typename ImageSampleContainerType::Pointer;
using InputImageSizeType = typename InputImageType::SizeType;
using InputImageIndexType = typename InputImageType::IndexType;
using InputImagePointType = typename InputImageType::PointType;
using InputImagePointValueType = typename InputImagePointType::ValueType;
using ImageSampleValueType = typename ImageSampleType::RealType;
using MaskType = ImageMaskSpatialObject<Self::InputImageDimension>;
using MaskPointer = typename MaskType::Pointer;
using MaskConstPointer = typename MaskType::ConstPointer;
using MaskVectorType = std::vector<MaskConstPointer>;
using InputImageRegionVectorType = std::vector<InputImageRegionType>;
DataObject::Pointer
MakeOutput(ProcessObject::DataObjectPointerArraySizeType idx) override;
void
SetInput(unsigned int idx, const InputImageType * input);
void
SetInput(const InputImageType * input);
const InputImageType *
GetInput();
const InputImageType *
GetInput(unsigned int idx);
OutputVectorContainerType *
GetOutput();
// virtual void GenerateOutputInformation();
virtual void
SetMask(const MaskType * _arg, unsigned int pos);
virtual void
SetMask(const MaskType * _arg)
{
this->SetMask(_arg, 0);
}
virtual const MaskType *
GetMask(unsigned int pos) const;
virtual const MaskType *
GetMask() const
{
return this->GetMask(0);
}
virtual void
SetNumberOfMasks(const unsigned int _arg);
itkGetConstMacro(NumberOfMasks, unsigned int);
virtual void
SetInputImageRegion(const InputImageRegionType _arg, unsigned int pos);
virtual void
SetInputImageRegion(const InputImageRegionType _arg)
{
this->SetInputImageRegion(_arg, 0);
}
virtual const InputImageRegionType &
GetInputImageRegion(unsigned int pos) const;
virtual const InputImageRegionType &
GetInputImageRegion() const
{
return this->GetInputImageRegion(0);
}
virtual void
SetNumberOfInputImageRegions(const unsigned int _arg);
itkGetConstMacro(NumberOfInputImageRegions, unsigned int);
virtual bool
SelectNewSamplesOnUpdate();
virtual bool
SelectingNewSamplesOnUpdateSupported() const
{
return true;
}
itkGetConstReferenceMacro(CroppedInputImageRegion, InputImageRegionType);
itkSetClampMacro(NumberOfSamples, unsigned long, 1, NumericTraits<unsigned long>::max());
itkGetConstMacro(NumberOfSamples, unsigned long);
itkSetMacro(UseMultiThread, bool);
protected:
ImageSamplerBase();
~ImageSamplerBase() override = default;
void
PrintSelf(std::ostream & os, Indent indent) const override;
void
GenerateInputRequestedRegion() override;
virtual bool
IsInsideAllMasks(const InputImagePointType & point) const;
virtual void
UpdateAllMasks();
virtual bool
CheckInputImageRegions();
void
CropInputImageRegion();
static std::vector<InputImageRegionType>
SplitRegion(const InputImageRegionType & inputRegion, const size_t requestedNumberOfSubregions);
/***/
unsigned long m_NumberOfSamples{ 0 };
bool m_UseMultiThread{ true };
private:
// Private using-declarations, to avoid `-Woverloaded-virtual` warnings from GCC (GCC 11.4) or clang (macos-12).
using ProcessObject::MakeOutput;
using ProcessObject::SetInput;
MaskConstPointer m_Mask{ nullptr };
MaskVectorType m_MaskVector{};
unsigned int m_NumberOfMasks{ 0 };
InputImageRegionType m_InputImageRegion{};
InputImageRegionVectorType m_InputImageRegionVector{};
unsigned int m_NumberOfInputImageRegions{ 0 };
InputImageRegionType m_CroppedInputImageRegion{};
InputImageRegionType m_DummyInputImageRegion{};
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
# include "itkImageSamplerBase.hxx"
#endif
#endif // end #ifndef itkImageSamplerBase_h
itk::ImageRandomSamplerSparseMask::InputImageType
TInputImage InputImageType
Definition itkImageSamplerBase.h:66
itk::ImageSample
A class that defines an image sample, which is the coordinates of a point and its value.
Definition itkImageSample.h:37
itk::ImageSample< InputImageType >::RealType
typename NumericTraits< PixelType >::RealType RealType
Definition itkImageSample.h:43
itk::ImageSamplerBase::SetInput
void SetInput(unsigned int idx, const InputImageType *input)
itk::ImageSamplerBase< FixedImageType >::InputImageRegionVectorType
std::vector< InputImageRegionType > InputImageRegionVectorType
Definition itkImageSamplerBase.h:88
itk::ImageSamplerBase::GetInputImageRegion
virtual const InputImageRegionType & GetInputImageRegion() const
Definition itkImageSamplerBase.h:172
itk::ImageSamplerBase::GetMask
virtual const MaskType * GetMask(unsigned int pos) const
itk::ImageSamplerBase::GetInput
const InputImageType * GetInput(unsigned int idx)
itk::ImageSamplerBase::CheckInputImageRegions
virtual bool CheckInputImageRegions()
itk::ImageSamplerBase::MakeOutput
DataObject::Pointer MakeOutput(ProcessObject::DataObjectPointerArraySizeType idx) override
itk::ImageSamplerBase::~ImageSamplerBase
~ImageSamplerBase() override=default
itk::ImageSamplerBase::GenerateInputRequestedRegion
void GenerateInputRequestedRegion() override
itk::ImageSamplerBase::CropInputImageRegion
void CropInputImageRegion()
itk::ImageSamplerBase< FixedImageType >::OutputVectorContainerType
VectorDataContainer< std::vcl_size_t, ImageSample< FixedImageType > > OutputVectorContainerType
itk::ImageSamplerBase< FixedImageType >::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition itkImageSamplerBase.h:68
itk::ImageSamplerBase< FixedImageType >::m_NumberOfSamples
unsigned long m_NumberOfSamples
Definition itkImageSamplerBase.h:250
itk::ImageSamplerBase::GetInput
const InputImageType * GetInput()
itk::ImageSamplerBase::UpdateAllMasks
virtual void UpdateAllMasks()
itk::ImageSamplerBase< FixedImageType >::m_CroppedInputImageRegion
InputImageRegionType m_CroppedInputImageRegion
Definition itkImageSamplerBase.h:269
itk::ImageSamplerBase::SetMask
virtual void SetMask(const MaskType *_arg, unsigned int pos)
itk::ImageSamplerBase< FixedImageType >::ImageSampleType
ImageSample< InputImageType > ImageSampleType
Definition itkImageSamplerBase.h:76
itk::ImageSamplerBase::GetInputImageRegion
virtual const InputImageRegionType & GetInputImageRegion(unsigned int pos) const
itk::ImageSamplerBase::IsInsideAllMasks
virtual bool IsInsideAllMasks(const InputImagePointType &point) const
itk::ImageSamplerBase< FixedImageType >::Self
ImageSamplerBase Self
Definition itkImageSamplerBase.h:49
itk::ImageSamplerBase< FixedImageType >::m_MaskVector
MaskVectorType m_MaskVector
Definition itkImageSamplerBase.h:263
itk::ImageSamplerBase::GetMask
virtual const MaskType * GetMask() const
Definition itkImageSamplerBase.h:139
itk::ImageSamplerBase::GetOutput
OutputVectorContainerType * GetOutput()
itk::ImageSamplerBase::SplitRegion
static std::vector< InputImageRegionType > SplitRegion(const InputImageRegionType &inputRegion, const vcl_size_t requestedNumberOfSubregions)
itk::ImageSamplerBase< FixedImageType >::ImageSampleContainerType
VectorDataContainer< std::vcl_size_t, ImageSampleType > ImageSampleContainerType
Definition itkImageSamplerBase.h:77
itk::ImageSamplerBase< FixedImageType >::m_InputImageRegion
InputImageRegionType m_InputImageRegion
Definition itkImageSamplerBase.h:265
itk::ImageSamplerBase::SetInput
void SetInput(const InputImageType *input)
itk::ImageSamplerBase< FixedImageType >::InputImagePointType
typename InputImageType::PointType InputImagePointType
Definition itkImageSamplerBase.h:81
itk::ImageSamplerBase::SetMask
virtual void SetMask(const MaskType *_arg)
Definition itkImageSamplerBase.h:127
itk::ImageSamplerBase::SetInputImageRegion
virtual void SetInputImageRegion(const InputImageRegionType _arg)
Definition itkImageSamplerBase.h:160
itk::ImageSamplerBase::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const override
itk::ImageSamplerBase< FixedImageType >::InputImageSizeType
typename InputImageType::SizeType InputImageSizeType
Definition itkImageSamplerBase.h:79
itk::ImageSamplerBase< FixedImageType >::m_InputImageRegionVector
InputImageRegionVectorType m_InputImageRegionVector
Definition itkImageSamplerBase.h:266
itk::ImageSamplerBase< FixedImageType >::Pointer
SmartPointer< Self > Pointer
Definition itkImageSamplerBase.h:51
itk::ImageSamplerBase::SetNumberOfMasks
virtual void SetNumberOfMasks(const unsigned int _arg)
itk::ImageSamplerBase::ITK_DISALLOW_COPY_AND_MOVE
ITK_DISALLOW_COPY_AND_MOVE(ImageSamplerBase)
itk::ImageSamplerBase::itkStaticConstMacro
itkStaticConstMacro(InputImageDimension, unsigned int, InputImageType::ImageDimension)
itk::ImageSamplerBase< FixedImageType >::m_NumberOfInputImageRegions
unsigned int m_NumberOfInputImageRegions
Definition itkImageSamplerBase.h:267
itk::ImageSamplerBase< FixedImageType >::MaskConstPointer
typename MaskType::ConstPointer MaskConstPointer
Definition itkImageSamplerBase.h:86
itk::ImageSamplerBase< FixedImageType >::InputImagePointValueType
typename InputImagePointType::ValueType InputImagePointValueType
Definition itkImageSamplerBase.h:82
itk::ImageSamplerBase< FixedImageType >::InputImageType
FixedImageType InputImageType
Definition itkImageSamplerBase.h:66
itk::ImageSamplerBase::SetNumberOfInputImageRegions
virtual void SetNumberOfInputImageRegions(const unsigned int _arg)
itk::ImageSamplerBase< FixedImageType >::MaskVectorType
std::vector< MaskConstPointer > MaskVectorType
Definition itkImageSamplerBase.h:87
itk::ImageSamplerBase< FixedImageType >::ImageSampleValueType
typename ImageSampleType::RealType ImageSampleValueType
Definition itkImageSamplerBase.h:83
itk::ImageSamplerBase< FixedImageType >::InputImageIndexType
typename InputImageType::IndexType InputImageIndexType
Definition itkImageSamplerBase.h:80
itk::ImageSamplerBase< FixedImageType >::m_DummyInputImageRegion
InputImageRegionType m_DummyInputImageRegion
Definition itkImageSamplerBase.h:270
itk::ImageSamplerBase< FixedImageType >::m_Mask
MaskConstPointer m_Mask
Definition itkImageSamplerBase.h:262
itk::ImageSamplerBase< FixedImageType >::ConstPointer
SmartPointer< const Self > ConstPointer
Definition itkImageSamplerBase.h:52
itk::ImageSamplerBase< FixedImageType >::m_NumberOfMasks
unsigned int m_NumberOfMasks
Definition itkImageSamplerBase.h:264
itk::ImageSamplerBase< FixedImageType >::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition itkImageSamplerBase.h:69
itk::ImageSamplerBase::ImageSamplerBase
ImageSamplerBase()
itk::ImageSamplerBase::SelectingNewSamplesOnUpdateSupported
virtual bool SelectingNewSamplesOnUpdateSupported() const
Definition itkImageSamplerBase.h:196
itk::ImageSamplerBase< FixedImageType >::ImageSampleContainerPointer
typename ImageSampleContainerType::Pointer ImageSampleContainerPointer
Definition itkImageSamplerBase.h:78
itk::ImageSamplerBase::SetInputImageRegion
virtual void SetInputImageRegion(const InputImageRegionType _arg, unsigned int pos)
itk::ImageSamplerBase< FixedImageType >::MaskPointer
typename MaskType::Pointer MaskPointer
Definition itkImageSamplerBase.h:85
itk::ImageSamplerBase< FixedImageType >::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition itkImageSamplerBase.h:67
itk::ImageSamplerBase< FixedImageType >::MaskType
ImageMaskSpatialObject< Self::InputImageDimension > MaskType
Definition itkImageSamplerBase.h:84
itk::ImageSamplerBase< FixedImageType >::Superclass
VectorContainerSource< VectorDataContainer< std::vcl_size_t, ImageSample< FixedImageType > > > Superclass
Definition itkImageSamplerBase.h:50
itk::ImageSamplerBase< FixedImageType >::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition itkImageSamplerBase.h:70
itk::ImageSamplerBase::SelectNewSamplesOnUpdate
virtual bool SelectNewSamplesOnUpdate()
itk::ImageSamplerBase< FixedImageType >::m_UseMultiThread
bool m_UseMultiThread
Definition itkImageSamplerBase.h:254
itk::VectorContainerSource< VectorDataContainer< std::vcl_size_t, ImageSample< TInputImage > > >::OutputVectorContainerType
VectorDataContainer< std::vcl_size_t, ImageSample< TInputImage > > OutputVectorContainerType
Definition itkVectorContainerSource.h:51
itk::VectorContainerSource< VectorDataContainer< std::vcl_size_t, ImageSample< TInputImage > > >::VectorContainerSource
VectorContainerSource()
itk::VectorContainerSource< VectorDataContainer< std::vcl_size_t, ImageSample< TInputImage > > >::OutputVectorContainerPointer
typename OutputVectorContainerType::Pointer OutputVectorContainerPointer
Definition itkVectorContainerSource.h:52
itk::VectorDataContainer
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
Definition itkVectorDataContainer.h:76
itk::VectorDataContainer< std::vcl_size_t, ImageSampleType >::Pointer
SmartPointer< Self > Pointer
Definition itkVectorDataContainer.h:81
itkImageSample.h
itkVectorContainerSource.h
itkVectorDataContainer.h
itk
Definition itkAdvancedImageToImageMetric.h:43

Generated on 1768596610 for elastix by 1.15.0 |