neuronets / kwyk

Knowing what you know - Bayesian brain parcellation
https://doi.org/10.3389/fninf.2019.00067
Apache License 2.0
20 stars 9 forks source link

default to some extension for output (.nii.gz?) if non specified? #7

Closed yarikoptic closed 5 years ago

yarikoptic commented 5 years ago

I just waited for ~10 minutes for kwik to complete just to get a crash

$ datalad containers-run --explicit --input data/bids/sub-02/anat/sub-02_T1w.nii.gz --output data/kwyked/sub-02_T1w -n containers/neuronets-kwyk '{inputs}' '{outputs}'
...
64/64 [==============================] - 1086s 17s/step/allocator.cc:122] Allocation of 100663296 exceeds 10% of system 49/64 [=====================>........] - ETA: 4:12    ++ Saving results.
/opt/nobrainer/third_party/freesurfer/bin/mri_convert: line 2: /opt/nobrainer/third_party/freesurfer/sources.sh: No such file or directory
mri_convert.bin -rl data/bids/sub-02/anat/sub-02_T1w.nii.gz -rt nearest -ns 1 sub-02_T1w_means sub-02_T1w_means_orig 
mri_convert.bin: can't determine type of output volume
Traceback (most recent call last):
  File "/usr/local/bin/nobrainer_bwn", line 11, in <module>
    load_entry_point('nobrainer', 'console_scripts', 'nobrainer_bwn')()
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/opt/nobrainer/nobrainer/cli_click.py", line 106, in predict
    _reslice(outfile_means, outfile_means_orig, _orig_infile, True)
  File "/opt/nobrainer/nobrainer/cli_click.py", line 125, in _reslice
    check=True)
  File "/usr/lib/python3.5/subprocess.py", line 398, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['mri_convert', '-rl', 'data/bids/sub-02/anat/sub-02_T1w.nii.gz', '-rt', 'nearest', '-ns', '1', 'sub-02_T1w_means', 'sub-02_T1w_means_orig']' returned non-zero exit status 1
[INFO   ] == Command exit (modification check follows) ===== 

so I thought it would be more user friendly if output argument is checked if there is any of known supported extensions and either crash early or default to some (nii.gz?)

PS I was using singularity image of 0.2 converted from docker, available within https://github.com/ReproNim/containers/tree/master/images/neuronets

yarikoptic commented 5 years ago

also note that there is I guess an ignored error msg

/opt/nobrainer/third_party/freesurfer/bin/mri_convert: line 2: /opt/nobrainer/third_party/freesurfer/sources.sh: No such file or directory

not sure how critical if at all but may be docker image could get then that sources.sh in some shape? ;-)

satra commented 5 years ago

@yarikoptic - the second thing is freesurfer and can be ignored.

for the first thing, we could add a default option or we can ask the user to specify it (currently the case). this would allow the user to generate nii.gz or .nii files independent of the input extension. i think asking this of the user is ok.

satra commented 5 years ago

but yes, we can raise an exception if an unknown extension is detected or carry over the input extension.

satra commented 5 years ago

i can switch the output to a prefix

kaczmarj commented 5 years ago

Thanks, Satra!

On Aug 20, 2019, at 10:32 PM, Satrajit Ghosh notifications@github.com wrote:

Closed #7 via 8ff7266.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.