21 #ifndef otbMarkovRandomFieldFilter_h
22 #define otbMarkovRandomFieldFilter_h
26 #include "vnl/vnl_vector.h"
27 #include "vnl/vnl_matrix.h"
28 #include "itkMersenneTwisterRandomVariateGenerator.h"
30 #include "itkImageToImageFilter.h"
31 #include "itkImageRegionIterator.h"
33 #include "itkNeighborhoodAlgorithm.h"
34 #include "itkNeighborhood.h"
85 template <
class TInputImage,
class TClassifiedImage>
91 typedef itk::ImageToImageFilter<TInputImage, TClassifiedImage>
Superclass;
118 itkStaticConstMacro(InputImageDimension,
unsigned int, TInputImage::ImageDimension);
153 itkStaticConstMacro(ClassifiedImageDimension,
unsigned int, TClassifiedImage::ImageDimension);
216 itkSetMacro(NumberOfClasses,
unsigned int);
217 itkGetMacro(NumberOfClasses,
unsigned int);
222 itkSetMacro(MaximumNumberOfIterations,
unsigned int);
223 itkGetMacro(MaximumNumberOfIterations,
unsigned int);
228 itkSetMacro(ErrorTolerance,
double);
229 itkGetMacro(ErrorTolerance,
double);
234 itkSetMacro(SmoothingFactor,
double);
235 itkGetMacro(SmoothingFactor,
double);
240 itkSetMacro(Lambda,
double);
241 itkGetMacro(Lambda,
double);
250 void SetNeighborhoodRadius(
const unsigned long);
251 void SetNeighborhoodRadius(
const unsigned long* radiusArray);
258 for (
int i = 0; i < InputImageDimension; ++i)
259 neighborhoodRadius[i] = m_InputImageNeighborhoodRadius[i];
261 return neighborhoodRadius;
271 virtual void SetTrainingInput(
const TrainingImageType* trainingImage);
272 const TrainingImageType* GetTrainingInput(
void);
276 typedef enum { MaximumNumberOfIterations = 1, ErrorTolerance } StopConditionType;
280 itkGetConstReferenceMacro(StopCondition, StopConditionType);
283 itkGetConstReferenceMacro(NumberOfIterations,
unsigned int);
285 #ifdef ITK_USE_CONCEPT_CHECKING
287 itkConceptMacro(UnsignedIntConvertibleToClassifiedCheck, (itk::Concept::Convertible<unsigned int, LabelledImagePixelType>));
288 itkConceptMacro(ClassifiedConvertibleToUnsignedIntCheck, (itk::Concept::Convertible<LabelledImagePixelType, unsigned int>));
289 itkConceptMacro(ClassifiedConvertibleToIntCheck, (itk::Concept::Convertible<LabelledImagePixelType, int>));
290 itkConceptMacro(IntConvertibleToClassifiedCheck, (itk::Concept::Convertible<int, LabelledImagePixelType>));
291 itkConceptMacro(SameDimensionCheck, (itk::Concept::SameDimension<InputImageDimension, ClassifiedImageDimension>));
299 m_Generator->SetSeed(seed);
303 m_Generator->SetSeed();
312 void PrintSelf(std::ostream& os, itk::Indent indent)
const override;
324 virtual void ApplyMarkovRandomFieldFilter();
326 void GenerateData()
override;
327 void GenerateInputRequestedRegion()
override;
328 void EnlargeOutputRequestedRegion(itk::DataObject*)
override;
329 void GenerateOutputInformation()
override;
332 void operator=(
const Self&) =
delete;
372 virtual void MinimizeOnce();
379 #ifndef OTB_MANUAL_INSTANTIATION