00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkBloxBoundaryPointImageToBloxBoundaryProfileImageFilter_h
00018 #define __itkBloxBoundaryPointImageToBloxBoundaryProfileImageFilter_h
00019
00020 #include "itkBloxBoundaryPointImage.h"
00021 #include "itkBloxBoundaryProfileImage.h"
00022 #include "itkImageToImageFilter.h"
00023 #include "itkSize.h"
00024
00025 namespace itk
00026 {
00027
00047 template< typename TSourceImage >
00048 class ITK_EXPORT BloxBoundaryPointImageToBloxBoundaryProfileImageFilter :
00049 public ImageToImageFilter<TSourceImage,BloxBoundaryProfileImage< ::itk::GetImageDimension<TSourceImage>::ImageDimension> >
00050 {
00051 public:
00053 itkStaticConstMacro(NDimensions, unsigned int, TSourceImage::ImageDimension);
00054
00056 typedef BloxBoundaryPointImageToBloxBoundaryProfileImageFilter Self;
00057 typedef ImageToImageFilter<TSourceImage,BloxBoundaryProfileImage<itkGetStaticConstMacro(NDimensions)> > Superclass;
00058 typedef SmartPointer<Self> Pointer;
00059 typedef SmartPointer<const Self> ConstPointer;
00060
00062 itkNewMacro(Self);
00063
00065 itkTypeMacro(itkBloxBoundaryPointImageToBloxBoundaryProfileImageFilter, ImageToImageFilter);
00066
00068 typedef BloxBoundaryPointImage<itkGetStaticConstMacro(NDimensions)> BoundaryPointImageType;
00069 typedef typename BoundaryPointImageType::Pointer BoundaryPointImagePointer;
00070 typedef typename BoundaryPointImageType::RegionType BoundaryPointImageRegionType;
00071 typedef typename BoundaryPointImageType::PixelType BoundaryPointImagePixelType;
00072 typedef typename BoundaryPointImageType::ConstPointer BoundaryPointImageConstPointer;
00073
00075 typedef TSourceImage SourceImageType;
00076 typedef typename SourceImageType::Pointer SourceImagePointer;
00077 typedef typename SourceImageType::RegionType SourceImageRegionType;
00078 typedef typename SourceImageType::PixelType SourceImagePixelType;
00079 typedef typename SourceImageType::ConstPointer SourceImageConstPointer;
00080
00082 typedef BloxBoundaryProfileImage<itkGetStaticConstMacro(NDimensions)> OutputImageType;
00083 typedef typename OutputImageType::Pointer OutputImagePointer;
00084 typedef typename OutputImageType::RegionType OutputImageRegionType;
00085 typedef typename OutputImageType::PixelType OutputImagePixelType;
00086
00088 typedef typename BloxBoundaryProfileImage<itkGetStaticConstMacro(NDimensions)>::IndexType IndexType;
00089
00091 typedef typename BloxBoundaryProfileImage<itkGetStaticConstMacro(NDimensions)>::PixelType PixelType;
00092
00094 typedef Point<double, itkGetStaticConstMacro(NDimensions)> PositionType;
00095
00097 typedef typename PositionType::VectorType VectorType;
00098
00100 void SetInput1( const SourceImageType * image1 );
00101
00103 void SetInput2( const BoundaryPointImageType * image2 );
00104
00106 double FindAccumulatorMaximum();
00107
00109 double FindAccumulatorMinimum();
00110
00112 void FindBoundaryProfiles();
00113
00115 bool AddSplatToAccumulatorAndNormalizer(int binNumber, double weight, double sourcePixelValue);
00116
00118 void NormalizeSplatAccumulator();
00119
00121 int FitProfile();
00122
00124 void Initialize(double setUniqueAxis, double setSymmetricAxes, unsigned int numberOfBins,
00125 unsigned int splatMethod, unsigned int spaceDimension)
00126 {
00127 m_UniqueAxis = setUniqueAxis;
00128 m_SymmetricAxes = setSymmetricAxes;
00129 m_NumberOfBins = numberOfBins;
00130 m_SplatMethod = splatMethod;
00131 m_SpaceDimension = spaceDimension;
00132
00133 m_Accumulator = new double[m_NumberOfBins];
00134 m_Normalizer = new double[m_NumberOfBins];
00135 }
00136
00137 protected:
00138 BloxBoundaryPointImageToBloxBoundaryProfileImageFilter();
00139 ~BloxBoundaryPointImageToBloxBoundaryProfileImageFilter()
00140 {
00141 delete [] m_Accumulator;
00142 delete [] m_Normalizer;
00143 delete [] m_NormalizedAccumulator;
00144 delete [] m_FinalParameters;
00145 };
00146 void PrintSelf(std::ostream& os, Indent indent) const;
00147
00149 void GenerateData();
00150
00151 private:
00152 BloxBoundaryPointImageToBloxBoundaryProfileImageFilter(const Self&);
00153 void operator=(const Self&);
00154
00155 BoundaryPointImagePointer m_BoundaryPointImage;
00156 const double* m_BPImageOrigin;
00157 const double* m_BPImageSpacing;
00158
00159 typename TSourceImage::Pointer m_OriginalImage;
00160 const double* m_OriginalImageOrigin;
00161 const double* m_OriginalImageSpacing;
00162
00164 double m_UniqueAxis;
00165
00167 double m_SymmetricAxes;
00168
00170 unsigned int m_NumberOfBins;
00171
00173 unsigned int m_SplatMethod;
00174
00176 unsigned long int m_NumBoundaryProfiles;
00177
00179 double * m_Accumulator;
00180
00182 double * m_Normalizer;
00183
00185 double * m_NormalizedAccumulator;
00186
00188 double * m_FinalParameters;
00189
00191 unsigned int m_SpaceDimension;
00192 };
00193
00194 }
00195
00196 #ifndef ITK_MANUAL_INSTANTIATION
00197 #include "itkBloxBoundaryPointImageToBloxBoundaryProfileImageFilter.txx"
00198 #endif
00199
00200 #endif