This example simply computes the exponential of the intensity for each data point in the input dataset, producing a new dataset of the same size.
#include "image.h"
using namespace App;
{
AUTHOR =
"Joe Bloggs (joe.bloggs@acme.org)";
+ "raise each voxel intensity to the given power (default: 2)";
+ Argument ("in", "the input image.").type_image_in ()
+ Argument ("out", "the output image.").type_image_out ();
+ Option ("power", "the power by which to raise each value (default: 2)")
+ Argument ("value").type_float();
}
{
Header header (in);
header.datatype() = DataType::Float32;
for (auto l = loop (in, out); l; ++l)
out.value() = std::pow (in.value(), power);
}
static Image open(const std::string &image_name, bool read_write_if_existing=false)
FORCE_INLINE LoopAlongAxes Loop()
OptionList OPTIONS
the options accepted by the command
vector< ParsedArgument > argument
the list of arguments parsed from the command-line
const char * AUTHOR
set the author of the command
T get_option_value(const std::string &name, const T default_value)
Returns the option value if set, and the default otherwise.
Description DESCRIPTION
additional description of the command over and above the synopsis
ArgumentList ARGUMENTS
the arguments expected by the command
std::unique_ptr< ImageIO::Base > create(Header &H)
MR::default_type value_type