Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __MultiInputImageRandomCoordinateSampler_h
00016 #define __MultiInputImageRandomCoordinateSampler_h
00017
00018 #include "itkImageRandomSamplerBase.h"
00019 #include "itkInterpolateImageFunction.h"
00020 #include "itkBSplineInterpolateImageFunction.h"
00021 #include "itkMersenneTwisterRandomVariateGenerator.h"
00022
00023
00024 namespace itk
00025 {
00026
00037 template < class TInputImage >
00038 class MultiInputImageRandomCoordinateSampler :
00039 public ImageRandomSamplerBase< TInputImage >
00040 {
00041 public:
00042
00044 typedef MultiInputImageRandomCoordinateSampler Self;
00045 typedef ImageRandomSamplerBase< TInputImage > Superclass;
00046 typedef SmartPointer<Self> Pointer;
00047 typedef SmartPointer<const Self> ConstPointer;
00048
00050 itkNewMacro( Self );
00051
00053 itkTypeMacro( MultiInputImageRandomCoordinateSampler, ImageRandomSamplerBase );
00054
00056 typedef typename Superclass::DataObjectPointer DataObjectPointer;
00057 typedef typename Superclass::OutputVectorContainerType OutputVectorContainerType;
00058 typedef typename Superclass::OutputVectorContainerPointer OutputVectorContainerPointer;
00059 typedef typename Superclass::InputImageType InputImageType;
00060 typedef typename Superclass::InputImagePointer InputImagePointer;
00061 typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
00062 typedef typename Superclass::InputImageRegionType InputImageRegionType;
00063 typedef typename Superclass::InputImagePixelType InputImagePixelType;
00064 typedef typename Superclass::ImageSampleType ImageSampleType;
00065 typedef typename Superclass::ImageSampleContainerType ImageSampleContainerType;
00066 typedef typename Superclass::MaskType MaskType;
00067 typedef typename Superclass::InputImageSizeType InputImageSizeType;
00068 typedef typename InputImageType::SpacingType InputImageSpacingType;
00069 typedef typename Superclass::InputImageIndexType InputImageIndexType;
00070 typedef typename Superclass::InputImagePointType InputImagePointType;
00071 typedef typename Superclass::InputImagePointValueType InputImagePointValueType;
00072 typedef typename Superclass::ImageSampleValueType ImageSampleValueType;
00073
00075 itkStaticConstMacro( InputImageDimension, unsigned int,
00076 Superclass::InputImageDimension );
00077
00081 typedef double CoordRepType;
00082 typedef InterpolateImageFunction<
00083 InputImageType, CoordRepType > InterpolatorType;
00084 typedef BSplineInterpolateImageFunction<
00085 InputImageType, CoordRepType, double> DefaultInterpolatorType;
00086
00088 typedef itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType;
00089
00091 itkSetObjectMacro( Interpolator, InterpolatorType );
00092 itkGetObjectMacro( Interpolator, InterpolatorType );
00093
00097 itkSetMacro( SampleRegionSize, InputImageSpacingType );
00098 itkGetConstReferenceMacro( SampleRegionSize, InputImageSpacingType );
00099
00102 itkGetConstMacro( UseRandomSampleRegion, bool );
00103 itkSetMacro( UseRandomSampleRegion, bool );
00104
00105 protected:
00106
00107 typedef typename InterpolatorType::ContinuousIndexType InputImageContinuousIndexType;
00108
00110 MultiInputImageRandomCoordinateSampler();
00111
00113 virtual ~MultiInputImageRandomCoordinateSampler() {};
00114
00116 void PrintSelf( std::ostream& os, Indent indent ) const;
00117
00119 virtual void GenerateData( void );
00120
00123 virtual void GenerateRandomCoordinate(
00124 const InputImageContinuousIndexType & smallestContIndex,
00125 const InputImageContinuousIndexType & largestContIndex,
00126 InputImageContinuousIndexType & randomContIndex);
00127
00128 typename InterpolatorType::Pointer m_Interpolator;
00129 typename RandomGeneratorType::Pointer m_RandomGenerator;
00130 InputImageSpacingType m_SampleRegionSize;
00131
00133 virtual void GenerateSampleRegion(
00134 InputImageContinuousIndexType & smallestContIndex,
00135 InputImageContinuousIndexType & largestContIndex );
00136
00137 private:
00138
00140 MultiInputImageRandomCoordinateSampler( const Self& );
00142 void operator=( const Self& );
00143
00144 bool m_UseRandomSampleRegion;
00145
00146 };
00147
00148
00149 }
00150
00151 #ifndef ITK_MANUAL_INSTANTIATION
00152 #include "itkMultiInputImageRandomCoordinateSampler.txx"
00153 #endif
00154
00155 #endif // end #ifndef __MultiInputImageRandomCoordinateSampler_h
00156