go home Home | Main Page | Topics | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkImageRandomSamplerSparseMask.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 itkImageRandomSamplerSparseMask_h
19#define itkImageRandomSamplerSparseMask_h
20
22#include "itkMersenneTwisterRandomVariateGenerator.h"
23#include "itkImageFullSampler.h"
24
25namespace itk
26{
36
37template <typename TInputImage>
38class ITK_TEMPLATE_EXPORT ImageRandomSamplerSparseMask : public ImageRandomSamplerBase<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 using typename Superclass::MaskType;
68
70 itkStaticConstMacro(InputImageDimension, unsigned int, Superclass::InputImageDimension);
71
73 using InputImageIndexType = typename InputImageType::IndexType;
74 using InputImagePointType = typename InputImageType::PointType;
75
77 using RandomGeneratorType = itk::Statistics::MersenneTwisterRandomVariateGenerator;
78 using RandomGeneratorPointer = typename RandomGeneratorType::Pointer;
79
80protected:
83
87 ~ImageRandomSamplerSparseMask() override = default;
88
90 void
91 PrintSelf(std::ostream & os, Indent indent) const override;
92
94 void
95 GenerateData() override;
96
98
99private:
100 struct UserData
101 {
102 const std::vector<ImageSampleType> & m_AllValidSamples;
103 const std::vector<size_t> & m_RandomIndices;
104 std::vector<ImageSampleType> & m_Samples;
105 };
106
107 std::vector<size_t> m_RandomIndices{};
108
109 static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
110 ThreaderCallback(void * arg);
111};
112
113} // end namespace itk
114
115#ifndef ITK_MANUAL_INSTANTIATION
116# include "itkImageRandomSamplerSparseMask.hxx"
117#endif
118
119#endif // end #ifndef itkImageRandomSamplerSparseMask_h
Samples all voxels in the InputImageRegion.
VectorDataContainer< ImageSampleType > ImageSampleContainerType
typename InputImageType::ConstPointer InputImageConstPointer
ImageSample< InputImageType > ImageSampleType
typename InputImageType::RegionType InputImageRegionType
typename ImageSampleContainerType::Pointer ImageSampleContainerPointer
typename InputImageType::Pointer InputImagePointer
ImageMaskSpatialObject< Self::InputImageDimension > MaskType
typename InputImageType::PixelType InputImagePixelType
typename RandomGeneratorType::Pointer RandomGeneratorPointer
itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType
typename InputImageType::PointType InputImagePointType
void PrintSelf(std::ostream &os, Indent indent) const override
ITK_DISALLOW_COPY_AND_MOVE(ImageRandomSamplerSparseMask)
ImageRandomSamplerBase< TInputImage > Superclass
itk::ImageFullSampler< InputImageType > InternalFullSamplerType
~ImageRandomSamplerSparseMask() override=default
typename InternalFullSamplerType::Pointer InternalFullSamplerPointer
itkOverrideGetNameOfClassMacro(ImageRandomSamplerSparseMask)
typename InputImageType::IndexType InputImageIndexType
itkStaticConstMacro(InputImageDimension, unsigned int, Superclass::InputImageDimension)
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION ThreaderCallback(void *arg)
const std::vector< ImageSampleType > & m_AllValidSamples


Generated on 26-02-2026 for elastix by doxygen 1.16.1 (669aeeefca743c148e2d935b3d3c69535c7491e6) elastix logo