Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __ImageSamplerBase_h
00016 #define __ImageSamplerBase_h
00017
00018 #include "itkImageToVectorContainerFilter.h"
00019 #include "itkImageSample.h"
00020 #include "itkVectorDataContainer.h"
00021 #include "itkSpatialObject.h"
00022
00023
00024 namespace itk
00025 {
00026
00040 template < class TInputImage >
00041 class ImageSamplerBase :
00042 public ImageToVectorContainerFilter< TInputImage,
00043 VectorDataContainer< unsigned long, ImageSample< TInputImage > > >
00044 {
00045 public:
00046
00048 typedef ImageSamplerBase Self;
00049 typedef ImageToVectorContainerFilter<
00050 TInputImage,
00051 VectorDataContainer<
00052 unsigned long,
00053 ImageSample< TInputImage > > > Superclass;
00054 typedef SmartPointer<Self> Pointer;
00055 typedef SmartPointer<const Self> ConstPointer;
00056
00058 itkNewMacro( Self );
00059
00061 itkTypeMacro( ImageSamplerBase, ImageToVectorContainerFilter );
00062
00064 typedef typename Superclass::DataObjectPointer DataObjectPointer;
00065 typedef typename Superclass::OutputVectorContainerType OutputVectorContainerType;
00066 typedef typename Superclass::OutputVectorContainerPointer OutputVectorContainerPointer;
00067 typedef typename Superclass::InputImageType InputImageType;
00068 typedef typename Superclass::InputImagePointer InputImagePointer;
00069 typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
00070 typedef typename Superclass::InputImageRegionType InputImageRegionType;
00071 typedef typename Superclass::InputImagePixelType InputImagePixelType;
00072
00074 itkStaticConstMacro( InputImageDimension, unsigned int,
00075 InputImageType::ImageDimension );
00076
00078 typedef ImageSample< InputImageType > ImageSampleType;
00079 typedef VectorDataContainer< unsigned long,
00080 ImageSampleType > ImageSampleContainerType;
00081 typedef typename InputImageType::SizeType InputImageSizeType;
00082 typedef typename InputImageType::IndexType InputImageIndexType;
00083 typedef typename InputImageType::PointType InputImagePointType;
00084 typedef typename InputImagePointType::ValueType InputImagePointValueType;
00085 typedef typename ImageSampleType::RealType ImageSampleValueType;
00086 typedef SpatialObject<
00087 itkGetStaticConstMacro( InputImageDimension ) > MaskType;
00088 typedef typename MaskType::Pointer MaskPointer;
00089 typedef typename MaskType::ConstPointer MaskConstPointer;
00090 typedef std::vector< MaskConstPointer > MaskVectorType;
00091 typedef std::vector< InputImageRegionType > InputImageRegionVectorType;
00092
00096 virtual void SetMask( const MaskType *_arg, unsigned int pos );
00097
00100 virtual void SetMask( const MaskType *_arg )
00101 {
00102 this->SetMask( _arg, 0 );
00103 }
00104
00106 virtual const MaskType * GetMask( unsigned int pos ) const;
00107
00109 virtual const MaskType * GetMask( void ) const
00110 {
00111 return this->GetMask( 0 );
00112 };
00113
00115 virtual void SetNumberOfMasks( const unsigned int _arg );
00116
00118 itkGetConstMacro( NumberOfMasks, unsigned int );
00119
00123 virtual void SetInputImageRegion( const InputImageRegionType _arg, unsigned int pos );
00124
00126 virtual void SetInputImageRegion( const InputImageRegionType _arg )
00127 {
00128 this->SetInputImageRegion( _arg, 0 );
00129 }
00130
00132 virtual const InputImageRegionType & GetInputImageRegion( unsigned int pos ) const;
00133
00135 virtual const InputImageRegionType & GetInputImageRegion( void ) const
00136 {
00137 return this->GetInputImageRegion( 0 );
00138 };
00139
00141 virtual void SetNumberOfInputImageRegions( const unsigned int _arg );
00142
00144 itkGetConstMacro( NumberOfInputImageRegions, unsigned int );
00145
00151 virtual bool SelectNewSamplesOnUpdate( void );
00152
00154 virtual bool SelectingNewSamplesOnUpdateSupported( void ) const
00155 {
00156 return true;
00157 }
00158
00160 itkGetConstReferenceMacro( CroppedInputImageRegion, InputImageRegionType );
00161
00162 protected:
00163
00165 ImageSamplerBase();
00166
00168 virtual ~ImageSamplerBase() {};
00169
00171 void PrintSelf( std::ostream& os, Indent indent ) const;
00172
00174 virtual void GenerateInputRequestedRegion( void );
00175
00177 virtual bool IsInsideAllMasks( const InputImagePointType & point ) const;
00178
00180 virtual void UpdateAllMasks( void );
00181
00185 virtual bool CheckInputImageRegions( void );
00186
00188 void CropInputImageRegion( void );
00189
00190 private:
00191
00193 ImageSamplerBase( const Self& );
00195 void operator=( const Self& );
00196
00198 MaskConstPointer m_Mask;
00199 MaskVectorType m_MaskVector;
00200 unsigned int m_NumberOfMasks;
00201 InputImageRegionType m_InputImageRegion;
00202 InputImageRegionVectorType m_InputImageRegionVector;
00203 unsigned int m_NumberOfInputImageRegions;
00204
00205 InputImageRegionType m_CroppedInputImageRegion;
00206 InputImageRegionType m_DummyInputImageRegion;
00207
00208 };
00209
00210
00211 }
00212
00213 #ifndef ITK_MANUAL_INSTANTIATION
00214 #include "itkImageSamplerBase.txx"
00215 #endif
00216
00217 #endif // end #ifndef __ImageSamplerBase_h
00218