Dear All,<br><br>I am trying to read command-line argument using ITK&#39;s &lt;metaCommand.h&gt;.<br>I have problems in setting default values for a LIST. <br>Even though I am setting default values using AddOptionField(), it&#39;s not taking those values.<br>

<br>Here is the code for a toy-example that reproduces my problem:<br><br>When the command-line input to the following program is:<br>example.exe -l 3 10 20 30<br>I got the output as expected, and is:<br>Input Image Name:input.mhd<br>

Number of labels: 3<br>Label Value: 10<br>Label Value: 20<br>Label Value: 30<br><br><br>When I call the same executable with no arguments, the output is:<br>Input Image Name:input.mhd<br>Number of labels: 0<br><br>However, the output that I was expecting is:<br>

Input Image Name:input.mhd<br>
Number of labels: 4<br>
Label Value: 10<br>
Label Value: 20<br>
Label Value: 30<br>
Label Value: 40<br>
<br>Is this a bug? or, am I doing some mistake here in setting default values for a list?<br><br>Thank you in advance for your help.<br><br>Warm Regards,<br>Subrahmanyam Gorthi.<br><br><br>//----------------------------------------------------------------------------- <br>

#include&lt;iostream&gt;<br>#include&lt;string&gt;<br>#include&lt;list&gt;<br>#include &quot;metaCommand.h&quot;<br><br>int main( int argc, char* argv[] )<br>{<br>  MetaCommand command;<br><br>  // Input file name...<br>
  // By default, set input file name to: input.mhd<br>
  command.SetOption(&quot;inputFile&quot;, &quot;i&quot;, false, &quot;Input file&quot;);<br>  command.AddOptionField(&quot;inputFile&quot;, &quot;fileName1&quot;,<br>                         MetaCommand::STRING, true, &quot;input.mhd&quot;);<br>

<br>  // Label Values...<br>  // By default, take 4 labels, and set their values to: 10, 20, 30, 40<br>  command.SetOption(&quot;labelValues&quot;, &quot;l&quot;, false, &quot;List of label values&quot;);<br>  command.AddOptionField(&quot;labelValues&quot;, &quot;labelList1&quot;,<br>

                         MetaCommand::LIST, true, &quot;4 10 20 30 40&quot;);<br><br>  // Now, Parse the command line<br>  if (!command.Parse(argc,argv))<br>    {<br>    std::cerr &lt;&lt; &quot;Error in parsing the input arguments!&quot; &lt;&lt; std::endl; <br>

    exit( EXIT_FAILURE );<br>    }<br><br>  // Printing the argument values...<br>  std::string inputImageFile=command.GetValueAsString(&quot;inputFile&quot;, &quot;fileName1&quot;);<br>  std::cout &lt;&lt; &quot;Input Image Name:&quot; &lt;&lt; inputImageFile &lt;&lt; std::endl;<br>

<br>  std::list&lt;std::string&gt; listOfLables;<br>  listOfLables.clear();<br><br>  listOfLables = command.GetValueAsList(&quot;labelValues&quot;);<br>  int numLabels = listOfLables.size();<br><br>  std::cout &lt;&lt; &quot;Number of labels: &quot; &lt;&lt; numLabels &lt;&lt; std::endl;<br>

<br>  typedef std::list&lt;std::string&gt;::const_iterator LabelValuesIterator;<br>  LabelValuesIterator labelValuesItr;<br><br>  for(labelValuesItr = listOfLables.begin();<br>     labelValuesItr != listOfLables.end(); ++labelValuesItr)<br>

    {<br>    std::cout &lt;&lt; &quot;Label Value: &quot; &lt;&lt; *labelValuesItr &lt;&lt; std::endl; <br>    }<br><br>  return EXIT_SUCCESS;<br>}<br>//----------------------------------------------------------------------------- <br>