STIR
6.2.0
|
add or multiply data, with some other basic math manipulations More...
#include "stir/ArrayFunction.h"
#include "stir/DiscretisedDensity.h"
#include "stir/SegmentByView.h"
#include "stir/IO/OutputFileFormat.h"
#include "stir/IO/read_from_file.h"
#include "stir/Succeeded.h"
#include "stir/ProjDataInterfile.h"
#include "stir/ExamInfo.h"
#include "stir/utilities.h"
#include "stir/NumericInfo.h"
#include "stir/KeyParser.h"
#include "stir/is_null_ptr.h"
#include "stir/modelling/ParametricDiscretisedDensity.h"
#include "stir/DynamicDiscretisedDensity.h"
#include "stir/stir_math.h"
#include "stir/warning.h"
#include "stir/error.h"
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <memory>
Functions | |
template<class DataT , class FunctionObjectT > | |
void | process_data (const string &output_file_name, const int num_files, char **argv, const bool no_math_on_data, const bool except_first, const bool verbose, const bool do_add, const FunctionObjectT &pow_times_add_object, const OutputFileFormat< DataT > &output_format) |
template<class FunctionObjectT > | |
void | process_data (const string &output_file_name, const int num_files, char **argv, const bool no_math_on_data, const bool except_first, const bool verbose, const bool do_add, const FunctionObjectT &pow_times_add_object, const OutputFileFormat< DynamicDiscretisedDensity > &output_format) |
template<class DataT > | |
shared_ptr< OutputFileFormat< DataT > > | find_output_format (const std::string &filename) |
int | main (int argc, char **argv) |
add or multiply data, with some other basic math manipulations
This is a command line utility for adding, multiplying, thresholding ... data, with a somewhat awkward syntax. The command line arguments are as follows (but everything has to fit on 1 line):
or
'–add' is default, and outputs the sum of the result of processed data. '–mult' outputs the multiplication of the result of processed data.
The '–include-first' option can be used such that power and scalar multiplication are done on the first input argument as well. Otherwise these manipulations are done only on the 2nd, 3rd,.. argument.
The '–accumulate' option can be used to say that the first filename given will be used for input AND output. Note that when using this option together with '–including-first', the data in the first filename will first be manipulated according to '–power' and '–times-scalar'.
The '-s' option is necessary if the arguments are projection data. Otherwise, it is assumed the data are images. '–parametric' and '–dynamic' can be used to read parametric/dynamic images.
For projection data, you can restrict the number of segments read/written using the –max_segment_num_to_process option (unless –accumulate is used). For example, using 2 as an argument of this option, will read/write segments -2,-1,0,1,2.
Multiple occurences of '–times-scalar' and '–divide-scalar' are allowed and will just result in accumulation of the factors.
The order of the manipulations is as follows:
(1) thresholding (2) power (3) scalar multiplication (4) scalar addition.
The '–output-format' option can be used to write the output in a different file format then the default (although this currently only works for images). The parameter file should have the following format:
output file format parameters:= output file format type:= <sometype> END:=
See the stir::OutputFileFormat hierarchy for possible values.
Dividing 2 files, with first file set to the quotient