diff --git a/Code/SpatialReasoning/otbImageToImageRCC8Calculator.h b/Code/SpatialReasoning/otbImageToImageRCC8Calculator.h index f264c273b04f6ba00bd5a84c60a79e2a636a1dd3..bed884b7719b45d64fe50d93b53fa95e54025a21 100644 --- a/Code/SpatialReasoning/otbImageToImageRCC8Calculator.h +++ b/Code/SpatialReasoning/otbImageToImageRCC8Calculator.h @@ -98,12 +98,12 @@ public: * \return The second input image. */ ImageType * GetInput2(void); - /** Set/Get the inside value of the regions */ - itkSetMacro(InsideValue,PixelType); - itkGetMacro(InsideValue,PixelType); - /** Set/Get the outside value of the regions */ - itkSetMacro(OutsideValue,PixelType); - itkGetMacro(OutsideValue,PixelType); + /** Set/Get the inside value of the region of image 1*/ + itkSetMacro(InsideValue1,PixelType); + itkGetMacro(InsideValue1,PixelType); + /** Set/Get the inside value of the region of image 2*/ + itkSetMacro(InsideValue2,PixelType); + itkGetMacro(InsideValue2,PixelType); protected: /** Constructor */ @@ -164,9 +164,10 @@ public: * Compute a bool image of minimal ROI size, surrounded by a false padding, and corresponding * to the input image. * \param image The image to convert. + * \param insideValue The inside value. * \return The converted image */ - BoolImagePointerType ConvertToBoolImage(ImagePointerType image); + BoolImagePointerType ConvertToBoolImage(ImagePointerType image, PixelType insideValue); /** Main computation method */ void GenerateData(void); /** PrintSelf method */ @@ -181,10 +182,10 @@ public: bool m_Level1APrioriKnowledge; /** Decision tree Level 3 A priori knowledge */ bool m_Level3APrioriKnowledge; - /** Inside value */ - PixelType m_InsideValue; - /** Outside value */ - PixelType m_OutsideValue; + /** Inside value 1 */ + PixelType m_InsideValue1; + /** Inside value 2 */ + PixelType m_InsideValue2; /** Internal bool image representation*/ BoolImagePointerType m_BoolImage1; BoolImagePointerType m_BoolImage2; diff --git a/Code/SpatialReasoning/otbImageToImageRCC8Calculator.txx b/Code/SpatialReasoning/otbImageToImageRCC8Calculator.txx index 1abe83089c6cb215bd2179d1f0296bd26ca768a2..3fcb6deadeb54598e809e1535f2f84b9ec59e2d2 100644 --- a/Code/SpatialReasoning/otbImageToImageRCC8Calculator.txx +++ b/Code/SpatialReasoning/otbImageToImageRCC8Calculator.txx @@ -39,8 +39,8 @@ namespace otb ::ImageToImageRCC8Calculator() { m_Value = OTB_RCC8_DC; - m_InsideValue = static_cast<PixelType>(255); - m_OutsideValue = static_cast<PixelType>(0); + m_InsideValue1 = static_cast<PixelType>(255); + m_InsideValue2 = static_cast<PixelType>(255); m_Level1APrioriKnowledge=false; m_Level3APrioriKnowledge=false; this->SetNumberOfRequiredInputs(2); @@ -121,13 +121,13 @@ namespace otb typename RegionCalculator::Pointer rc =RegionCalculator::New(); rc->SetInput(image1); rc->SetPad(2); - rc->SetInsideValue(this->GetInsideValue()); + rc->SetInsideValue(this->GetInsideValue1()); rc->Update(); region1=rc->GetRegion(); rc=RegionCalculator::New(); rc->SetInput(image2); rc->SetPad(2); - rc->SetInsideValue(this->GetInsideValue()); + rc->SetInsideValue(this->GetInsideValue2()); rc->Update(); region2=rc->GetRegion(); typename ImageType::SizeType size; @@ -149,13 +149,14 @@ namespace otb * Compute a bool image of minimal ROI size, surrounded by a false padding, and corresponding * to the input image. * \param image The image to convert. + * \param insideValue The inside value. * \return The converted image */ - template<class TInputImage> +template<class TInputImage> typename ImageToImageRCC8Calculator<TInputImage> ::BoolImagePointerType ImageToImageRCC8Calculator<TInputImage> -::ConvertToBoolImage(ImagePointerType image) +::ConvertToBoolImage(ImagePointerType image, PixelType insideValue) { typedef itk::ImageRegionConstIterator<ImageType> ConstIterator; typedef itk::ImageRegionIterator<BoolImageType> Iterator; @@ -179,7 +180,7 @@ ImageToImageRCC8Calculator<TInputImage> outputIt.GoToBegin(); while(!inputIt.IsAtEnd()&&!outputIt.IsAtEnd()) { - outputIt.Set(inputIt.Get()==m_InsideValue); + outputIt.Set(inputIt.Get()==insideValue); ++inputIt; ++outputIt; } @@ -399,8 +400,8 @@ ImageToImageRCC8Calculator<TInputImage> { /// else each input images is cast to boolean type and reduced to // the minimal region - m_BoolImage1=ConvertToBoolImage(this->GetInput1()); - m_BoolImage2=ConvertToBoolImage(this->GetInput2()); + m_BoolImage1=ConvertToBoolImage(this->GetInput1(),m_InsideValue1); + m_BoolImage2=ConvertToBoolImage(this->GetInput2(),m_InsideValue2); // otbMsgDebugMacro(<<"RCC8Calculator->GenerateData(): Bool images computed: "<<m_BoolImage1->GetLargestPossibleRegion().GetSize()); /// Then the boolean which will be used to determine the relation /// are declared