10 #include <itkMaximumImageFilter.h> 11 #include <itkMinimumImageFilter.h> 12 #include <itkRelabelComponentImageFilter.h> 13 #include <itkRescaleIntensityImageFilter.h> 14 #include <itkImageToImageFilter.h> 15 #include <itkBinaryThresholdImageFilter.h> 16 #include <itkIntensityWindowingImageFilter.h> 17 #include <itkMaskImageFilter.h> 70 template <
typename TInputImage>
72 public itk::ImageToImageFilter< TInputImage, itk::Image <unsigned char, 3> >
78 typedef itk::ImageToImageFilter< TInputImage, TOutputImage >
Superclass;
160 void SetMask(const TInputImage* MaskImage);
186 this->SetCoordinateTolerance(tol);
187 this->SetDirectionTolerance(tol);
194 itkSetMacro(InitMethodType,
unsigned int)
195 itkGetMacro(InitMethodType,
unsigned int)
197 itkSetMacro(RejRatioHierar,
double)
198 itkGetMacro(RejRatioHierar,
double)
200 itkSetMacro(MinDistance,
double)
201 itkGetMacro(MinDistance,
double)
203 itkSetMacro(EmIter,
int)
204 itkGetMacro(EmIter,
int)
206 itkSetMacro(RejRatio,
double)
207 itkGetMacro(RejRatio,
double)
209 itkSetMacro(EmIter_concentration,
int)
210 itkGetMacro(EmIter_concentration,
int)
212 itkSetMacro(EM_before_concentration,
bool)
213 itkGetMacro(EM_before_concentration,
bool)
215 itkSetMacro(MahalanobisThCSF,
double)
216 itkGetMacro(MahalanobisThCSF,
double)
218 itkSetMacro(MahalanobisThGM,
double)
219 itkGetMacro(MahalanobisThGM,
double)
221 itkSetMacro(MahalanobisThWM,
double)
222 itkGetMacro(MahalanobisThWM,
double)
224 itkSetMacro(FuzzyRuleMin,
double)
225 itkGetMacro(FuzzyRuleMin,
double)
227 itkSetMacro(FuzzyRuleMax,
double)
228 itkGetMacro(FuzzyRuleMax,
double)
230 itkSetMacro(UseT2,
bool)
231 itkGetMacro(UseT2,
bool)
233 itkSetMacro(UseDP,
bool)
234 itkGetMacro(UseDP,
bool)
236 itkSetMacro(UseFLAIR,
bool)
237 itkGetMacro(UseFLAIR,
bool)
239 itkSetMacro(Alpha,
double)
240 itkGetMacro(Alpha,
double)
242 itkSetMacro(MultiVarSources,
double)
243 itkGetMacro(MultiVarSources,
double)
245 itkSetMacro(MultiVarSinks,
double)
246 itkGetMacro(MultiVarSinks,
double)
248 itkSetMacro(LesionPriorProportion,
double)
249 itkGetMacro(LesionPriorProportion,
double)
251 itkSetMacro(Sigma,
double)
252 itkGetMacro(Sigma,
double)
254 itkSetMacro(UseSpecGrad,
bool)
255 itkGetMacro(UseSpecGrad,
bool)
257 itkSetMacro(MinLesionsSize,
double)
258 itkGetMacro(MinLesionsSize,
double)
260 itkSetMacro(RemoveBorder,
bool)
261 itkGetMacro(RemoveBorder,
bool)
263 itkSetMacro(IntensityT2Factor,
double)
264 itkGetMacro(IntensityT2Factor,
double)
266 itkSetMacro(IntensityDPFactor,
double)
267 itkGetMacro(IntensityDPFactor,
double)
269 itkSetMacro(IntensityFLAIRFactor,
double)
270 itkGetMacro(IntensityFLAIRFactor,
double)
272 itkSetMacro(RatioContourWM,
double)
273 itkGetMacro(RatioContourWM,
double)
275 itkSetMacro(Verbose,
bool)
276 itkGetMacro(Verbose,
bool)
278 itkSetMacro(ThresoldWMmap,
double)
279 itkGetMacro(ThresoldWMmap,
double)
338 void SetGaussianModel(std::vector<GaussianFunctionType::Pointer> solution) {m_GaussianModel=solution;}
339 std::vector<GaussianFunctionType::Pointer>
GetSolution() {
return m_GaussianModel;}
356 this->SetNumberOfRequiredOutputs(18);
357 this->SetNumberOfRequiredInputs(1);
371 this->SetNthOutput( 10, this->
MakeOutput(10) );
372 this->SetNthOutput( 11, this->
MakeOutput(11) );
373 this->SetNthOutput( 12, this->
MakeOutput(12) );
374 this->SetNthOutput( 13, this->
MakeOutput(13) );
375 this->SetNthOutput( 14, this->
MakeOutput(14) );
377 this->SetNthOutput( 15, this->
MakeOutput(15) );
378 this->SetNthOutput( 16, this->
MakeOutput(16) );
379 this->SetNthOutput( 17, this->
MakeOutput(17) );
383 m_FilterMaxSources = MaximumFilterType::New();
384 m_FilterMaxSinks = MaximumFilterType::New();
387 m_InitMethodType = 1;
388 m_RejRatioHierar = 0.01;
391 m_MinDistance = 0.0001;
394 m_EmIter_concentration = 100;
395 m_EM_before_concentration =
false;
397 m_MahalanobisThCSF = 0.5;
398 m_MahalanobisThGM = 0.5;
399 m_MahalanobisThWM = 0.5;
405 m_UseSpecGrad =
true;
407 m_MultiVarSources = 1;
409 m_LesionPriorProportion = 0.23;
411 m_MinLesionsSize = 0;
412 m_RemoveBorder =
false;
413 m_IntensityT2Factor = 0;
414 m_IntensityDPFactor = 0;
415 m_IntensityFLAIRFactor = 0;
416 m_RatioContourWM = 0;
431 m_MaxNumberOfInputs = 14;
433 m_LesionSegmentationType =
strem;
435 m_ThresoldWMmap = 0.2;
436 m_IndexWMinModel = 2;
440 m_IndexImageT1 = m_MaxNumberOfInputs;
441 m_IndexImageT2 = m_MaxNumberOfInputs;
442 m_IndexImageDP = m_MaxNumberOfInputs;
443 m_IndexImageFLAIR = m_MaxNumberOfInputs;
444 m_IndexImageT1Gd = m_MaxNumberOfInputs;
446 m_IndexMask = m_MaxNumberOfInputs;
447 m_IndexAtlasCSF = m_MaxNumberOfInputs;
448 m_IndexAtlasGM = m_MaxNumberOfInputs;
449 m_IndexAtlasWM = m_MaxNumberOfInputs;
450 m_IndexLesionPrior = m_MaxNumberOfInputs;
451 m_IndexSourcesProba = m_MaxNumberOfInputs;
452 m_IndexSinksProba = m_MaxNumberOfInputs;
453 m_IndexSourcesMask = m_MaxNumberOfInputs;
454 m_IndexSinksMask = m_MaxNumberOfInputs;
456 this->SetNumberOfWorkUnits(itk::MultiThreaderBase::GetGlobalDefaultNumberOfThreads());
464 itk::DataObject::Pointer
MakeOutput(
unsigned int idx);
472 typename InputImageType::ConstPointer
GetMask();
484 static void ManageProgress( itk::Object* caller,
const itk::EventObject& event,
void* clientData );
495 unsigned char m_LabelLesions;
496 unsigned char m_LabelCSF;
497 unsigned char m_LabelGM;
498 unsigned char m_LabelWM;
500 unsigned int m_NbInputs, m_MaxNumberOfInputs, m_Modalities;
502 unsigned int m_IndexImageT1, m_IndexImageT2, m_IndexImageDP, m_IndexImageFLAIR, m_IndexImageT1Gd, m_IndexMask;
503 unsigned int m_IndexAtlasCSF, m_IndexAtlasGM, m_IndexAtlasWM, m_IndexLesionPrior;
504 unsigned int m_IndexSourcesProba, m_IndexSinksProba, m_IndexSourcesMask, m_IndexSinksMask;
515 unsigned int m_InitMethodType;
516 double m_RejRatioHierar;
519 double m_MinDistance;
522 int m_EmIter_concentration;
523 bool m_EM_before_concentration;
525 double m_MahalanobisThCSF;
526 double m_MahalanobisThGM;
527 double m_MahalanobisThWM;
529 double m_FuzzyRuleMin;
530 double m_FuzzyRuleMax;
532 std::vector<double> m_Alphas;
533 std::vector<GaussianFunctionType::Pointer> m_GaussianModel;
540 std::vector<double> m_Matrix;
541 std::string m_MatrixGradFilename;
543 double m_MultiVarSources;
544 double m_MultiVarSinks;
545 double m_LesionPriorProportion;
550 double m_MinLesionsSize;
553 double m_IntensityT2Factor;
554 double m_IntensityDPFactor;
555 double m_IntensityFLAIRFactor;
557 double m_HyperIntensityThreshold1;
558 double m_HyperIntensityThreshold2;
559 unsigned int m_IndexWMinModel;
561 double m_RatioContourWM;
562 double m_ThresoldWMmap;
567 std::string m_SolutionReadFilename;
568 std::string m_SolutionWriteFilename;
570 std::string m_OutputLesionFilename;
571 std::string m_OutputCSFFilename;
572 std::string m_OutputGMFilename;
573 std::string m_OutputWMFilename;
574 std::string m_OutputWholeFilename;
576 std::string m_OutputGCFilename;
577 std::string m_OutputStremFilename;
578 std::string m_OutputStremCSFFilename;
579 std::string m_OutputStremGMFilename;
580 std::string m_OutputStremWMFilename;
582 std::string m_OutputFuzzyObjectFilename;
584 std::string m_OutputMahaCSFFilename;
585 std::string m_OutputMahaGMFilename;
586 std::string m_OutputMahaWMFilename;
587 std::string m_OutputMahaMaximumFilename;
588 std::string m_OutputMahaMinimumFilename;
590 std::string m_OutputIntensityImage1Filename;
591 std::string m_OutputIntensityImage2Filename;
593 ImageTypeUC::Pointer m_InputImage_T1_UC;
594 ImageTypeUC::Pointer m_InputImage_1_UC;
595 ImageTypeUC::Pointer m_InputImage_2_UC;
596 ImageTypeUC::Pointer m_MaskUC;
597 ImageTypeUC::Pointer m_LesionsDetectionImage;
598 ImageTypeInt::Pointer m_LabeledLesions;
599 ImageTypeD::Pointer m_FuzzyObject;
void SetSolutionWriteFilename(std::string fn)
itk::BinaryThresholdImageFilter< ImageTypeD, ImageTypeUC > BinaryThresholdImageFilterType_F_UC
std::string GetOutputMahaWMFilename()
void ApplyHeuristicRules()
Class removing lesions that are not sufficiently in the white matter. Intensity rules may not be enou...
std::string GetOutputMahaMaximumFilename()
std::string GetMatrixGradFilename()
itk::ImageRegionConstIterator< ImageTypeUC > ImageIteratorTypeConstUC
ImageTypeD::ConstPointer GetInputLesionPrior()
itk::BinaryThresholdImageFilter< ImageTypeUC, ImageTypeUC > BinaryThresholdImageFilterType_UC_UC
TOutputImage * GetOutputIntensityImage2()
Class selecting the connected components touching a given mask border. In MRI, external CSF may conta...
void SetOutputStremCSFFilename(std::string fn)
GcStremMsLesionsSegmentationFilter()
itk::DataObject::Pointer MakeOutput(unsigned int idx)
void SetInputImageT1(const InputImageType *image)
OutputImageType::Pointer OutputImagePointer
void SetOutputStremWMFilename(std::string fn)
TOutputImage * GetOutputLesions()
void SetOutputMahaGMFilename(std::string fn)
void SetMatrixGradFilename(std::string fn)
TOutputImage * GetOutputStremGM()
void SetMask(const TInputImage *MaskImage)
itk::MaskImageFilter< ImageTypeD, ImageTypeUC > MaskFilterType_F_UC
TOutputImage * GetOutputIntensityImage1()
void SetInputImageFLAIR(const InputImageType *image)
std::string GetOutputWMFilename()
Class computing the 3-class GMM respresenting the NABT, where each Gaussian represents one of the bra...
void SetOutputWMFilename(std::string fn)
void SetOutputCSFFilename(std::string fn)
std::string GetOutputGCFilename()
OutputImageType::PixelType OutputPixelType
void SetTol(const double tol)
void SetInputCSFAtlas(const ImageTypeD *image)
itk::Statistics::GaussianMembershipFunction< MeasurementVectorType > GaussianFunctionType
TOutputImage * GetOutputGraphCut()
Class computing the probability maps that are used to create the t-links.
void SetOutputLesionFilename(std::string fn)
void SetOutputStremFilename(std::string fn)
itk::Image< PixelTypeD, 3 > ImageTypeD
std::string GetOutputMahaMinimumFilename()
InputImageType::ConstPointer GetInputImageT1Gd()
std::string GetOutputStremWMFilename()
Compute the mahalanobis images from the NABT model.
itk::MinimumImageFilter< ImageTypeUC, ImageTypeUC, ImageTypeUC > MinimumFilterTypeUC
GraphCutFilterType::Pointer m_GraphCutFilter
void GenerateData() ITK_OVERRIDE
itk::RescaleIntensityImageFilter< TInputImage, ImageTypeUC > RescaleFilterType
void SetInputWMAtlas(const ImageTypeD *image)
itk::SmartPointer< Self > Pointer
std::vector< GaussianFunctionType::Pointer > GetSolution()
itk::VariableLengthVector< double > MeasurementVectorType
itk::ImageRegionIterator< OutputImageType > OutputIteratorType
TOutputImage * GetOutputGM()
void SetSourcesMask(const ImageTypeUC *MaskImage)
itk::Image< PixelTypeUC, 3 > ImageTypeUC
void SetInputLesionPrior(const ImageTypeD *image)
std::string GetOutputIntensityImage1Filename()
TOutputImage * GetOutputWM()
void ComputeAutomaticInitialization()
TOutputImage OutputImageType
void SetOutputGCFilename(std::string fn)
void SetOutputIntensityImage1Filename(std::string fn)
std::string GetOutputCSFFilename()
void SetOutputMahaWMFilename(std::string fn)
itk::ImageRegionIterator< ImageTypeUC > ImageIteratorTypeUC
std::string GetOutputMahaCSFFilename()
InputImageType::ConstPointer GetMask()
void SetOutputMahaMinimumFilename(std::string fn)
itk::SmartPointer< Self > Pointer
itk::ImageRegionIterator< ImageTypeInt > ImageIteratorTypeInt
itk::Image< double, 3 > * GetOutputMahaGMImage()
InputImageType::ConstPointer GetInputImageDP()
TOutputImage * GetOutputStremCSF()
void SetOutputMahaCSFFilename(std::string fn)
std::string GetOutputMahaGMFilename()
std::string GetOutputStremCSFFilename()
std::string GetOutputLesionFile()
std::string GetOutputGMFilename()
itk::MinimumImageFilter< ImageTypeD, ImageTypeD, ImageTypeD > MinimumFilterTypeF
itk::IntensityWindowingImageFilter< ImageTypeUC, ImageTypeD > IntensityWindowingImageFilterType
ComputeMahalanobisImagesFilterType::Pointer m_MahalanobisFilter
itk::ImageRegionConstIterator< InputImageType > ImageIteratorTypeConstInput
ImageTypeD::ConstPointer GetInputCSFAtlas()
itk::SmartPointer< Self > Pointer
InputImageType::ConstPointer GetInputImageT1()
void SetOutputWholeFilename(std::string fn)
void SetInputGMAtlas(const ImageTypeD *image)
static void ManageProgress(itk::Object *caller, const itk::EventObject &event, void *clientData)
InputImageType::ConstPointer GetInputImageFLAIR()
void SetGaussianModel(std::vector< GaussianFunctionType::Pointer > solution)
itk::Image< double, 3 > * GetOutputMahaMaximumImage()
itk::Image< double, 3 > * GetOutputFuzzyObjectImage()
unsigned char PixelTypeUC
void SetOutputIntensityImage2Filename(std::string fn)
itk::MaximumImageFilter< ImageTypeD, ImageTypeD, ImageTypeD > MaximumFilterType
void EmitProgress(int prog)
MaximumFilterType::Pointer m_FilterMaxSinks
void SetOutputMahaMaximumFilename(std::string fn)
void SetOutputGMFilename(std::string fn)
itk::Image< double, 3 > * GetOutputMahaCSFImage()
itk::SmartPointer< Self > Pointer
itk::Image< PixelTypeInt, 3 > ImageTypeInt
~GcStremMsLesionsSegmentationFilter()
ImageTypeUC::ConstPointer GetSinksMask()
InputImageType::ConstPointer GetInputImageT2()
itk::Image< double, 3 > * GetOutputMahaMinimumImage()
void CreateFuzzyRuleImage()
TInputImage InputImageType
void SetOutputFuzzyObjectFilename(std::string fn)
GcStremMsLesionsSegmentationFilter Self
TOutputImage * GetOutputStremWM()
std::string GetFuzzyOutputObjectFilename()
void SetOutputStremGMFilename(std::string fn)
LesionSegmentationType GetLesionSegmentationType()
std::string GetOutputIntensityImage2Filename()
itk::MaskImageFilter< ImageTypeUC, ImageTypeUC > MaskFilterType_UC_UC
Class performing lesion segmentation.
ImageTypeD::ConstPointer GetInputGMAtlas()
std::string GetOutputStremGMFilename()
itk::RelabelComponentImageFilter< ImageTypeInt, ImageTypeInt > RelabelComponentType
MaximumFilterType::Pointer m_FilterMaxSources
void SetInputImageT2(const InputImageType *image)
void SetInputImageDP(const InputImageType *image)
TLinksFilterType::Pointer m_TLinksFilter
void SetInputImageT1Gd(const InputImageType *image)
itk::SmartPointer< const Self > ConstPointer
TOutputImage * GetOutputWholeSeg()
void SetSolutionReadFilename(std::string fn)
TOutputImage * GetOutputStrem()
itk::ConnectedComponentImageFilter< ImageTypeUC, ImageTypeInt > ConnectedComponentType
itk::Image< double, 3 > * GetOutputMahaWMImage()
Class performing grah cut segmentation. First the sources and sinks probabilities maps are computed u...
itk::ImageRegionIterator< ImageTypeD > ImageIteratorTypeD
void SetSinksMask(const ImageTypeUC *MaskImage)
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
void SetLesionSegmentationType(LesionSegmentationType type)
std::string GetOutputWholeFilename()
itk::Image< unsigned char, 3 > TOutputImage
TOutputImage * GetOutputCSF()
ImageTypeUC::ConstPointer GetSourcesMask()
std::string GetOutputStremFilename()
ImageTypeD::ConstPointer GetInputWMAtlas()