Skip to content
Snippets Groups Projects
Commit b5de303e authored by Cédric Traizet's avatar Cédric Traizet
Browse files

Merge branch '1860_multiband_watershed_crash' into 'develop'

No data documentation in Segmentation

See merge request orfeotoolbox/otb!440
parents 64148d77 bddb1079
No related branches found
No related tags found
No related merge requests found
......@@ -43,6 +43,7 @@
//Utils
#include "itksys/SystemTools.hxx"
#include "otbNoDataHelper.h"
namespace otb
{
......@@ -165,10 +166,11 @@ private:
SetDocLimitations("In raster mode, the application can not handle large input images. Stitching step of vector mode might become slow with very large input images."
" \nMeanShift filter results depends on the number of threads used. \nWatershed and multiscale geodesic morphology segmentation will be performed on the amplitude "
" of the input image.");
" of the input image. \nThis application does not handle no data values. No data pixels will be treated as regular pixels,"
" This may lead to unexpected segmentation results and crashes.");
SetDocAuthors("OTB-Team");
SetDocSeeAlso("MeanShiftSegmentation");
SetDocSeeAlso("LargeScaleMeanShift");
AddDocTag(Tags::Segmentation);
......@@ -375,7 +377,7 @@ private:
if (segModeType == "vector" && HasValue("mode.vector.inmask"))
{
streamingVectorizedFilter->SetInputMask(m_ClampFilter->GetOutput());
otbAppLogINFO(<<"Use a mask as input." << std::endl);
otbAppLogINFO("Use a mask as input.");
}
streamingVectorizedFilter->SetOGRLayer(layer);
......@@ -390,13 +392,13 @@ private:
if (use8connected)
{
otbAppLogINFO(<<"Use 8 connected neighborhood."<<std::endl);
otbAppLogINFO("Use 8 connected neighborhood.");
}
streamingVectorizedFilter->SetUse8Connected(use8connected);
if (minSize > 1)
{
otbAppLogINFO(<<"Object with size under "<< minSize <<" will be suppressed."<<std::endl);
otbAppLogINFO(<<"Object with size under "<< minSize <<" will be suppressed.");
streamingVectorizedFilter->SetFilterSmallObject(true);
streamingVectorizedFilter->SetMinimumObjectSize(minSize);
}
......@@ -413,7 +415,7 @@ private:
{
streamingVectorizedFilter->SetSimplify(true);
streamingVectorizedFilter->SetSimplificationTolerance(GetParameterFloat("mode.vector.simplify"));
otbAppLogINFO(<<"Simplify the geometry." << std::endl);
otbAppLogINFO("Simplify the geometry.");
}
else
{
......@@ -422,7 +424,7 @@ private:
if (segModeType == "vector")
{
otbAppLogINFO(<<"Large scale segmentation mode which output vector data" << std::endl);
otbAppLogINFO("Large scale segmentation mode which output vector data");
DisableParameter("mode.raster.out");
EnableParameter("mode.vector.out");
......@@ -436,7 +438,7 @@ private:
}
else if (segModeType == "raster")
{
otbAppLogINFO(<<"Segmentation mode which output label image" << std::endl);
otbAppLogINFO("Segmentation mode which output label image.");
DisableParameter("mode.vector.out");
EnableParameter("mode.raster.out");
......@@ -467,6 +469,17 @@ private:
std::string projRef = GetParameterFloatVectorImage("in")->GetProjectionRef();
std::vector<bool> noDataFlags;
std::vector<double> noDataValues;
itk::MetaDataDictionary &dict = GetParameterFloatVectorImage("in")->GetMetaDataDictionary();
bool ret = otb::ReadNoDataFlags(dict,noDataFlags,noDataValues);
if (ret)
{
otbAppLogWARNING("The input image has no data values but this application does not handle no-data. No-data pixels"
" will be treated as regular pixels.");
}
OGRSpatialReference oSRS(projRef.c_str());
if (segModeType == "vector")
......@@ -562,7 +575,7 @@ private:
if (segType == "cc")
{
otbAppLogINFO(<<"Use connected component segmentation."<<std::endl);
otbAppLogINFO("Use connected component segmentation.");
ConnectedComponentStreamingVectorizedSegmentationOGRType::Pointer
ccVectorizationFilter = ConnectedComponentStreamingVectorizedSegmentationOGRType::New();
......@@ -581,7 +594,7 @@ private:
}
else if (segType == "meanshift")
{
otbAppLogINFO(<<"Use threaded Mean-shift segmentation."<<std::endl);
otbAppLogINFO("Use threaded Mean-shift segmentation.");
MeanShiftVectorizedSegmentationOGRType::Pointer
meanShiftVectorizationFilter = MeanShiftVectorizedSegmentationOGRType::New();
......@@ -611,7 +624,7 @@ private:
}
else if (segType == "watershed")
{
otbAppLogINFO(<<"Using watershed segmentation."<<std::endl);
otbAppLogINFO("Using watershed segmentation.");
AmplitudeFilterType::Pointer amplitudeFilter = AmplitudeFilterType::New();
......@@ -635,7 +648,7 @@ private:
}
else if (segType == "mprofiles")
{
otbAppLogINFO(<<"Using multiscale geodesic morphology segmentation."<<std::endl);
otbAppLogINFO("Using multiscale geodesic morphology segmentation.");
unsigned int profileSize = GetParameterInt("filter.mprofiles.size");
unsigned int initialValue = GetParameterInt("filter.mprofiles.start");
......@@ -661,7 +674,7 @@ private:
}
else
{
otbAppLogFATAL(<<"non defined filtering method "<<GetParameterInt("filter")<<std::endl);
otbAppLogFATAL(<<"non defined filtering method "<<GetParameterInt("filter"));
}
if (segModeType == "vector")
......@@ -692,7 +705,7 @@ private:
std::string driverName(ogrDS->ogr().GetDriverName());
if ( driverName.find("ESRI Shapefile") != std::string::npos)
{
otbAppLogINFO(<<"REPACK the Shapefile ..."<<std::endl);
otbAppLogINFO("REPACK the Shapefile ...");
//In Shapefile format, the name of the DaaSource is also the name of the Layer.
std::string shpLayerName = itksys::SystemTools::GetFilenameWithoutExtension(GetParameterString("mode.vector.out"));
std::string repack("REPACK ");
......
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