18 #ifndef itkMRFImageFilter_h
19 #define itkMRFImageFilter_h
21 #include "vnl/vnl_vector.h"
22 #include "vnl/vnl_matrix.h"
31 #include "ITKMarkovRandomFieldsClassifiersExport.h"
55 extern ITKMarkovRandomFieldsClassifiers_EXPORT std::ostream &
148 template <
typename TInputImage,
typename TClassifiedImage>
160 using typename Superclass::OutputImagePointer;
184 static constexpr
unsigned int InputImageDimension = TInputImage::ImageDimension;
215 static constexpr
unsigned int ClassifiedImageDimension = TClassifiedImage::ImageDimension;
253 itkSetMacro(NumberOfClasses,
unsigned int);
254 itkGetConstMacro(NumberOfClasses,
unsigned int);
259 itkSetMacro(MaximumNumberOfIterations,
unsigned int);
260 itkGetConstMacro(MaximumNumberOfIterations,
unsigned int);
265 itkSetMacro(ErrorTolerance,
double);
266 itkGetConstMacro(ErrorTolerance,
double);
271 itkSetMacro(SmoothingFactor,
double);
272 itkGetConstMacro(SmoothingFactor,
double);
295 for (
int i = 0; i < InputImageDimension; ++i)
297 radius[i] = m_InputImageNeighborhoodRadius[i];
308 SetMRFNeighborhoodWeight(std::vector<double> betaMatrix);
310 virtual std::vector<double>
313 return m_MRFNeighborhoodWeight;
317 #if !defined(ITK_LEGACY_REMOVE)
321 static constexpr
MRFStopEnum MaximumNumberOfIterations = MRFStopEnum::MaximumNumberOfIterations;
322 static constexpr
MRFStopEnum ErrorTolerance = MRFStopEnum::ErrorTolerance;
330 itkGetConstReferenceMacro(NumberOfIterations,
unsigned int);
332 #ifdef ITK_USE_CONCEPT_CHECKING
348 PrintSelf(std::ostream & os,
Indent indent)
const override;
359 ApplyMRFImageFilter();
363 MinimizeFunctional();
381 GenerateData()
override;
384 GenerateInputRequestedRegion()
override;
387 EnlargeOutputRequestedRegion(
DataObject *)
override;
390 GenerateOutputInformation()
override;
407 unsigned int m_NumberOfClasses{ 0 };
408 unsigned int m_MaximumNumberOfIterations{ 50 };
409 unsigned int m_KernelSize{};
411 int m_ErrorCounter{ 0 };
412 int m_NeighborhoodSize{ 27 };
413 int m_TotalNumberOfValidPixelsInOutputImage{ 1 };
414 int m_TotalNumberOfPixelsInInputImage{ 1 };
415 double m_ErrorTolerance{ 0.2 };
416 double m_SmoothingFactor{ 1 };
417 double * m_ClassProbability{
nullptr };
418 unsigned int m_NumberOfIterations{ 0 };
419 MRFStopEnum m_StopCondition{ MRFStopEnum::MaximumNumberOfIterations };
423 std::vector<double> m_MRFNeighborhoodWeight{};
424 std::vector<double> m_NeighborInfluence{};
425 std::vector<double> m_MahalanobisDistance{};
426 std::vector<double> m_DummyVector{};
435 SetDefaultMRFNeighborhoodWeight();
443 #ifndef ITK_MANUAL_INSTANTIATION
444 # include "itkMRFImageFilter.hxx"