Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
SFLSRobustStatSegmentor3DLabelMap_single.h
Go to the documentation of this file.
1 #ifndef SFLSRobustStatSegmentor3DLabelMap_single_h_
2 #define SFLSRobustStatSegmentor3DLabelMap_single_h_
3 
4 #include "SFLSSegmentor3D.h"
5 
6 #include <list>
7 #include <vector>
8 
9 // #include "boost/shared_ptr.hpp"
10 
11 template <typename TPixel>
13 {
14  /*----------------------------------------------------------------------
15  just copy, not logic change */
16 public:
18 
20  // typedef boost::shared_ptr< Self > Pointer;
21 
24 
25  /*================================================================================
26  ctor */
28  {
29  basicInit();
30  }
31 
32  /* New */
33  // static Pointer New() { return Pointer(new Self); }
34 
35  void basicInit();
36 
37  /* just copy, not logic change
38  ----------------------------------------------------------------------
39  ----------------------------------------------------------------------
40  ----------------------------------------------------------------------
41  ---------------------------------------------------------------------- */
42 
44  typedef typename TLabelImage::Pointer TLabelImagePointer;
45 
47  typedef typename TFloatImage::Pointer TFloatImagePointer;
48 
49  // typedef typename SuperClassType::TDoubleImage TDoubleImage;
50  // typedef typename TDoubleImage::Pointer TDoubleImagePointer;
51 
53 
54  typedef typename SuperClassType::TIndex TIndex;
55  typedef typename SuperClassType::TSize TSize;
56  typedef typename SuperClassType::TRegion TRegion;
57 
58  /* ============================================================
59  * functions
60  * ============================================================*/
61 
62  void setInputLabelImage(TLabelImagePointer l);
63 
64  void doSegmenation();
65 
66  void computeForce();
67 
68  void setKernelWidthFactor(double f);
69 
70  void setIntensityHomogeneity(double h);
71 
72 protected:
73  /* data */
74  TLabelImagePointer m_inputLabelImage;
75  std::vector<std::vector<long> > m_seeds; // in IJK
76 
77  std::vector<std::vector<double> > m_featureAtTheSeeds;
78 
82 
83  const static long m_numberOfFeature = 3;
84  /* Store the robust stat as the feature at each point
85  0: Meadian
86  1: interquartile range (IRQ)
87  2. median absolute deviation (MAD)
88  */
89  TLabelImagePointer m_featureComputed; // if feature at this point is computed, then is 1
90  std::vector<TFloatImagePointer> m_featureImageList;
91 
92  double m_kernelWidthFactor; // kernel_width = empirical_std/m_kernelWidthFactor, Eric has it at 10.0
93 
94  /* fn */
96 
97  void initFeatureImage();
98 
99  // void computeFeature();
100  void computeFeatureAt(TIndex idx, std::vector<double>& f);
101 
102  void getRobustStatistics(std::vector<double>& samples, std::vector<double>& robustStat);
103 
104  void inputLableImageToSeeds();
105 
106  void seedToMask();
107 
108  void dialteSeeds();
109 
110  void getFeatureAroundSeeds();
111 
112  void estimateFeatureStdDevs();
113 
116  void computeMinMax();
117 
118  std::vector<std::vector<double> > m_PDFlearnedFromSeeds; // each feature corresponds to a inner std::vector<double>
119  void estimatePDFs();
120 
121  // void getFeatureAt(TDoubleImage::IndexType idx, std::vector<double>& f);
122 
123  void getThingsReady();
124 
125  // kernel
126  std::vector<double> m_kernelStddev;
127  double kernelEvaluation(const std::vector<double>& newFeature);
128 
129  double kernelEvaluationUsingPDF(const std::vector<double>& newFeature);
130 
131 };
132 
133 #include "SFLSRobustStatSegmentor3DLabelMap_single.txx"
134 
135 #endif
void setInputLabelImage(TLabelImagePointer l)
TImage::SizeType TSize
TUCharImage MaskImageType
TImage::IndexType TIndex
SuperClassType::CSFLSLayer CSFLSLayer
std::vector< std::vector< double > > m_featureAtTheSeeds
std::vector< std::vector< double > > m_PDFlearnedFromSeeds
void computeFeatureAt(TIndex idx, std::vector< double > &f)
itk::Image< short, 3 > TShortImage
double kernelEvaluation(const std::vector< double > &newFeature)
double kernelEvaluationUsingPDF(const std::vector< double > &newFeature)
SuperClassType::NodeType NodeType
itk::Image< float, 3 > TFloatImage
void getRobustStatistics(std::vector< double > &samples, std::vector< double > &robustStat)
CSFLSRobustStatSegmentor3DLabelMap< TPixel > Self
TImage::RegionType TRegion