Commit f40a219b authored by Cyril Poupon's avatar Cyril Poupon
Browse files

modified Mask2MaskHemisphere command to add a middle coordinate parameter

parent d92b15dc
......@@ -39,6 +39,7 @@ gkg::Mask2HemisphereMaskCommand::Mask2HemisphereMaskCommand( int32_t argc,
gkg::Mask2HemisphereMaskCommand::Mask2HemisphereMaskCommand(
const std::string& fileNameIn,
const std::string& fileNameOut,
int32_t middle,
double background,
bool ascii,
const std::string& format,
......@@ -51,6 +52,7 @@ gkg::Mask2HemisphereMaskCommand::Mask2HemisphereMaskCommand(
execute( fileNameIn,
fileNameOut,
middle,
background,
ascii,
format,
......@@ -59,6 +61,7 @@ gkg::Mask2HemisphereMaskCommand::Mask2HemisphereMaskCommand(
}
GKG_CATCH( "gkg::Mask2HemisphereMaskCommand::Mask2HemisphereMaskCommand( "
"const std::string& fileNameIn, const std::string& fileNameOut, "
"int32_t middle, "
"double background, bool ascii, const std::string& format, "
"bool verbose )" );
......@@ -75,6 +78,7 @@ gkg::Mask2HemisphereMaskCommand::Mask2HemisphereMaskCommand(
DECLARE_STRING_PARAMETER( parameters, std::string, fileNameIn );
DECLARE_STRING_PARAMETER( parameters, std::string, fileNameOut );
DECLARE_INTEGER_PARAMETER( parameters, int32_t, middle );
DECLARE_FLOATING_PARAMETER( parameters, double, background );
DECLARE_BOOLEAN_PARAMETER( parameters, bool, ascii );
DECLARE_STRING_PARAMETER( parameters, std::string, format );
......@@ -82,6 +86,7 @@ gkg::Mask2HemisphereMaskCommand::Mask2HemisphereMaskCommand(
execute( fileNameIn,
fileNameOut,
middle,
background,
ascii,
format,
......@@ -121,6 +126,7 @@ void gkg::Mask2HemisphereMaskCommand::parse()
std::string fileNameIn;
std::string fileNameOut;
int32_t middle = -1;
double background = 0.0;
bool ascii = false;
std::string format = "";
......@@ -135,6 +141,10 @@ void gkg::Mask2HemisphereMaskCommand::parse()
application.addSingleOption( "-o",
"Output file name",
fileNameOut );
application.addSingleOption( "-m",
"Middle coordinate (default=sizeX / 2)",
middle,
true );
application.addSingleOption( "-b",
"Background value (default=0)",
background,
......@@ -155,6 +165,7 @@ void gkg::Mask2HemisphereMaskCommand::parse()
execute( fileNameIn,
fileNameOut,
middle,
background,
ascii,
format,
......@@ -168,6 +179,7 @@ void gkg::Mask2HemisphereMaskCommand::parse()
void gkg::Mask2HemisphereMaskCommand::execute( const std::string& fileNameIn,
const std::string& fileNameOut,
int32_t middle,
double background,
bool ascii,
const std::string& format,
......@@ -194,6 +206,13 @@ void gkg::Mask2HemisphereMaskCommand::execute( const std::string& fileNameIn,
gkg::Vector3d< int32_t > size;
volume.getSize( size );
int32_t middleCoordinate = middle;
if ( middleCoordinate < 0 )
{
middleCoordinate = ( size.x / 2 );
}
if ( verbose )
{
......@@ -230,7 +249,7 @@ void gkg::Mask2HemisphereMaskCommand::execute( const std::string& fileNameIn,
if ( value )
{
if ( x < ( size.x / 2 ) )
if ( x < middle )
{
value = 1;
......@@ -292,6 +311,7 @@ void gkg::Mask2HemisphereMaskCommand::execute( const std::string& fileNameIn,
}
GKG_CATCH( "void gkg::Mask2HemisphereMaskCommand::execute( "
"const std::string& fileNameIn, const std::string& fileNameOut, "
"int32_t middle, "
"double background, bool ascii, const std::string& format, "
"bool verbose )" );
......@@ -301,6 +321,7 @@ void gkg::Mask2HemisphereMaskCommand::execute( const std::string& fileNameIn,
RegisterCommandCreator( Mask2HemisphereMaskCommand,
DECLARE_STRING_PARAMETER_HELP( fileNameIn ) +
DECLARE_STRING_PARAMETER_HELP( fileNameOut ) +
DECLARE_INTEGER_PARAMETER_HELP( middle ) +
DECLARE_FLOATING_PARAMETER_HELP( background ) +
DECLARE_BOOLEAN_PARAMETER_HELP( ascii ) +
DECLARE_STRING_PARAMETER_HELP( format ) +
......
......@@ -31,6 +31,7 @@ class Mask2HemisphereMaskCommand :
bool removeFirst = true );
Mask2HemisphereMaskCommand( const std::string& fileNameIn,
const std::string& fileNameOut,
int32_t middle,
double background,
bool ascii,
const std::string& format,
......@@ -50,6 +51,7 @@ class Mask2HemisphereMaskCommand :
void parse();
void execute( const std::string& fileNameIn,
const std::string& fileNameOut,
int32_t middle,
double background,
bool ascii,
const std::string& format,
......
Supports Markdown
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