From 6e5bcdc015f82f23148eb11b97b3620af43fb07e Mon Sep 17 00:00:00 2001
From: Guillaume Pasero <guillaume.pasero@c-s.fr>
Date: Wed, 28 Oct 2015 15:55:58 +0100
Subject: [PATCH] ENH: set default pixel type in other applications (color
 outputs, label outputs,...)

---
 .../AppClassification/app/otbFusionOfClassifications.cxx        | 1 +
 .../AppClassification/app/otbKMeansClassification.cxx           | 1 +
 .../Applications/AppClassification/app/otbSOMClassification.cxx | 1 +
 Modules/Applications/AppImageUtils/app/otbColorMapping.cxx      | 1 +
 .../AppSegmentation/app/otbHooverCompareSegmentation.cxx        | 2 ++
 .../Applications/AppSegmentation/app/otbLSMSSegmentation.cxx    | 1 +
 .../AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx          | 1 +
 Modules/Applications/AppSegmentation/app/otbSegmentation.cxx    | 1 +
 Modules/Applications/AppStereo/app/otbBlockMatching.cxx         | 1 +
 9 files changed, 10 insertions(+)

diff --git a/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx b/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx
index 848d41b471..f518994ab7 100644
--- a/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx
+++ b/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx
@@ -156,6 +156,7 @@ private:
 
     AddParameter(ParameterType_OutputImage,"out","The output classification image");
     SetParameterDescription("out","The output classification image resulting from the fusion of the input classification images.");
+    SetDefaultOutputPixelType("out",ImagePixelType_uint8);
 
     // Doc example parameter settings
     SetDocExampleParameterValue("il", "classification1.tif classification2.tif classification3.tif");
diff --git a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx
index 4844205f39..c7ba58f199 100644
--- a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx
+++ b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx
@@ -181,6 +181,7 @@ private:
     SetParameterDescription("in", "Input image to classify.");
     AddParameter(ParameterType_OutputImage, "out", "Output Image");
     SetParameterDescription("out", "Output image containing the class indexes.");
+    SetDefaultOutputPixelType("out",ImagePixelType_uint8);
 
     AddRAMParameter();
 
diff --git a/Modules/Applications/AppClassification/app/otbSOMClassification.cxx b/Modules/Applications/AppClassification/app/otbSOMClassification.cxx
index 9d9dd94451..5e3daf1e62 100644
--- a/Modules/Applications/AppClassification/app/otbSOMClassification.cxx
+++ b/Modules/Applications/AppClassification/app/otbSOMClassification.cxx
@@ -87,6 +87,7 @@ private:
 
     AddParameter(ParameterType_OutputImage,  "out",   "OutputImage");
     SetParameterDescription("out", "Output classified image (each pixel contains the index of its corresponding vector in the SOM).");
+    SetDefaultOutputPixelType("out",ImagePixelType_uint8);
 
     AddParameter(ParameterType_InputImage,  "vm",   "ValidityMask");
     SetParameterDescription("vm", "Validity mask (only pixels corresponding to a mask value greater than 0 will be used for learning)");
diff --git a/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx b/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx
index c20d69aa64..432ba754b1 100644
--- a/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx
+++ b/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx
@@ -291,6 +291,7 @@ private:
     SetParameterDescription("in", "Input image filename");
     AddParameter(ParameterType_OutputImage, "out", "Output Image");
     SetParameterDescription("out","Output image filename");
+    SetDefaultOutputPixelType("out",ImagePixelType_uint8);
 
     AddRAMParameter();
 
diff --git a/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx
index 9b52f3b608..74423df477 100644
--- a/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx
+++ b/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx
@@ -165,10 +165,12 @@ private:
 
     AddParameter(ParameterType_OutputImage,  "outgt",    "Colored ground truth output");
     SetParameterDescription( "outgt", "The colored ground truth output image." );
+    SetDefaultOutputPixelType("outgt",ImagePixelType_uint8);
     MandatoryOff("outgt");
 
     AddParameter(ParameterType_OutputImage,  "outms",    "Colored machine segmentation output");
     SetParameterDescription( "outms", "The colored machine segmentation output image." );
+    SetDefaultOutputPixelType("outms",ImagePixelType_uint8);
     MandatoryOff("outms");
 
     // TODO : add color settings ?
diff --git a/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx
index 1af6e23b92..bafff60e4c 100644
--- a/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx
+++ b/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx
@@ -225,6 +225,7 @@ private:
 
     AddParameter(ParameterType_OutputImage, "out", "Output Image");
     SetParameterDescription( "out", "The output image. The output image is the segmentation of the filtered image. It is recommended to set the pixel type to uint32." );
+    SetDefaultOutputPixelType("out",ImagePixelType_uint32);
 
     AddParameter(ParameterType_Float, "ranger", "Range radius");
     SetParameterDescription("ranger", "Range radius defining the radius (expressed in radiometry unit) in the multi-spectral space.");
diff --git a/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx b/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx
index 9ea8f9013a..c2122b50ba 100644
--- a/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx
+++ b/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx
@@ -90,6 +90,7 @@ private:
 
     AddParameter(ParameterType_OutputImage, "out", "Output Image");
     SetParameterDescription( "out", "The output image. The output image is the input image where the minimal regions have been merged." );
+    SetDefaultOutputPixelType("out",ImagePixelType_uint32);
 
     AddParameter(ParameterType_Int, "minsize", "Minimum Region Size");
     SetParameterDescription("minsize", "Minimum Region Size. If, after the segmentation, a region is of size lower than this criterion, the region is merged with the \"nearest\" region (radiometrically).");
diff --git a/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx
index 8015f13648..bce82fc34a 100644
--- a/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx
+++ b/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx
@@ -251,6 +251,7 @@ private:
     //Raster mode parameters
     AddParameter(ParameterType_OutputImage,  "mode.raster.out",    "Output labeled image");
     SetParameterDescription( "mode.raster.out", "The output labeled image.");
+    SetDefaultOutputPixelType("mode.raster.out",ImagePixelType_uint32);
 
     //Streaming vectorization parameters
     AddParameter(ParameterType_OutputFilename, "mode.vector.out", "Output vector file");
diff --git a/Modules/Applications/AppStereo/app/otbBlockMatching.cxx b/Modules/Applications/AppStereo/app/otbBlockMatching.cxx
index 51fcada2b6..246fef0cb0 100644
--- a/Modules/Applications/AppStereo/app/otbBlockMatching.cxx
+++ b/Modules/Applications/AppStereo/app/otbBlockMatching.cxx
@@ -155,6 +155,7 @@ private:
 
     AddParameter(ParameterType_OutputImage, "io.outmask", "The output mask corresponding to all criterions");
     SetParameterDescription("io.outmask","A mask image corresponding to all citerions (see masking parameters). Only required if variance threshold or nodata criterions are set.");
+    SetDefaultOutputPixelType("io.outmask",ImagePixelType_uint8);
     DisableParameter("io.outmask");
     MandatoryOff("io.outmask");
 
-- 
GitLab