Skip to content

MNT: Handle paths with spaces, and fslhd fields, in their names

Paul McCarthy requested to merge paulmc-master-patch-94748 into master

First reported at: https://www.jiscmail.ac.uk/cgi-bin/wa-jisc.exe?A2=FSL;f072bcc.2108

  • Handle paths with spaces in their names (surrounding $1 in quotes when passing to fslhd)
  • Handle paths with fslhd fields in their names, e.g. moradim2/image.nii.gz (drop first line of fslhd, stricter grep expression)

Before this change:

$ ls -l bad\ name/
total 8
-rw-r--r-- 1 paulmc paulmc 5087 Aug 12 17:11 image.nii.gz

$ fslval bad\ name/image.nii.gz dim2
Image Exception : #63 :: No image files match: name/image
No image files match: name/image

$ ls -l moradim2/
total 36788
-rwxr-xr-x 2 paulmc paulmc 37667296 Aug 12 18:08 image.nii.gz
$ fslval moradim2/image.nii.gz dim2
moradim2/image.nii.gz

After this change:

$ fslval bad\ name/image.nii.gz dim2
109
$ fslval moradim2/image.nii.gz  dim2
64
Edited by Paul McCarthy

Merge request reports