00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkJointDomainImageToListAdaptor_h
00018 #define __itkJointDomainImageToListAdaptor_h
00019
00020 #include "itkMacro.h"
00021 #include "itkFixedArray.h"
00022 #include "itkPoint.h"
00023 #include "itkPixelTraits.h"
00024 #include "itkImageToListAdaptor.h"
00025 #include "itkImageRegionIteratorWithIndex.h"
00026 #include "itkEuclideanDistance.h"
00027 #include "itkListSample.h"
00028
00029 namespace itk{
00030 namespace Statistics{
00031
00039 template< class TImage >
00040 struct ImageJointDomainTraits
00041 {
00042 typedef ImageJointDomainTraits Self ;
00043 typedef PixelTraits< typename TImage::PixelType > PixelTraitsType ;
00044 typedef typename PixelTraitsType::ValueType RangeDomainMeasurementType ;
00045 typedef typename TImage::IndexType::IndexValueType IndexValueType ;
00046 itkStaticConstMacro(ImageDimension, unsigned int, TImage::ImageDimension) ;
00047 itkStaticConstMacro(Dimension,
00048 unsigned int,
00049 TImage::ImageDimension +
00050 PixelTraitsType::Dimension ) ;
00051 typedef float CoordinateRepType ;
00052 typedef Point< CoordinateRepType, itkGetStaticConstMacro(ImageDimension) > PointType ;
00053 typedef JoinTraits< RangeDomainMeasurementType, CoordinateRepType >
00054 JoinTraitsType ;
00055 typedef typename JoinTraitsType::ValueType MeasurementType ;
00056 typedef FixedArray< MeasurementType, itkGetStaticConstMacro(Dimension) >
00057 MeasurementVectorType ;
00058 } ;
00059
00089 template < class TImage >
00090 class ITK_EXPORT JointDomainImageToListAdaptor
00091 : public ImageToListAdaptor<
00092 TImage,
00093 typename ImageJointDomainTraits< TImage >::MeasurementVectorType >
00094 {
00095 public:
00096 typedef ImageJointDomainTraits< TImage > ImageJointDomainTraitsType ;
00097 typedef typename ImageJointDomainTraitsType::MeasurementVectorType
00098 MeasurementVectorType ;
00099 typedef typename ImageJointDomainTraitsType::MeasurementType
00100 MeasurementType ;
00101 typedef typename ImageJointDomainTraitsType::RangeDomainMeasurementType
00102 RangeDomainMeasurementType ;
00103 typedef typename ImageJointDomainTraitsType::PointType PointType ;
00104 typedef typename ImageJointDomainTraitsType::CoordinateRepType
00105 CoordinateRepType ;
00107 typedef JointDomainImageToListAdaptor Self;
00108 typedef ImageToListAdaptor< TImage, MeasurementVectorType >
00109 Superclass;
00110 typedef SmartPointer< Self > Pointer;
00111
00113 itkTypeMacro(JointDomainImageToListAdaptor, ImageToListAdaptor) ;
00114
00116 itkNewMacro(Self) ;
00117
00119 itkStaticConstMacro(MeasurementVectorSize,
00120 unsigned int,
00121 ImageJointDomainTraitsType::Dimension) ;
00122
00125 typedef typename Superclass::FrequencyType FrequencyType ;
00126 typedef typename Superclass::InstanceIdentifier InstanceIdentifier ;
00127
00128 typedef typename TImage::IndexType ImageIndexType ;
00129 typedef typename TImage::IndexType::IndexValueType ImageIndexValueType ;
00130 typedef typename TImage::SizeType ImageSizeType ;
00131 typedef typename TImage::RegionType ImageRegionType ;
00132 typedef ImageRegionIteratorWithIndex< TImage > ImageIteratorType ;
00133
00134 typedef MeasurementVectorType ValueType ;
00135
00136 itkStaticConstMacro(RangeDomainDimension,
00137 unsigned int,
00138 itk::PixelTraits<
00139 typename TImage::PixelType >::Dimension) ;
00140
00141 typedef FixedArray< RangeDomainMeasurementType,
00142 itkGetStaticConstMacro( RangeDomainDimension ) >
00143 RangeDomainMeasurementVectorType ;
00144
00145 typedef std::vector< InstanceIdentifier > InstanceIdentifierVectorType ;
00146
00147 typedef FixedArray< float, itkGetStaticConstMacro(MeasurementVectorSize) >
00148 NormalizationFactorsType ;
00149
00151 void SetNormalizationFactors(NormalizationFactorsType& factors) ;
00152
00155 inline MeasurementVectorType GetMeasurementVector(const InstanceIdentifier &id) ;
00156
00159 inline void ComputeRegion(const MeasurementVectorType& mv,
00160 const double radius,
00161 ImageRegionType& region) ;
00162
00166 inline void Search(const MeasurementVectorType& mv,
00167 const double radius,
00168 InstanceIdentifierVectorType& result) ;
00169
00170 protected:
00171 JointDomainImageToListAdaptor() ;
00172 virtual ~JointDomainImageToListAdaptor() {}
00173 void PrintSelf(std::ostream& os, Indent indent) const;
00174
00175 private:
00176 JointDomainImageToListAdaptor(const Self&) ;
00177 void operator=(const Self&) ;
00178
00179 NormalizationFactorsType m_NormalizationFactors ;
00180
00181 MeasurementVectorType m_TempVector ;
00182 PointType m_TempPoint ;
00183 ImageIndexType m_TempIndex ;
00184 RangeDomainMeasurementVectorType m_TempRangeVector ;
00185 } ;
00186
00187 }
00188 }
00189
00190 #ifndef ITK_MANUAL_INSTANTIATION
00191 #include "itkJointDomainImageToListAdaptor.txx"
00192 #endif
00193
00194 #endif