From: dsarrut Date: Fri, 25 Mar 2011 13:58:48 +0000 (+0000) Subject: Romulo: X-Git-Tag: v1.2.0~114 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=c8c84f7f5305aad920d35931314e61a63b921716;p=clitk.git Romulo: Add --output (-o) option. stdout is now used for verbose mode only. --- diff --git a/tools/clitkTransformLandmarks.cxx b/tools/clitkTransformLandmarks.cxx index fc92886..4d42408 100644 --- a/tools/clitkTransformLandmarks.cxx +++ b/tools/clitkTransformLandmarks.cxx @@ -12,13 +12,14 @@ typedef std::vector PointArrayType; void read_points(const std::string& fileName, PointArrayType& points); void transform_points(const PointArrayType& input, const MatrixType& matrix, PointArrayType& output); -void write_points(const PointArrayType& points); +void write_points(const std::string& fileName, const PointArrayType& points); bool verbose = false; int main(int argc, char** argv) { GGO(clitkTransformLandmarks, args_info); + verbose = args_info.verbose_flag; PointArrayType inputPoints; read_points(args_info.input_arg, inputPoints); @@ -28,7 +29,7 @@ int main(int argc, char** argv) PointArrayType outputPoints; transform_points(inputPoints, matrix, outputPoints); - write_points(outputPoints); + write_points(args_info.output_arg, outputPoints); return 0; } @@ -74,9 +75,11 @@ void transform_points(const PointArrayType& input, const MatrixType& matrix, Poi } } -void write_points(const PointArrayType& points) +void write_points(const std::string& fileName, const PointArrayType& points) { - std::cout << "LANDMARKS1" << std::endl; + std::ofstream landmarksFile(fileName.c_str()); + + landmarksFile << "LANDMARKS1" << std::endl; for (size_t i = 0; i < points.size(); i++) - std::cout << i << " " << points[i][0] << " " << points[i][1] << " " << points[i][2] << " " << "0" << " " << std::endl; + landmarksFile << i << " " << points[i][0] << " " << points[i][1] << " " << points[i][2] << " " << "0" << " " << std::endl; } \ No newline at end of file diff --git a/tools/clitkTransformLandmarks.ggo b/tools/clitkTransformLandmarks.ggo index 3446c6a..c9eac33 100644 --- a/tools/clitkTransformLandmarks.ggo +++ b/tools/clitkTransformLandmarks.ggo @@ -8,5 +8,6 @@ option "verbose" v "Verbose" flag off option "input" i "Input landmarks filename" string yes option "matrix" m "Input 4x4 matrix filename ('.mat' file)" string yes +option "output" o "Output landmarks filename" string yes