Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __ImageRandomCoordinateSampler_h
00016 #define __ImageRandomCoordinateSampler_h
00017
00018 #include "itkImageRandomSamplerBase.h"
00019 #include "itkInterpolateImageFunction.h"
00020 #include "itkBSplineInterpolateImageFunction.h"
00021 #include "itkMersenneTwisterRandomVariateGenerator.h"
00022
00023 namespace itk
00024 {
00025
00036 template < class TInputImage >
00037 class ImageRandomCoordinateSampler :
00038 public ImageRandomSamplerBase< TInputImage >
00039 {
00040 public:
00041
00043 typedef ImageRandomCoordinateSampler Self;
00044 typedef ImageRandomSamplerBase< TInputImage > Superclass;
00045 typedef SmartPointer<Self> Pointer;
00046 typedef SmartPointer<const Self> ConstPointer;
00047
00049 itkNewMacro( Self );
00050
00052 itkTypeMacro( ImageRandomCoordinateSampler, ImageRandomSamplerBase );
00053
00055 typedef typename Superclass::DataObjectPointer DataObjectPointer;
00056 typedef typename Superclass::OutputVectorContainerType OutputVectorContainerType;
00057 typedef typename Superclass::OutputVectorContainerPointer OutputVectorContainerPointer;
00058 typedef typename Superclass::InputImageType InputImageType;
00059 typedef typename Superclass::InputImagePointer InputImagePointer;
00060 typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
00061 typedef typename Superclass::InputImageRegionType InputImageRegionType;
00062 typedef typename Superclass::InputImagePixelType InputImagePixelType;
00063 typedef typename Superclass::ImageSampleType ImageSampleType;
00064 typedef typename Superclass::ImageSampleContainerType ImageSampleContainerType;
00065 typedef typename Superclass::MaskType MaskType;
00066 typedef typename Superclass::InputImageSizeType InputImageSizeType;
00067 typedef typename InputImageType::SpacingType InputImageSpacingType;
00068 typedef typename Superclass::InputImageIndexType InputImageIndexType;
00069 typedef typename Superclass::InputImagePointType InputImagePointType;
00070 typedef typename Superclass::InputImagePointValueType InputImagePointValueType;
00071 typedef typename Superclass::ImageSampleValueType ImageSampleValueType;
00072
00074 itkStaticConstMacro( InputImageDimension, unsigned int,
00075 Superclass::InputImageDimension );
00076
00079 typedef double CoordRepType;
00080 typedef InterpolateImageFunction<
00081 InputImageType, CoordRepType > InterpolatorType;
00082 typedef BSplineInterpolateImageFunction<
00083 InputImageType, CoordRepType, double> DefaultInterpolatorType;
00084
00086 typedef itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType;
00087
00089 itkSetObjectMacro(Interpolator, InterpolatorType);
00090 itkGetObjectMacro(Interpolator, InterpolatorType);
00091
00094 itkSetMacro( SampleRegionSize, InputImageSpacingType );
00095 itkGetConstReferenceMacro( SampleRegionSize, InputImageSpacingType );
00096
00099 itkGetConstMacro(UseRandomSampleRegion, bool);
00100 itkSetMacro(UseRandomSampleRegion, bool);
00101
00102 protected:
00103
00104 typedef typename InterpolatorType::ContinuousIndexType InputImageContinuousIndexType;
00105
00107 ImageRandomCoordinateSampler();
00109 virtual ~ImageRandomCoordinateSampler() {};
00110
00112 void PrintSelf( std::ostream& os, Indent indent ) const;
00113
00115 virtual void GenerateData( void );
00116
00119 virtual void GenerateRandomCoordinate(
00120 const InputImageContinuousIndexType & smallestContIndex,
00121 const InputImageContinuousIndexType & largestContIndex,
00122 InputImageContinuousIndexType & randomContIndex);
00123
00124 typename InterpolatorType::Pointer m_Interpolator;
00125 typename RandomGeneratorType::Pointer m_RandomGenerator;
00126 InputImageSpacingType m_SampleRegionSize;
00127
00133 virtual void GenerateSampleRegion(
00134 const InputImageContinuousIndexType & smallestImageContIndex,
00135 const InputImageContinuousIndexType & largestImageContIndex,
00136 InputImageContinuousIndexType & smallestContIndex,
00137 InputImageContinuousIndexType & largestContIndex );
00138
00139 private:
00140
00142 ImageRandomCoordinateSampler( const Self& );
00144 void operator=( const Self& );
00145
00146 bool m_UseRandomSampleRegion;
00147
00148 };
00149
00150
00151 }
00152
00153 #ifndef ITK_MANUAL_INSTANTIATION
00154 #include "itkImageRandomCoordinateSampler.txx"
00155 #endif
00156
00157 #endif // end #ifndef __ImageRandomCoordinateSampler_h
00158