3 #include <itkImageToImageFilter.h> 4 #include <itkImageRegionIterator.h> 5 #include <itkImageRegionConstIterator.h> 6 #include <itkCommand.h> 7 #include <itkCSVArray2DFileReader.h> 8 #include <itkCSVNumericObjectFileWriter.h> 9 #include <itkRescaleIntensityImageFilter.h> 10 #include <itkGaussianMembershipFunction.h> 25 template <
typename TInputImage,
typename TMaskImage,
typename TAtlasImage = TInputImage>
27 public itk::ProcessObject
60 typedef typename itk::RescaleIntensityImageFilter<TInputImage,ImageTypeUC>
RescaleFilterType;
73 void SetMask(const TMaskImage* mask);
86 std::vector<GaussianFunctionType::Pointer>
GetGaussianModel() {
return m_GaussianModel;}
87 void SetGaussianModel(std::vector<GaussianFunctionType::Pointer> model) {m_GaussianModel = model;}
90 void SetAlphas(std::vector<double> alpha) {m_Alphas = alpha;}
92 virtual void Update() ITK_OVERRIDE;
95 int PrintSolution(std::vector<double> alphas, std::vector<GaussianFunctionType::Pointer> model);
99 static void eventCallback (itk::Object* caller,
const itk::EventObject& event,
void* clientData)
101 itk::ProcessObject * processObject = (itk::ProcessObject*) caller;
102 std::cout<<
"\033[K\rProgression: "<<(int)(processObject->GetProgress() * 100)<<
"%"<<std::flush;
105 itkSetMacro(InitMethodType,
unsigned int)
106 itkGetMacro(InitMethodType,
unsigned int)
108 itkSetMacro(RejRatioHierar,
double)
109 itkGetMacro(RejRatioHierar,
double)
111 itkSetMacro(MinDistance,
double)
112 itkGetMacro(MinDistance,
double)
114 itkSetMacro(EmIter,
int)
115 itkGetMacro(EmIter,
int)
117 itkSetMacro(RejRatio,
double)
118 itkGetMacro(RejRatio,
double)
120 itkSetMacro(EmIter_concentration,
int)
121 itkGetMacro(EmIter_concentration,
int)
123 itkSetMacro(EM_before_concentration,
bool)
124 itkGetMacro(EM_before_concentration,
bool)
126 itkSetMacro(UseT2,
bool)
127 itkGetMacro(UseT2,
bool)
129 itkSetMacro(UseDP,
bool)
130 itkGetMacro(UseDP,
bool)
132 itkSetMacro(UseFLAIR,
bool)
133 itkGetMacro(UseFLAIR,
bool)
135 itkSetMacro(Verbose,
bool)
136 itkGetMacro(Verbose,
bool)
138 itkSetMacro(Tol,
double)
139 itkGetMacro(Tol,
double)
144 this->SetNumberOfRequiredInputs(4);
146 m_InitMethodType = 2;
149 m_EmIter_concentration=100;
150 m_MinDistance=0.0001;
152 m_RejRatioHierar=0.01;
158 m_SolutionSet =
false;
164 this->SetNumberOfWorkUnits(itk::MultiThreaderBase::GetGlobalDefaultNumberOfThreads());
175 typename MaskImageType::ConstPointer
GetMask();
191 unsigned int m_InitMethodType;
192 double m_RejRatioHierar;
193 double m_MinDistance;
196 int m_EmIter_concentration;
197 bool m_EM_before_concentration;
201 std::vector<GaussianFunctionType::Pointer> m_GaussianModel;
202 std::vector<double> m_Alphas;
203 std::string m_SolutionReadFilename;
204 std::string m_SolutionWriteFilename;
206 unsigned int m_NbTissus;
207 unsigned int m_NbModalities;
itk::RescaleIntensityImageFilter< TInputImage, ImageTypeUC > RescaleFilterType
Gaussian Model estimator Class performing expectation-maximation algorithm.
void SetGaussianModel(std::vector< GaussianFunctionType::Pointer > model)
void SetInputImage2(const InputImageType *image)
itk::SmartPointer< const Self > ConstPointer
static void eventCallback(itk::Object *caller, const itk::EventObject &event, void *clientData)
virtual void Update() ITK_OVERRIDE
itk::Statistics::GaussianMembershipFunction< MeasurementVectorType > GaussianFunctionType
Class performing a robust expectation-maximation (REM) algorithm. Allow finding the 3-classes NABT mo...
unsigned char PixelTypeUC
Class computing the 3-class GMM respresenting the NABT, where each Gaussian represents one of the bra...
InputImageType::ConstPointer GetInputImage2()
void SetMask(const TMaskImage *mask)
InputImageType::ConstPointer GetInputImage3()
TAtlasImage::ConstPointer GetInputWMAtlas()
void SetInputGMAtlas(const TAtlasImage *atlas)
itk::ImageRegionConstIterator< InputImageType > InputConstIteratorType
TAtlasImage::ConstPointer GetInputCSFAtlas()
TAtlasImage::ConstPointer GetInputGMAtlas()
InputImageType::ConstPointer InputImageConstPointer
ImageTypeUC::Pointer ImagePointerUC
void SetSolutionReadFilename(std::string filename)
std::vector< double > GetAlphas()
Class initializing a gaussian mixture with hierarchical information It uses 'a priori' knowledge of t...
int ReadSolution(std::string filename)
itk::Image< PixelTypeUC, 3 > ImageTypeUC
std::vector< GaussianFunctionType::Pointer > GetGaussianModel()
itk::SmartPointer< Self > Pointer
MaskImageType::ConstPointer GetMask()
virtual ~ComputeSolution()
int WriteSolution(std::string filename)
void SetAlphas(std::vector< double > alpha)
void SetInputWMAtlas(const TAtlasImage *atlas)
int PrintSolution(std::vector< double > alphas, std::vector< GaussianFunctionType::Pointer > model)
itk::VariableLengthVector< NumericType > MeasurementVectorType
void SetInputImage1(const InputImageType *image)
TInputImage InputImageType
void SetInputImage3(const InputImageType *image)
itk::ProcessObject Superclass
void SetSolutionWriteFilename(std::string filename)
void SetInputCSFAtlas(const TAtlasImage *atlas)
InputImageType::ConstPointer GetInputImage1()