spinalcordtoolbox / spinalcordtoolbox

Comprehensive and open-source library of analysis tools for MRI of the spinal cord.
https://spinalcordtoolbox.com
GNU Lesser General Public License v3.0
199 stars 101 forks source link

-noqc flag conflicts with sct_pipeline #1425

Closed jcohenadad closed 6 years ago

jcohenadad commented 7 years ago

Description

in all test_xx functions, the parser gets all fields, imposing that all fields have a value, which is not the case for flag -noqc. As a result, sct_pipeline with flag -noqc will crash, as shown below.

Solutions include:

State of spinalcordtoolbox

Spinal Cord Toolbox (jca_minorFixTesting/d78a91d181425107389e1f022a9d87e9859822c0)

Additional Information

sct_pipeline -f sct_label_vertebrae -d data/sct_test_function/ -p \"-i t1/t1.nii.gz -s t1/t1_seg_manual.nii.gz -c t1 -noqc -param gaussian_std=1\" 

--
Spinal Cord Toolbox (jca_minorFixTesting/d78a91d181425107389e1f022a9d87e9859822c0)
Running /Users/julien/code/sct/scripts/sct_pipeline.py -f sct_label_vertebrae -d data/sct_test_function/ -p "-i t1/t1.nii.gz -s t1/t1_seg_manual.nii.gz -c t1 -noqc -param gaussian_std=1"
Check folder existence...
Testing started on: 2017-07-26 18:57:54
SCT version/commit/branch: dev/d78a91d181425107389e1f022a9d87e9859822c0/jca_minorFixTesting
OS: osx (Darwin-14.5.0-x86_64-i386-64bit)
Hostname: julien-macbook
CPU cores: 8
RAM: Primary memory available: 16.00 gigabytes

Command: "sct_label_vertebrae -i t1/t1.nii.gz -s t1/t1_seg_manual.nii.gz -c t1 -noqc -param gaussian_std=1
Dataset: data/sct_test_function/
  Number of subjects to process: 15
Running /Users/julien/code/sct/scripts/sct_label_vertebrae.py -noqc True -qc /Users/julien/qc_data -laplacian 0 -c t1 -i data/sct_test_function/xuanwu_chenxi_01/t1/t1.nii.gz -t /Users/julien/code/sct/data/PAM50/ -v 1 -s data/sct_test_function/xuanwu_chenxi_01/t1/t1_seg_manual.nii.gz -r 1 -param gaussian_std=1 -denoise 0 -ofolder sct_label_vertebrae_xuanwu_chenxi_01_170726185755_41271/
ERROR: argument True does not exist. See documentation.
Aborted...

DESCRIPTION
This function takes an anatomical image and its cord segmentation (binary file), and outputs the
cord segmentation labeled with vertebral level. The algorithm requires an initialization (first
disc) and then performs a disc search in the superior, then inferior direction, using template disc
matching based on mutual information score.
Tips: To run the function with init txt file that includes flags -initz/-initcenter:
sct_label_vertebrae -i t2.nii.gz -s t2_seg_manual.nii.gz  "$(< init_label_vertebrae.txt)"

USAGE
sct_label_vertebrae -i <file> -s <file> -c {t1,t2}

MANDATORY ARGUMENTS
-i <file>                    input image.
-s <file>                    Segmentation or centerline of the spinal cord.
-c {t1,t2}                   type of image contrast, t2: cord dark / CSF bright ; t1: cord bright
/ CSF dark

OPTIONAL ARGUMENTS
-t <folder>                  Path to template. Default value = /Users/julien/code/sct/data/PAM50/
-initz <list of: int>        Initialize using slice number and disc value. Example: 68,3 (slice 68
corresponds to disc C3/C4). WARNING: Slice number should correspond
to superior-inferior direction (e.g. Z in RPI orientation, but Y in
LIP orientation).
-initcenter <int>            Initialize using disc value centered in the rostro-caudal direction.
If the spine is curved, then consider the disc that projects onto the
cord at the center of the z-FOV
-initc2                      Initialize by clicking on C2-C3 disc using interactive window.
-initfile <file>             Initialize labeling by providing a text file which includes either
-initz or -initcenter flag.
-ofolder <folder_creation>   Output folder.
-denoise {0,1}               Apply denoising filter to the data. Sometimes denoising is too
aggressive, so use with care. Default value = 0
-laplacian {0,1}             Apply Laplacian filtering. More accuracy but could mistake disc
depending on anatomy. Default value = 0
-param <list of: str>        Advanced parameters. Assign value with "="; Separate arguments with
","
shift_AP_initc2 [mm]: AP shift for finding C2 disc. Default=35.
size_AP_initc2 [mm]: AP window size finding C2 disc. Default=9.
shift_IS_initc2 [mm]: IS shift for finding C2 disc. Default=15.
size_IS_initc2 [mm]: IS window size finding C2 disc. Default=30.
size_RL_initc2 [mm]: RL shift for size finding C2 disc. Default=1.
shift_AP [mm]: AP shift of centerline for disc search. Default=32.
size_AP [mm]: AP window size for disc search. Default=11.
size_RL [mm]: RL window size for disc search. Default=1.
size_IS [mm]: IS window size for disc search. Default=19.
gaussian_std [mm]: STD of the Gaussian function, centered at the
most rostral point of the image, and used to weight C2-C3 d
isk location finding towards the rostral portion of the FOV. Va
lues to set between 0.1 (strong weighting) and 999 (no weighting). Default=1.

-r {0,1}                     Remove temporary files. Default value = 1
-v {0,1,2}                   Verbose. 0: nothing. 1: basic. 2: extended. Default value = 1
-h                           display this help
-qc <folder_creation>        The path where the quality control generated content will be saved
Default value = /Users/julien/qc_data
-noqc                        Prevent the generation of the QC report

Traceback (most recent call last):
File "/Users/julien/code/sct/scripts/sct_label_vertebrae.py", line 917, in <module>
main()
File "/Users/julien/code/sct/scripts/sct_label_vertebrae.py", line 187, in main
arguments = parser.parse(sys.argv[1:])
File "/Users/julien/code/sct/scripts/msct_parser.py", line 374, in parse
self.usage.error("ERROR: argument " + arg + " does not exist. See documentation.")
File "/Users/julien/code/sct/scripts/msct_parser.py", line 572, in error
self.generate(error)
File "/Users/julien/code/sct/scripts/msct_parser.py", line 565, in generate
raise SyntaxError(error)
SyntaxError: ERROR: argument True does not exist. See documentation.

/Users/julien/code/sct/scripts/sct_utils.pyNone
poquirion commented 6 years ago

Is that still current with the new pipeline? @jcohenadad @peristeri

peristeri commented 6 years ago

Why not make -qc mandatory? It will eliminate the need for -noqc which conflicts with -qc. The verbose flag can enable or disable the generation of qc. If verbose value is 0 then the qc is not outputted.

zougloub commented 6 years ago

Well I just made -qc optional and destroyed -noqc in #1653