From a991e3592d671ecfd9b3b1ed4ed2b0995e8e8663 Mon Sep 17 00:00:00 2001 From: Manuel Grizonnet <manuel.grizonnet@gmail.com> Date: Fri, 22 Jan 2010 00:58:07 +0100 Subject: [PATCH] BUG:correct channel setter in otbradiometricattributeslabelmapfilter --- ...otbRadiometricAttributesLabelMapFilter.txx | 24 +++++++++---------- Examples/OBIA/CMakeLists.txt | 6 ++--- ...ometricAttributesLabelMapFilterExample.cxx | 12 ++++------ 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/Code/Common/otbRadiometricAttributesLabelMapFilter.txx b/Code/Common/otbRadiometricAttributesLabelMapFilter.txx index 2e224b12c4..1014ae35e5 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 d92b0ad0c3..7c7bbdffe4 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 67e5faf117..5dc1964cb8 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 -- GitLab