diff --git a/Code/Common/otbRadiometricAttributesLabelMapFilter.txx b/Code/Common/otbRadiometricAttributesLabelMapFilter.txx index 2e224b12c47da5c52e34a387f3b858137361237c..1014ae35e5d5a2cb4d046bb17af3067e10254124 100755 --- a/Code/Common/otbRadiometricAttributesLabelMapFilter.txx +++ b/Code/Common/otbRadiometricAttributesLabelMapFilter.txx @@ -37,8 +37,8 @@ RadiometricAttributesLabelMapFilter<TImage, TFeatureImage> ::GenerateData() { GEMIFilterPointerType gemi = GEMIFilterType::New(); - gemi->SetRedIndex(m_RedChannelIndex); - gemi->SetNIRIndex(m_NIRChannelIndex); + gemi->SetRedIndex(m_RedChannelIndex+1); + gemi->SetNIRIndex(m_NIRChannelIndex+1); gemi->SetInput(this->GetFeatureImage()); StatisticsLabelMapFilterPointerType stats1 = StatisticsLabelMapFilterType::New(); @@ -48,8 +48,8 @@ RadiometricAttributesLabelMapFilter<TImage, TFeatureImage> stats1->SetReducedAttributeSet(m_ReducedAttributeSet); NDVIFilterPointerType ndvi = NDVIFilterType::New(); - ndvi->SetRedIndex(m_RedChannelIndex); - ndvi->SetNIRIndex(m_NIRChannelIndex); + ndvi->SetRedIndex(m_RedChannelIndex+1); + ndvi->SetNIRIndex(m_NIRChannelIndex+1); ndvi->SetInput(this->GetFeatureImage()); StatisticsLabelMapFilterPointerType stats2 = StatisticsLabelMapFilterType::New(); @@ -59,8 +59,8 @@ RadiometricAttributesLabelMapFilter<TImage, TFeatureImage> stats2->SetReducedAttributeSet(m_ReducedAttributeSet); IRFilterPointerType ir = IRFilterType::New(); - ir->SetGreenIndex(m_GreenChannelIndex); - ir->SetRedIndex(m_RedChannelIndex); + ir->SetGreenIndex(m_GreenChannelIndex+1); + ir->SetRedIndex(m_RedChannelIndex+1); ir->SetInput(this->GetFeatureImage()); StatisticsLabelMapFilterPointerType stats3 = StatisticsLabelMapFilterType::New(); @@ -70,8 +70,8 @@ RadiometricAttributesLabelMapFilter<TImage, TFeatureImage> stats3->SetReducedAttributeSet(m_ReducedAttributeSet); ICFilterPointerType ic = ICFilterType::New(); - ic->SetGreenIndex(m_GreenChannelIndex); - ic->SetRedIndex(m_RedChannelIndex); + ic->SetGreenIndex(m_GreenChannelIndex+1); + ic->SetRedIndex(m_RedChannelIndex+1); ic->SetInput(this->GetFeatureImage()); StatisticsLabelMapFilterPointerType stats4 = StatisticsLabelMapFilterType::New(); @@ -81,8 +81,8 @@ RadiometricAttributesLabelMapFilter<TImage, TFeatureImage> stats4->SetReducedAttributeSet(m_ReducedAttributeSet); IBFilterPointerType ib = IBFilterType::New(); - ib->SetGreenIndex(m_GreenChannelIndex); - ib->SetRedIndex(m_RedChannelIndex); + ib->SetGreenIndex(m_GreenChannelIndex+1); + ib->SetRedIndex(m_RedChannelIndex+1); ib->SetInput(this->GetFeatureImage()); StatisticsLabelMapFilterPointerType stats5 = StatisticsLabelMapFilterType::New(); @@ -92,8 +92,8 @@ RadiometricAttributesLabelMapFilter<TImage, TFeatureImage> stats5->SetReducedAttributeSet(m_ReducedAttributeSet); NDWI2FilterPointerType ndwi2 = NDWI2FilterType::New(); - ndwi2->GetFunctor().SetGIndex(m_GreenChannelIndex); - ndwi2->GetFunctor().SetNIRIndex(m_NIRChannelIndex); + ndwi2->GetFunctor().SetGIndex(m_GreenChannelIndex+1); + ndwi2->GetFunctor().SetNIRIndex(m_NIRChannelIndex+1); ndwi2->SetInput(this->GetFeatureImage()); StatisticsLabelMapFilterPointerType stats6 = StatisticsLabelMapFilterType::New(); diff --git a/Examples/OBIA/CMakeLists.txt b/Examples/OBIA/CMakeLists.txt index d92b0ad0c38b8d5108fb10bf4e049e13810bcbdc..7c7bbdffe4b9530131e6e44744e39d3daadf8bca 100755 --- a/Examples/OBIA/CMakeLists.txt +++ b/Examples/OBIA/CMakeLists.txt @@ -60,11 +60,11 @@ ADD_TEST(trTeOBIARadiometricAttributesLabelMapFilterTest ${EXE_TESTS} ${TEMP}/OBIARadiometricAttributes.tif ${TEMP}/qb_RoadExtract_Radiometry_pretty.png STATS::Ndvi::Mean - 1 - -0.3 + 0 + 0.5 16 16 - 10 + 50 1.0 ) diff --git a/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx b/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx index 67e5faf1176f10841359fb712b627add6bd0655b..5dc1964cb86531b2faffc90e99b7881623de78f8 100644 --- a/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx +++ b/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx @@ -19,7 +19,7 @@ // Software Guide : BeginCommandLineArgs // INPUTS: {qb_RoadExtract.tif} // OUTPUTS: {OBIARadiometricAttribute1.tif}, {qb_ExtractRoad_Radiometry_pretty.png} -// STATS::Ndvi::Mean 0 -0.3 16 16 10 1.0 +// STATS::Ndvi::Mean 0 0.5 16 16 50 1.0 // Software Guide : EndCommandLineArgs // Software Guide : BeginLatex @@ -166,12 +166,7 @@ int main(int argc, char * argv[]) ShapeLabelMapFilterType::Pointer shapeLabelMapFilter = ShapeLabelMapFilterType::New(); shapeLabelMapFilter->SetInput(labelMapFilter->GetOutput()); - - StatisticsLabelMapFilterType::Pointer statisticsLabelMapFilter = StatisticsLabelMapFilterType::New(); - statisticsLabelMapFilter->SetInput1(shapeLabelMapFilter->GetOutput()); - statisticsLabelMapFilter->SetInput2(reader->GetOutput()); - - statisticsLabelMapFilter->Update(); + // Software Guide : BeginLatex // // Instantiate the \doxygen{otb}{RadiometricAttributesLabelMapFilter} to @@ -182,7 +177,8 @@ int main(int argc, char * argv[]) // Software Guide : BeginCodeSnippet RadiometricLabelMapFilterType::Pointer radiometricLabelMapFilter = RadiometricLabelMapFilterType::New(); - radiometricLabelMapFilter->SetInput1(statisticsLabelMapFilter->GetOutput()); + + radiometricLabelMapFilter->SetInput1(shapeLabelMapFilter->GetOutput()); radiometricLabelMapFilter->SetInput2(vreader->GetOutput()); // Software Guide : EndCodeSnippet