diff --git a/Code/Markov/otbMarkovRandomFieldFilter.h b/Code/Markov/otbMarkovRandomFieldFilter.h index b1d5266191495a90675a0d2d25108e5e49d74ee8..cb0369c1d59e75916d273ad7bdb784170fbf97f3 100644 --- a/Code/Markov/otbMarkovRandomFieldFilter.h +++ b/Code/Markov/otbMarkovRandomFieldFilter.h @@ -108,6 +108,9 @@ public itk::ImageToImageFilter<TInputImage,TClassifiedImage> /** Type definition for the input image region iterator */ typedef itk::ImageRegionIterator<TClassifiedImage> LabelledImageRegionIterator; + + typedef itk::ImageRegionConstIterator<TClassifiedImage> + LabelledImageRegionConstIterator; /** Labelled Image dimension */ itkStaticConstMacro(ClassifiedImageDimension, unsigned int, diff --git a/Code/Markov/otbMarkovRandomFieldFilter.txx b/Code/Markov/otbMarkovRandomFieldFilter.txx index 4c721697a810633c5c5afd442a3eef44397f6e78..e8251e3c4ca1c889505b0c9e41aa288eab7f103e 100644 --- a/Code/Markov/otbMarkovRandomFieldFilter.txx +++ b/Code/Markov/otbMarkovRandomFieldFilter.txx @@ -295,8 +295,8 @@ MarkovRandomFieldFilter<TInputImage, TClassifiedImage> if (m_ExternalClassificationSet) { - TrainingImagePointer trainingImage = this->GetTrainingInput(); - LabelledImageRegionIterator + typename TrainingImageType::ConstPointer trainingImage = this->GetTrainingInput(); + LabelledImageRegionConstIterator trainingImageIt( trainingImage, outputPtr->GetRequestedRegion() ); while ( !outImageIt.IsAtEnd() )