Commit 135fc8bd authored by remicres's avatar remicres

ADD: Tiling options in app interface

parent c8019f24
......@@ -36,6 +36,14 @@ public:
private:
/* Tiling mode choice */
enum TilingMode
{
TILING_AUTO,
TILING_USER,
TILING_NONE
};
void DoInit()
{
SetName("GenericRegionMerging");
......@@ -79,6 +87,7 @@ private:
AddParameter(ParameterType_Int, "tiling.user.sizey", "Tiles height");
AddParameter(ParameterType_Int, "tiling.user.nfirstiter", "Number of first iterations");
AddParameter(ParameterType_Int, "tiling.user.memory", "Available memory");
AddChoice("tiling.none", "No tiling layout");
}
void DoUpdateParameters()
......@@ -106,19 +115,29 @@ private:
controller.SetInputImage(inputImage);
controller.SetTemporaryDirectory(GetParameterAsString("tmpdir"));
// Memory configuration
if (GetParameterInt("tiling") == 0)
// Tiling mode
int inputTilingMode = GetParameterInt("tiling");
if (inputTilingMode == TILING_AUTO)
{
controller.SetInternalMemoryAvailable(0); // 0 = automatic
controller.SetTilingModeAuto();
}
else
else if (inputTilingMode == TILING_USER)
{
// User
controller.SetTilingModeUser();
controller.SetTileWidth(GetParameterInt("tiling.user.sizex"));
controller.SetTileHeight(GetParameterInt("tiling.user.sizey"));
controller.SetNumberOfFirstIterations(GetParameterInt("tiling.user.nfirstiter"));
controller.SetInternalMemoryAvailable(GetParameterInt("tiling.user.memory"));
}
else if (inputTilingMode == TILING_NONE)
{
controller.SetTilingModeNone();
}
else
{
otbAppLogFATAL("Unknow input tiling mode!");
}
// MPI configuration
#ifdef OTB_USE_MPI
......@@ -138,6 +157,7 @@ private:
controller.SetNumberOfIterations(GetParameterInt("niter"));
// Run the segmentation
controller.SetDebug(true);
controller.RunSegmentation();
// Output images
......
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