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

DOC: Enhancing application documentation

parent 76e7f0ac
Branches
Tags
No related merge requests found
......@@ -128,45 +128,48 @@ private:
void DoInit()
{
SetName("Segmentation");
SetDescription("Performs Large scale segmentation");
SetDescription("Performs segmentation of an image, with an optional large scale mode to handle large images.");
// Documentation
SetDocName("Large Scale segmentation");
SetDocLongDescription("This application is dedicated to image segmentation. "
"By handling streaming and OGR framework, it has been optimized for processing large scale data."
"Numerous segmentations algorithms are available."
"The application stream a large image, and for each stream:"
"apply a segmentation algorithm, "
"vectorize the results in polygons and keep-it "
"This application allows to correct some errors due to streaming by stitching polygons."
);
SetDocLimitations(" .");
SetDocName("Segmentation");
SetDocLongDescription("This application allows to perform various segmentation algorithm on an multispectral image. "
"Available segmentation algorithms are two different version of Mean-Shift segmentation algorithm (one beeing multi-threaded),"
" simple pixel based connected components according to a user-defined criterion, and watershed from the gradient of the intensity "
"(norm of spectral bands vector). The application has two different modes that affects the nature of its output.\n\nIn normal mode,"
" the output of the application is a classical image of unique labels identifying the segmented regions. The labeled output can be passed to the "
" ColorMapping application to render regions with contrasted colors. Please note that this mode loads the whole input image into memory, and as such "
" can not handle large images. \n\nTo segment large data, one can use the largescale mode. In this case, the output of the application is a "
" vector file or database. The input image is splitted into tiles (whose size can be set using the tilesize parameter), and each tile is loaded, segmented "
" with the chosen algorithm, vectorized, and writen into the output file or database. This piece-wise behaviour ensure that memory will never get overloaded, "
" and that images of any size can be processed. There are few more options in the largescale mode. The simplify option allows to simplify the geometry "
" (i.e. remove nodes in polygons) according to a user-defined tolerance. The stitch option allows to application to try to stitch together polygons corresponding "
" to segmented region that may have been splitted by the tiling scheme. ");
SetDocLimitations("In normal mode, the application can not handle large input images. Stiching step of largescale mode might become slow with very large input images.");
SetDocAuthors("OTB-Team");
SetDocSeeAlso("MeanShiftSegmentation");
AddDocTag(Tags::Segmentation);
AddParameter(ParameterType_InputImage, "in", "Input Image");
SetParameterDescription("in", "The input image.");
SetParameterDescription("in", "The input image to segment");
AddParameter(ParameterType_Choice, "filter", "Segmentation algorithm");
SetParameterDescription("filter", "Choose your segmentation method (threaded mean-shift by default).");
SetParameterDescription("filter", "Choice of segmentation algorithm (mean-shift by default)");
AddChoice("filter.meanshift", "Threaded mean-shift");
AddChoice("filter.meanshift", "Mean-Shift");
SetParameterDescription(
"filter.meanshift",
"Home-made threaded mean-shift filter.");
"filter.meanshift","OTB implementation of the Mean-Shift algorithm (multi-threaded).");
// MeanShift Parameters
AddParameter(ParameterType_Int, "filter.meanshift.spatialr", "Spatial radius");
SetParameterDescription("filter.meanshift.spatialr", "Spatial radius defining neighborhood.");
SetParameterDescription("filter.meanshift.spatialr", "Spatial radius of the neighborhood.");
AddParameter(ParameterType_Float, "filter.meanshift.ranger", "Range radius");
SetParameterDescription("filter.meanshift.ranger", "Range radius defining the interval in the color space.");
AddParameter(ParameterType_Float, "filter.meanshift.thres", "convergence threshold");
SetParameterDescription("filter.meanshift.thres", "convergence threshold. iterative scheme will stop if mean-shift "
"vector is below this threshold (1e-3 by default) or iteration number reached maximum iteration number.");
AddParameter(ParameterType_Int, "filter.meanshift.maxiter", "maximum iteration number");
SetParameterDescription("filter.meanshift.maxiter",
"iteration process is stopped if convergence hasn't been reached after this number of iteration (10 by default).");
SetParameterDescription("filter.meanshift.ranger", "Range radius defining the radius (expressed in radiometry unit) in the multi-spectral space.");
AddParameter(ParameterType_Float, "filter.meanshift.thres", "Mode convergence threshold");
SetParameterDescription("filter.meanshift.thres", "Algorithm iterative scheme will stop if mean-shift "
"vector is below this threshold or if iteration number reached maximum number of iterations.");
AddParameter(ParameterType_Int, "filter.meanshift.maxiter", "Maximum number of iterations");
SetParameterDescription("filter.meanshift.maxiter", "Algorithm iterative scheme will stop if convergence hasn't been reached after the maximum number of iterations.");
//AddParameter(ParameterType_Empty, "filter.meanshift.useoptim", "use optimization");
//SetParameterDescription("filter.meanshift.useoptim", "Use mode optimization.");
......@@ -179,35 +182,34 @@ private:
SetDefaultParameterInt("filter.meanshift.maxiter", 100);
SetMinimumParameterIntValue("filter.meanshift.maxiter", 1);
AddChoice("filter.meanshiftedison", "EDISON mean-shift");
SetParameterDescription("filter.meanshiftedison",
"EDISON based Mean-shift filter. (is going to be replaced by new framework and will be deprecated).");
AddChoice("filter.edison", "Edison mean-shift");
SetParameterDescription("filter.edison",
"Edison implementation of mean-shift algorithm, by its authors.");
// EDISON Meanshift Parameters
AddParameter(ParameterType_Int, "filter.meanshiftedison.spatialr", "Spatial radius");
SetParameterDescription("filter.meanshiftedison.spatialr", "Spatial radius defining neighborhood.");
AddParameter(ParameterType_Float, "filter.meanshiftedison.ranger", "Range radius");
SetParameterDescription("filter.meanshiftedison.ranger", "Range radius defining the interval in the color space.");
AddParameter(ParameterType_Int, "filter.meanshiftedison.minsize", "Min region size");
SetParameterDescription("filter.meanshiftedison.minsize", "Minimun size of a region to be kept after clustering.");
AddParameter(ParameterType_Float, "filter.meanshiftedison.scale", "Scale");
SetParameterDescription("filter.meanshiftedison.scale", "Scale to stretch the image before processing.");
SetDefaultParameterInt("filter.meanshiftedison.spatialr", 5);
SetDefaultParameterFloat("filter.meanshiftedison.ranger", 15.0);
SetDefaultParameterInt("filter.meanshiftedison.minsize", 100);
SetDefaultParameterFloat("filter.meanshiftedison.scale", 100000.);
AddParameter(ParameterType_Int, "filter.edison.spatialr", "Spatial radius");
SetParameterDescription("filter.edison.spatialr", "Spatial radius defining neighborhood.");
AddParameter(ParameterType_Float, "filter.edison.ranger", "Range radius");
SetParameterDescription("filter.edison.ranger", "Range radius defining the radius (expressed in radiometry unit) in the multi-spectral space.");
AddParameter(ParameterType_Int, "filter.edison.minsize", "Mininum region size");
SetParameterDescription("filter.edison.minsize", "Minimun size of a region in segmentation. Smaller clusters will be merged to the neighbouring cluster with the closest radiometry.");
AddParameter(ParameterType_Float, "filter.edison.scale", "Scale factor");
SetParameterDescription("filter.edison.scale", "Scaling of the image before processing. This is useful for images with narrow decimal ranges (like [0,1] for instance). ");
SetDefaultParameterInt("filter.edison.spatialr", 5);
SetDefaultParameterFloat("filter.edison.ranger", 15.0);
SetDefaultParameterInt("filter.edison.minsize", 100);
SetDefaultParameterFloat("filter.edison.scale", 1.);
//Connected component segmentation parameters
AddChoice("filter.connectedcomponent", "Connected component Segmentation");
SetParameterDescription("filter.connectedcomponent", "Connected component segmentation based on mathematical condition.");
AddChoice("filter.cc", "Connected components");
SetParameterDescription("filter.cc", "Simple pixel-based connected-components algorithm with a user-defined connection condition.");
AddParameter(ParameterType_String, "filter.connectedcomponent.expr", "Condition");
SetParameterDescription("filter.connectedcomponent.expr", "User defined criteria based on mathematical condition used for connected component segmentation.");
MandatoryOff("filter.connectedcomponent.expr");
AddParameter(ParameterType_String, "filter.cc.expr", "Condition");
SetParameterDescription("filter.cc.expr", "User defined connection condition, written as a mathematical expression. Available variables are p(i)b(i), intensity_p(i) and distance (example of expression : distance < 10 )");
// Watershed
AddChoice("filter.watershed","Watershed segmentation");
SetParameterDescription("filter.watershed","The traditionnal watershed algorithm. The height function is the gradient magnitude of the amplitude (square root of the sum of squared bands)");
AddChoice("filter.watershed","Watershed");
SetParameterDescription("filter.watershed","The traditional watershed algorithm. The height function is the gradient magnitude of the amplitude (square root of the sum of squared bands).");
AddParameter(ParameterType_Float,"filter.watershed.threshold","Depth Threshold");
SetParameterDescription("filter.watershed.threshold","Depth threshold Units in percentage of the maximum depth in the image.");
......@@ -221,81 +223,85 @@ private:
SetMinimumParameterFloatValue("filter.watershed.level",0);
SetMaximumParameterFloatValue("filter.watershed.level",1);
AddParameter(ParameterType_Choice, "mode", "Segmentation mode (large scale or normal");
SetParameterDescription("mode", "Choose your segmentation mode (large scalse with vector output or label image.");
AddParameter(ParameterType_Choice, "mode", "Processing mode");
SetParameterDescription("mode", "Choice of processing mode, either normal or large-scale.");
AddChoice("mode.largescale", "vector data output");
SetParameterDescription("mode.largescale","Large scale segmentation paradigm.");
AddChoice("mode.largescale", "Tile-based large-scale segmentation with vector output");
SetParameterDescription("mode.largescale","In this mode, the application will output a vector file or database, and process the input image piecewise. This allows to perform segmentation of very large images.");
AddChoice("mode.normal", "label image output");
SetParameterDescription("mode.normal","Classic segmentation paradigm.");
AddChoice("mode.normal", "Standard segmentation with labeled raster output");
SetParameterDescription("mode.normal","In this mode, the application will output a standard labeled raster. This mode can not handle large data.");
//Normal mode parameters
AddParameter(ParameterType_OutputImage, "mode.normal.lout", "Label output");
SetParameterDescription( "mode.normal.lout", "The label output image.");
AddParameter(ParameterType_OutputImage, "mode.normal.lout", "Output labeled image");
SetParameterDescription( "mode.normal.lout", "The output labeled image.");
//Streaming vectorization parameters
AddParameter(ParameterType_OutputFilename, "mode.largescale.outvd", "Output vector data");
SetParameterDescription("mode.largescale.outvd", "The name of segmentation output. Vector Data (polygons).");
MandatoryOff("mode.largescale.outvd");
AddParameter(ParameterType_OutputFilename, "mode.largescale.outvd", "Output vector file");
SetParameterDescription("mode.largescale.outvd", "The output vector file or database (name can be anything understood by OGR)");
AddParameter(ParameterType_InputImage, "mode.largescale.inmask", "Mask Image");
SetParameterDescription("mode.largescale.inmask", "Mask image. (Pixel with 0 will not be processed).");
SetParameterDescription("mode.largescale.inmask", "Only pixels whose mask value is strictly positive will be segmented.");
MandatoryOff("mode.largescale.inmask");
AddParameter(ParameterType_Empty, "mode.largescale.neighbor", "8-neighbor vect. strategy");
AddParameter(ParameterType_Empty, "mode.largescale.neighbor", "8-neighbor connectivity");
SetParameterDescription("mode.largescale.neighbor",
"Pixel neighborhood vectorization strategy. 4 or 8 neighborhood .(4 neighborhood by default.)");
"Activate 8-Neighbourhood connectivity (default is 4).");
MandatoryOff("mode.largescale.neighbor");
EnableParameter("mode.largescale.neighbor");
AddParameter(ParameterType_Empty,"mode.largescale.stitch","Stitch polygons");
SetParameterDescription("mode.largescale.stitch", "Scan segments on each side of tiles and append polygons which have almost one picel in common.");
SetParameterDescription("mode.largescale.stitch", "Scan polygons on each side of tiles and stitch polygons which connect by more than one pixel.");
MandatoryOff("mode.largescale.stitch");
EnableParameter("mode.largescale.stitch");
AddParameter(ParameterType_Int, "mode.largescale.minsize", "Minimum object size");
SetParameterDescription("mode.largescale.minsize",
"Object with size under this threshold(area in pixels) will be replaced by the background value.");
"Objects whose size is below the minimum object size (area in pixels) will be ignored during vectorization.");
SetDefaultParameterInt("mode.largescale.minsize", 1);
SetMinimumParameterIntValue("mode.largescale.minsize", 1);
MandatoryOff("mode.largescale.minsize");
DisableParameter("mode.largescale.minsize");
AddParameter(ParameterType_Float, "mode.largescale.simplify", "Simplify geometry");
AddParameter(ParameterType_Float, "mode.largescale.simplify", "Simplify polygons");
SetParameterDescription("mode.largescale.simplify",
"Simplify polygons according to a given tolerance (in pixel?).");
"Simplify polygons according to a given tolerance (in pixel). This option allows to reduce the size of the output file or database.");
SetDefaultParameterFloat("mode.largescale.simplify",0.1);
MandatoryOff("mode.largescale.simplify");
DisableParameter("mode.largescale.simplify");
AddParameter(ParameterType_String, "mode.largescale.layername", "Layer name");
SetParameterDescription("mode.largescale.layername", "Layer Name.(by default : Layer )");
SetParameterDescription("mode.largescale.layername", "Name of the layer in the vector file or database (default is Layer).");
SetParameterString("mode.largescale.layername", "layer");
MandatoryOff("mode.largescale.layername");
AddParameter(ParameterType_String, "mode.largescale.fieldname", "Field name");
SetParameterDescription("mode.largescale.fieldname", "field Name.(by default : DN )");
AddParameter(ParameterType_String, "mode.largescale.fieldname", "Geometry index field name");
SetParameterDescription("mode.largescale.fieldname", "Name of the field holding the geometry index in the output vector file or database.");
SetParameterString("mode.largescale.fieldname", "DN");
MandatoryOff("mode.largescale.fieldname");
AddParameter(ParameterType_Int, "mode.largescale.tilesize", "Tiles size");
SetParameterDescription("mode.largescale.tilesize",
"user defined streaming tiles size to compute segmentation.Automatic tile dimension is set "
" if tile size set to (0 by default)");
SetDefaultParameterInt("mode.largescale.tilesize", 0);
MandatoryOff("mode.largescale.tilesize");
EnableParameter("mode.largescale.tilesize");
AddParameter(ParameterType_Int, "mode.largescale.startlabel", "start label");
SetParameterDescription("mode.largescale.startlabel", "Start label (1 by default)");
"User defined tiles size for tile-based segmentation. Optimal tile size is selected according to available RAM if null.");
SetDefaultParameterInt("mode.largescale.tilesize",1024);
SetMinimumParameterIntValue("mode.largescale.tilesize",0);
AddParameter(ParameterType_Int, "mode.largescale.startlabel", "Starting geometry index");
SetParameterDescription("mode.largescale.startlabel", "Starting value of the geometry index field");
SetDefaultParameterInt("mode.largescale.startlabel", 1);
MandatoryOff("mode.largescale.startlabel");
SetMinimumParameterIntValue("mode.largescale.startlabel", 1);
// Doc example parameter settings
SetExampleComment("Example of use with vector mode and watershed segmentation",0);
SetDocExampleParameterValue("in", "QB_Toulouse_Ortho_PAN.tif");
SetDocExampleParameterValue("outvd", "SegmentationVectorData.sqlite");
SetDocExampleParameterValue("filter", "meanshift");
SetDocExampleParameterValue("mode","largescale");
SetDocExampleParameterValue("mode.largescale.outvd", "SegmentationVectorData.sqlite");
SetDocExampleParameterValue("filter", "watershed");
AddExample("Example of use with raster mode and mean-shift segmentation");
SetDocExampleParameterValue("in", "QB_Toulouse_Ortho_PAN.tif",1);
SetDocExampleParameterValue("mode","normal",1);
SetDocExampleParameterValue("mode.normal.lout", "SegmentationVectorData.tif uint16",1);
SetDocExampleParameterValue("filter", "meanshift",1);
}
void DoUpdateParameters()
......@@ -419,7 +425,7 @@ private:
// The actual stream size used
FloatVectorImageType::SizeType streamSize;
if (segType == "connectedcomponent")
if (segType == "cc")
{
otbAppLogINFO(<<"Use connected component segmentation."<<std::endl);
ConnectedComponentStreamingVectorizedSegmentationOGRType::Pointer
......@@ -432,21 +438,21 @@ private:
ccVectorizationFilter->GetSegmentationFilter()->GetFunctor().SetExpression(
GetParameterString(
"filter.connectedcomponent.expr"));
"filter.cc.expr"));
streamSize = GenericApplySegmentation<FloatVectorImageType,ConnectedComponentSegmentationFilterType>(ccVectorizationFilter,this->GetParameterFloatVectorImage("in"),ogrDS, 0);
}
else if (segType == "meanshiftedison")
else if (segType == "edison")
{
otbAppLogINFO(<<"Use Edison Mean-shift segmentation."<<std::endl);
//segmentation parameters
const unsigned int
spatialRadius = static_cast<unsigned int> (this->GetParameterInt("filter.meanshiftedison.spatialr"));
spatialRadius = static_cast<unsigned int> (this->GetParameterInt("filter.edison.spatialr"));
const unsigned int
rangeRadius = static_cast<unsigned int> (this->GetParameterInt("filter.meanshiftedison.ranger"));
rangeRadius = static_cast<unsigned int> (this->GetParameterInt("filter.edison.ranger"));
const unsigned int
minimumObjectSize = static_cast<unsigned int> (this->GetParameterInt("filter.meanshiftedison.minsize"));
const float scale = this->GetParameterFloat("filter.meanshiftedison.scale");
minimumObjectSize = static_cast<unsigned int> (this->GetParameterInt("filter.edison.minsize"));
const float scale = this->GetParameterFloat("filter.edison.scale");
EdisontreamingVectorizedSegmentationOGRType::Pointer
edisonVectorizationFilter = EdisontreamingVectorizedSegmentationOGRType::New();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment