00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkVectorFuzzyConnectednessImageFilter_h
00018 #define __itkVectorFuzzyConnectednessImageFilter_h
00019
00020 #include "itkImage.h"
00021 #include "itkImageToImageFilter.h"
00022 #include "itkVector.h"
00023 #include "itkMatrix.h"
00024 #include <vector>
00025 #include <list>
00026
00027 namespace itk{
00028
00156 template <class TInputImage, class TOutputImage>
00157 class VectorFuzzyConnectednessImageFilter:
00158 public ImageToImageFilter<TInputImage,TOutputImage>
00159 {
00160 public:
00162 typedef VectorFuzzyConnectednessImageFilter Self;
00163 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00164 typedef SmartPointer <Self> Pointer;
00165 typedef SmartPointer<const Self> ConstPointer;
00166
00168 itkNewMacro(Self);
00169
00171 itkTypeMacro(VectorFuzzyConnectednessImageFilter,ImageToImageFilter);
00172
00174 typedef typename TInputImage::PixelType InputPixelType;
00175 typedef typename InputPixelType::VectorType InputVectorType;
00176
00178 itkStaticConstMacro(ImageDimension, unsigned int,
00179 TInputImage::ImageDimension);
00180 itkStaticConstMacro(VectorDimension, unsigned int,
00181 InputPixelType::VectorDimension);
00182
00184 typedef Matrix<double,itkGetStaticConstMacro(VectorDimension),
00185 itkGetStaticConstMacro(VectorDimension)>
00186 MatrixType;
00187 typedef Vector<int,itkGetStaticConstMacro(VectorDimension)> VDVector;
00188 typedef Vector<int,itkGetStaticConstMacro(ImageDimension)> IDVector;
00189
00191 typedef TInputImage InputImageType;
00192 typedef TOutputImage OutputImageType;
00193 typedef Image <unsigned short,itkGetStaticConstMacro(ImageDimension)> UShortImage;
00194 typedef typename TInputImage::IndexType IndexType;
00195 typedef typename TInputImage::SizeType SizeType;
00196 typedef typename TOutputImage::RegionType RegionType;
00197 typedef std::list<IndexType> ListType;
00198 typedef std::vector<IDVector> OffsetType;
00199 typedef std::vector<float> FloatType;
00200
00202 itkSetMacro(Objects, int);
00203 itkGetMacro(Objects, int);
00204
00206 itkSetMacro(SelectedObject, int);
00207 itkGetMacro(SelectedObject, int);
00208
00210 void SetObjectsMatrix(const MatrixType object_max,const int object_num);
00211
00213 void SetObjectsSeed( const IndexType &seed, const int object_num);
00214
00216 void SetObjectsMean(const VDVector, const int object_num);
00217
00219 void Initialization();
00220
00221 protected:
00222 VectorFuzzyConnectednessImageFilter();
00223 ~VectorFuzzyConnectednessImageFilter();
00224
00226 void GenerateData();
00227
00228 private:
00229 SizeType m_Size;
00230 OffsetType *m_SpherePointsLoc;
00231 int *m_SpherePointsNum;
00232
00233 double m_Mask[3][3];
00234 double m_MaskTotal;
00235 VDVector m_HomoMaxDiff;
00236 VDVector m_FeaturesThreshold;
00237 VDVector m_PowerValue;
00238
00239 int m_Objects;
00240 int m_SelectedObject;
00241
00242 MatrixType *m_ObjectsCovMatrix;
00243 VDVector *m_ObjectsMean;
00244
00245 VDVector *m_ObjectsMaxDiff;
00246 FloatType *m_ObjectsMap;
00247 ListType *m_ObjectsSeed;
00248
00249 std::vector<float> m_HomogeneityMap;
00250 std::vector<float> m_ScaleMap;
00251 std::vector<char> m_ScaleArray;
00252 std::vector<double> m_Material;
00253
00254 typename InputImageType::ConstPointer m_InputImage;
00255 typename InputImageType::Pointer m_FilterImage;
00256 typename UShortImage::Pointer m_ObjectFuzzyScene;
00257 typename UShortImage::Pointer m_BackgroundFuzzyScene;
00258 typename OutputImageType::Pointer m_SegmentObject;
00259
00260 std::vector<unsigned short> m_Xaffinity;
00261 std::vector<unsigned short> m_Yaffinity;
00262 std::vector<unsigned short> m_Zaffinity;
00263
00264 void ScalePrepare();
00265 void Compute_LookupTable();
00266 void Compute_Scale();
00267 void Compute_Filter();
00268 void Compute_Affinity();
00269 void FastTracking(int);
00270
00271 private:
00272 VectorFuzzyConnectednessImageFilter(const Self&);
00273 void operator=(const Self&);
00274 };
00275
00276
00277 }
00278
00279 #ifndef ITK_MANUAL_INSTANTIATION
00280 #include "itkVectorFuzzyConnectednessImageFilter.txx"
00281 #endif
00282
00283 #endif