go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkMultiInputImageRandomCoordinateSampler.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 itkMultiInputImageRandomCoordinateSampler_h
19#define itkMultiInputImageRandomCoordinateSampler_h
20
22#include "itkInterpolateImageFunction.h"
23#include "itkBSplineInterpolateImageFunction.h"
24#include "itkMersenneTwisterRandomVariateGenerator.h"
25
26namespace itk
27{
28
39template <class TInputImage>
40class ITK_TEMPLATE_EXPORT MultiInputImageRandomCoordinateSampler : public ImageRandomSamplerBase<TInputImage>
41{
42public:
44
48 using Pointer = SmartPointer<Self>;
49 using ConstPointer = SmartPointer<const Self>;
50
52 itkNewMacro(Self);
53
56
58 using typename Superclass::DataObjectPointer;
61 using typename Superclass::InputImageType;
62 using typename Superclass::InputImagePointer;
66 using typename Superclass::ImageSampleType;
68 using typename Superclass::MaskType;
69 using typename Superclass::InputImageSizeType;
70 using InputImageSpacingType = typename InputImageType::SpacingType;
75
77 itkStaticConstMacro(InputImageDimension, unsigned int, Superclass::InputImageDimension);
78
83 using InterpolatorType = InterpolateImageFunction<InputImageType, CoordRepType>;
84 using InterpolatorPointer = typename InterpolatorType::Pointer;
85 using DefaultInterpolatorType = BSplineInterpolateImageFunction<InputImageType, CoordRepType, double>;
86
88 using RandomGeneratorType = itk::Statistics::MersenneTwisterRandomVariateGenerator;
89 using RandomGeneratorPointer = typename RandomGeneratorType::Pointer;
90
92 itkSetObjectMacro(Interpolator, InterpolatorType);
94
98 itkSetMacro(SampleRegionSize, InputImageSpacingType);
99 itkGetConstReferenceMacro(SampleRegionSize, InputImageSpacingType);
100
103 itkGetConstMacro(UseRandomSampleRegion, bool);
104 itkSetMacro(UseRandomSampleRegion, bool);
105
106protected:
107 using InputImageContinuousIndexType = typename InterpolatorType::ContinuousIndexType;
108
111
114
116 void
117 PrintSelf(std::ostream & os, Indent indent) const override;
118
120 void
121 GenerateData() override;
122
125 virtual void
127 const InputImageContinuousIndexType & largestContIndex,
128 InputImageContinuousIndexType & randomContIndex);
129
130 InterpolatorPointer m_Interpolator = [] {
131 const auto interpolator = DefaultInterpolatorType::New();
132 interpolator->SetSplineOrder(3);
133 return interpolator;
134 }();
135
136 RandomGeneratorPointer m_RandomGenerator{ RandomGeneratorType::GetInstance() };
137 InputImageSpacingType m_SampleRegionSize{ itk::MakeFilled<InputImageSpacingType>(1.0) };
138
140 virtual void
142 InputImageContinuousIndexType & largestContIndex);
143
144private:
145 bool m_UseRandomSampleRegion{ false };
146};
147
148} // end namespace itk
149
150#ifndef ITK_MANUAL_INSTANTIATION
151# include "itkMultiInputImageRandomCoordinateSampler.hxx"
152#endif
153
154#endif // end #ifndef itkMultiInputImageRandomCoordinateSampler_h
This class is a base class for any image sampler that randomly picks samples.
typename InputImageType::ConstPointer InputImageConstPointer
typename InputImageType::RegionType InputImageRegionType
typename InputImageType::Pointer InputImagePointer
ImageMaskSpatialObject< Self::InputImageDimension > MaskType
typename InputImageType::PixelType InputImagePixelType
A class that defines an image sample, which is the coordinates of a point and its value.
typename InputImageType::PointType InputImagePointType
typename InputImageType::SizeType InputImageSizeType
typename InputImagePointType::ValueType InputImagePointValueType
typename ImageSampleType::RealType ImageSampleValueType
typename InputImageType::IndexType InputImageIndexType
Samples an image by randomly composing a set of physical coordinates.
virtual void GenerateRandomCoordinate(const InputImageContinuousIndexType &smallestContIndex, const InputImageContinuousIndexType &largestContIndex, InputImageContinuousIndexType &randomContIndex)
itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType
itkStaticConstMacro(InputImageDimension, unsigned int, Superclass::InputImageDimension)
ITK_DISALLOW_COPY_AND_MOVE(MultiInputImageRandomCoordinateSampler)
virtual void GenerateSampleRegion(InputImageContinuousIndexType &smallestContIndex, InputImageContinuousIndexType &largestContIndex)
typename InterpolatorType::ContinuousIndexType InputImageContinuousIndexType
BSplineInterpolateImageFunction< InputImageType, CoordRepType, double > DefaultInterpolatorType
itkGetModifiableObjectMacro(Interpolator, InterpolatorType)
~MultiInputImageRandomCoordinateSampler() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
InterpolateImageFunction< InputImageType, CoordRepType > InterpolatorType
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