Commit 484b62a4 authored by Guillaume Pasero's avatar Guillaume Pasero

ENH: replace deprecated Edison meanshift in Examples

parent 5b035c87
......@@ -25,7 +25,7 @@
// Software Guide : BeginLatex
//
// This example shows the basic approach to perform object based analysis on a image.
// The input image is firstly segmented using the \doxygen{otb}{MeanShiftImageFilter}
// The input image is firstly segmented using the \doxygen{otb}{MeanShiftSegmentationFilter}
// Then each segmented region is converted to a Map of labeled objects.
// Afterwards the \doxygen{otb}{otbMultiChannelRAndNIRIndexImageFilter} computes
// radiometric attributes for each object. In this example the NDVI is computed.
......@@ -41,7 +41,7 @@
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
#include "otbMeanShiftVectorImageFilter.h"
#include "otbMeanShiftSegmentationFilter.h"
#include "itkLabelImageToLabelMapFilter.h"
#include "otbShapeAttributesLabelMapFilter.h"
#include "otbBandsStatisticsAttributesLabelMapFilter.h"
......@@ -137,13 +137,14 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::MeanShiftVectorImageFilter
<VectorImageType, VectorImageType, LabeledImageType> FilterType;
typedef otb::MeanShiftSegmentationFilter
<VectorImageType, LabeledImageType, VectorImageType> FilterType;
FilterType::Pointer filter = FilterType::New();
filter->SetSpatialRadius(spatialRadius);
filter->SetRangeRadius(rangeRadius);
filter->SetMinimumRegionSize(minRegionSize);
filter->SetScale(scale);
filter->SetSpatialBandwidth(spatialRadius);
filter->SetRangeBandwidth(rangeRadius);
filter->SetMinRegionSize(minRegionSize);
filter->SetThreshold(0.1);
filter->SetMaxIterationNumber(100);
// Software Guide : EndCodeSnippet
// For non regression tests, set the number of threads to 1
......@@ -152,7 +153,7 @@ int main(int argc, char * argv[])
// Software Guide : BeginLatex
//
// The \doxygen{otb}{MeanShiftImageFilter} type is instantiated using the image
// The \doxygen{otb}{MeanShiftSegmentationFilter} type is instantiated using the image
// types.
//
// Software Guide : EndLatex
......@@ -164,13 +165,13 @@ int main(int argc, char * argv[])
// Software Guide : BeginLatex
//
// The \doxygen{itk}{LabelImageToLabelMapFilter} type is instantiated using the output
// of the \doxygen{otb}{MeanShiftImageFilter}. This filter produces a labeled image
// of the \doxygen{otb}{MeanShiftSegmentationFilter}. This filter produces a labeled image
// where each segmented region has a unique label.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
LabelMapFilterType::Pointer labelMapFilter = LabelMapFilterType::New();
labelMapFilter->SetInput(filter->GetLabeledClusteredOutput());
labelMapFilter->SetInput(filter->GetLabelOutput());
labelMapFilter->SetBackgroundValue(itk::NumericTraits<LabelType>::min());
ShapeLabelMapFilterType::Pointer shapeLabelMapFilter =
......
......@@ -25,7 +25,7 @@
// The following example illustrates how to segment very large images
// using the \doxygen{otb}{StreamingImageToOGRLayerSegmentationFilter}. This filter is
// templated over the segmentation filter that will be used to segment each tile
// of the input image. In this example we will use the \doxygen{otb}{MeanShiftVectorImageFilter}.
// of the input image. In this example we will use the \doxygen{otb}{MeanShiftSegmentationFilter}.
// The labeled output image of each tile is then vectorized (using a filter based on GDALPolygonize)
// and stored into a \doxygen{otb}{ogr}{Layer} within the \doxygen{otb}{ogr}{DataSource}
// set as input. Finally a fusion filter, \doxygen{otb}{OGRLayerStreamStitchingFilter}, is used to merge polygons
......@@ -39,7 +39,7 @@
// Software Guide : BeginCodeSnippet
#include "otbStreamingImageToOGRLayerSegmentationFilter.h"
#include "otbOGRLayerStreamStitchingFilter.h"
#include "otbMeanShiftVectorImageFilter.h"
#include "otbMeanShiftSegmentationFilter.h"
// Software Guide : EndCodeSnippet
#include "otbVectorImage.h"
......@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
// Software Guide : BeginCodeSnippet
//typedef otb::MeanShiftSmoothingImageFilter<ImageType, ImageType> MeanShiftImageFilterType;
typedef otb::MeanShiftVectorImageFilter <ImageType, ImageType, LabelImageType> SegmentationFilterType;
typedef otb::MeanShiftSegmentationFilter <ImageType, LabelImageType, ImageType> SegmentationFilterType;
typedef otb::StreamingImageToOGRLayerSegmentationFilter<ImageType, SegmentationFilterType> StreamingVectorizedSegmentationType;
// Software Guide : EndCodeSnippet
......@@ -174,15 +174,17 @@ int main(int argc, char *argv[])
// Software Guide : BeginLatex
//
// Now we set the parameters to the segmentation filter.The \doxygen{otb}{MeanShiftVectorImageFilter}
// required three parameters, the spatial radius, the range radius and the minimum object size.
// Now we set the parameters to the segmentation filter.The \doxygen{otb}{MeanShiftSegmentationFilter}
// has three main parameters, the spatial radius, the range radius and the minimum object size.
// We use the \code{GetSegmentationFilter()} method on the \doxygen{otb}{StreamingVectorizedSegmentation}
// to get a pointer to the segmentation filter.
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
filter->GetSegmentationFilter()->SetSpatialRadius(spatialRadius);
filter->GetSegmentationFilter()->SetRangeRadius(rangeRadius);
filter->GetSegmentationFilter()->SetMinimumRegionSize(minimumObjectSize);
filter->GetSegmentationFilter()->SetSpatialBandwidth(spatialRadius);
filter->GetSegmentationFilter()->SetRangeBandwidth(rangeRadius);
filter->GetSegmentationFilter()->SetMinRegionSize(minimumObjectSize);
filter->GetSegmentationFilter()->SetThreshold(0.1);
filter->GetSegmentationFilter()->SetMaxIterationNumber(100);
// Software Guide : EndCodeSnippet
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment