31 #include <DGtal/base/Common.h>
32 #include <DGtal/io/readers/GenericReader.h>
33 #include <DGtal/io/writers/GenericWriter.h>
34 #include <DGtal/helpers/StdDefs.h>
35 #include <DGtal/images/ImageContainerBySTLVector.h>
36 #include <DGtal/images/ConstImageAdapter.h>
41 using namespace DGtal;
95 int main(
int argc,
char**argv)
101 std::string inputFileName;
102 std::string outputFileName {
"result.vol"};
103 std::vector<unsigned int> inputVals;
104 std::vector<unsigned int> outputVals;
106 app.description(
"Apply basic vol image transform from the input values to output values.\n Basic usage:\n \t volTrValues --input <volFileName> --o <volOutputFileName> -s 1 99 -r 100 200 \n\t => all voxel of values 1 (resp. 99) will be 100 (resp. 200) in the resulting image.");
108 app.add_option(
"-i,--input,1", inputFileName,
"Input vol file." )
110 ->check(CLI::ExistingFile);
112 app.add_option(
"--output,-o,2",outputFileName,
"Output filename.",
true);
113 app.add_option(
"--inputVals,-s", inputVals,
"specify the values which will be transformed with the output values (given with --outputVals).") ->required();
114 app.add_option(
"--outputVals,-r", outputVals,
"specify the values which will be transformed with the output values (given with --outputVals).") ->required();
117 app.get_formatter()->column_width(40);
118 CLI11_PARSE(app, argc, argv);
122 if(inputVals.size()!=outputVals.size()){
123 trace.
error()<<
"Transformation not possible the two sets of input/output values should have the same size." << std::endl;
132 for(MyImageC::Domain::ConstIterator it = image.domain().begin(),
133 itend = image.domain().end(); it != itend; ++it)
136 for(
unsigned int i = 0; i< inputVals.size(); i++){
137 if(inputVals.at(i)==val){
138 image.setValue( *it , outputVals.at(i));
147 if (res)
return 0;
else return 1;
int main(int argc, char **argv)
void beginBlock(const std::string &keyword="")
Trace trace(traceWriterTerm)