Skip to content
Snippets Groups Projects
Commit 1acca180 authored by Manuel Grizonnet's avatar Manuel Grizonnet
Browse files

DOC:obia

parent a1a6bf5c
No related branches found
No related tags found
No related merge requests found
......@@ -26,7 +26,7 @@
// This example shows the basic approch to perform object based analysis on a image.
// The input image is firstly segmented using the \doxygen{otb}{MeanShiftImageFilter}
// Then each segmented region is converted to a Map of labeled objects.
// After the \doxygen{otb}{RadiometricAttributesLabelMapFilter} computes computes
// After the \doxygen{otb}{RadiometricAttributesLabelMapFilter} computes
// radiometric attributes for each object.
// Images are supposed to be standard 4-bands image (B,G,R,NIR). The
// index of each channel can be set via the Set***ChannelIndex()
......@@ -129,11 +129,12 @@ int main(int argc, char * argv[])
// types.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
filter->SetInput(reader->GetOutput());
// Software Guide : EndCodeSnippet
LabelMapFilterType::Pointer labelMapFilter = LabelMapFilterType::New();
labelMapFilter->SetInput(filter->GetLabeledClusteredOutput());
labelMapFilter->SetBackgroundValue(itk::NumericTraits<LabelType>::max());
labelMapFilter->SetBackgroundValue(itk::NumericTraits<LabelType>::min());
ShapeLabelMapFilterType::Pointer shapeLabelMapFilter = ShapeLabelMapFilterType::New();
shapeLabelMapFilter->SetInput(labelMapFilter->GetOutput());
......@@ -143,28 +144,62 @@ int main(int argc, char * argv[])
statisticsLabelMapFilter->SetInput2(reader->GetOutput());
statisticsLabelMapFilter->Update();
// Software Guide : BeginLatex
//
// Instantiate the \doxygen{otb}{RadiometricAttributesLabelMapFilter} to
// compute radiometric value on each label object.
//
// Software Guide : EndLatex
RadiometricLabelMapFilterType::Pointer radiometricLabelMapFilter = RadiometricLabelMapFilterType::New();
radiometricLabelMapFilter->SetInput1(statisticsLabelMapFilter->GetOutput());
radiometricLabelMapFilter->SetInput2(vreader->GetOutput());
// Software Guide : BeginLatex
//
// Then, we specify the red and the near infrared channels
//
//
// Software Guide : EndLatex
radiometricLabelMapFilter->SetRedChannelIndex(2);
radiometricLabelMapFilter->SetNIRChannelIndex(3);
radiometricLabelMapFilter->Update();
// Software Guide : BeginLatex
//
// The \doxygen{otb}{AttributesMapOpeningLabelMapFilter} will proceed the selection.
// There are three parameters. \code{AttributeName} specifies the radiometric attribute, \code{Lambda}
// controls the thresholding of the input and \code{ReverseOrdering} make this filter to remove the
// object with an attribute value greater than \code{Lambda} instead.
//
//
// Software Guide : EndLatex
OpeningLabelMapFilterType::Pointer opening = OpeningLabelMapFilterType::New();
opening->SetInput(radiometricLabelMapFilter->GetOutput());
opening->SetAttributeName(attr);
opening->SetReverseOrdering(lowerThan);
opening->SetLambda(thresh);
opening->SetReverseOrdering(lowerThan);
// Software Guide : BeginLatex
//
// Then, Label object selected are transform in a Label Image using the \doxygen{itk}{LabelMapToLabelImageFilter}
//
//
// Software Guide : EndLatex
LabelMapToLabeledImageFilterType::Pointer labelMap2LabeledImage = LabelMapToLabeledImageFilterType::New();
labelMap2LabeledImage->SetInput(opening->GetOutput());
// Software Guide : BeginLatex
//
// And finally, we declare the writer and call its \code{Update()} method to
// trigger the full pipeline execution.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
WriterType::Pointer writer = WriterType::New();
writer->SetFileName(outfname);
writer->SetInput(labelMap2LabeledImage->GetOutput());
writer->Update();
// Software Guide : EndCodeSnippet
return EXIT_SUCCESS;
}
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