stnava/ANTs — pull request #77 by cookpa (2014-03-14 16:40:35+00:00)
Title: ENH: Updates to scripts to improve logging, error checking, and document...

...ation

Modified antsCorticalThickness mostly, with some edits to antsAtroposN4 and antsBrainExtraction.

All scripts:
- removed the tee command in the logCmd function, because it suppressed output on qsub jobs

- check all programs run exit normally (zero status), or print error and exit

- Tried to set the reference space for imaging ops as close to the original as possible, in an
effort to minimize small errors in headers. There are inherent precision errors in all
operations, which cannot be completely eliminated by CopyImageHeaderInformation (becuase it
uses the same image I/O). I aimed to make things more consistent by carefully setting the
reference space. For example, consider the masking operation

ThresholdImage 3 original.nii.gz originalPlusDelta.nii.gz 1 Inf
ImageMath 3 originalPlusDelta.nii.gz m original.nii.gz originalPlusDelta.nii.gz

By putting original.nii.gz first in the ImageMath command, we ensure the reference space for
the output is original.nii.gz for both the call to ThresholdImage and to ImageMath.

antsBrainExtraction:
- Added some padding before the main morphology operations, to prevent closing from leaking
out when the masked region is close to the edge of the image. The padding is reversed
before the script returns.

antsCorticalThickness:

- Added a DEBUG_MODE flag that causes logCmd to not exit upon a logged error; my future plan
is to have this mode accessible from the command line to run a faster (fewer iterations, etc)
version of the pipeline that will let us debug and test the integrity of the script.

- Added a checkOutputExists function to check the output that is promised in the usage actually
gets produced.

- Edited usage, made sure major stages are consistently logged and run only if needed,
cleaned up some unused variables.