From 91fe346b55905a10bfba6ba849f01dbad2f461a7 Mon Sep 17 00:00:00 2001 From: Simon Rit Date: Thu, 6 Jun 2013 12:25:43 +0200 Subject: [PATCH] Allow no -i in clitkImageStatistics --- tools/clitkImageStatistics.ggo | 2 +- tools/clitkImageStatisticsGenericFilter.h | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/clitkImageStatistics.ggo b/tools/clitkImageStatistics.ggo index d2e55f3..bc7998b 100644 --- a/tools/clitkImageStatistics.ggo +++ b/tools/clitkImageStatistics.ggo @@ -7,7 +7,7 @@ purpose "Compute statistics on an image, or on part of an image specified by a m option "config" - "Config file" string no option "verbose" v "Verbose" flag off -option "input" i "Input image filename" string yes multiple +option "input" i "Input image filename" string no multiple option "channel" c "Image channel to be used in statistics (-1 to process all channels)" int no default="-1" option "mask" m "Mask image filename (uchar)" string no option "label" l "Label(s) in the mask image to consider" int no multiple default="1" diff --git a/tools/clitkImageStatisticsGenericFilter.h b/tools/clitkImageStatisticsGenericFilter.h index 00cfff8..8544d59 100644 --- a/tools/clitkImageStatisticsGenericFilter.h +++ b/tools/clitkImageStatisticsGenericFilter.h @@ -61,7 +61,15 @@ namespace clitk { m_ArgsInfo=a; m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg[0]; + + if(m_ArgsInfo.input_given) + m_InputFileName=m_ArgsInfo.input_arg[0]; + else if(m_ArgsInfo.inputs_num>0) + m_InputFileName=m_ArgsInfo.inputs[0]; + else { + std::cerr << "You must give an input file name" << std::endl; + exit(1); + } } -- 2.47.1