img2stdcoord piped input stops if coordinates are repeated

This issue was originally discussed on the mailing list (JISC mail) with the subject Bug in img2stdcoord command

It seems that a list of coordinate rows like:

39 39 15 
35 44 13 
36 41 13 
33 45 14 
33 45 14 (this line ignored)
34 42 14 (this one too)

will stop being processed when a coordinate row matches the previous row.

This only happens for cases where coordinates are piped in like:

cat /my/path/coordinates.txt | img2stdcoord -img /usr/local/fsl/data/standard/MNI152_T1_2mm_brain.nii.gz -std /usr/local/fsl/data/standard/MNI152_T1_2mm_brain.nii.gz -vox - > coordinates_mm.txt

if a coordinate file is given, then img2stdcoord works as expected

Suggested solutions

@mwebster @paulmc @mark

  1. We could make it explicit that this will happen (tell the user matching coordinates were found in piped input, and allow them to use the program in a different way)
  2. We could modify img2stdcoord.cc (around line 321) so that piped input behaves the same as input from a file read from disk