Skip to content
Snippets Groups Projects
Commit d6f9e6b3 authored by Julien Michel's avatar Julien Michel
Browse files

- Modification de la classe ImageToImageRCC8Calculator pour intégrer le...

- Modification de la classe ImageToImageRCC8Calculator pour intégrer le support de 2 m_InsideValue différents (1 pour chaque image en entrée).
parent 960d1369
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment