Giter Site home page Giter Site logo

mriqc's Introduction

This repository is deprecated. See the new repository on GitLab

Docker Pulls Docker Stars

flywheel/mriqc

Image quality metrics for quality assessment of MRI

Build context for a Flywheel Gear which runs the mriqc tool. For more information see MRIQC's documentation

mriqc's People

Contributors

andysworth avatar dpark6060 avatar ehlertjd avatar hkethi002 avatar jenreiter avatar lmperry avatar npann avatar pvelasco avatar

Stargazers

 avatar

Watchers

 avatar  avatar

mriqc's Issues

Handle copying files with spaces

An input file had a space in it and it may be causing this strange behavior in the gear run. Below is the gear log:

Starting gear execution.
HOSTNAME=nsinit
TERM=xterm
FW_CONFIG_MEASUREMENT=auto-detect
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/flywheel/v0
SHLVL=1
HOME=/root
_=/usr/bin/env
[flywheel/mriqc]  Starting...
Input filename is not in BIDS format. Detecting measurement...
Auto-detecting input file measurement
Auto-detected input file measurement as anatomy_t1w
cp: target '/flywheel/v0/output/work/sub-T1MPRAGE/anat/sub-T1MPRAGE_T1w.nii.gz' is not a directory
2017-11-10 17:33:30,138 root:INFO Running MRIQC-0.9.4 (analysis_levels=[participant], participant_label=['T1MPRAGE'])
	Settings={'bids_dir': '/flywheel/v0/output/work/sub-T1MPRAGE', 'write_graph': False, 'testing': False, 'hmc_afni': True, 'hmc_fsl': False, 'fft_spikes_detector': False, 'n_procs': 4, 'ants_nthreads': 3, 'output_dir': '/flywheel/v0/output/out', 'work_dir': '/flywheel/v0/output/work', 'verbose_reports': False, 'float32': False, 'ica': False, 'deoblique': False, 'despike': False, 'correct_slice_timing': False, 'report_dir': '/flywheel/v0/output/out/reports'}
2017-11-10 17:33:30,151 root:WARNING No T1w scans were found in /flywheel/v0/output/work/sub-T1MPRAGE
2017-11-10 17:33:30,151 root:WARNING No bold scans were found in /flywheel/v0/output/work/sub-T1MPRAGE
2017-11-10 17:33:30,151 root:WARNING No T2w scans were found in /flywheel/v0/output/work/sub-T1MPRAGE
participant labels  ['^T1MPRAGE$']
Traceback (most recent call last):
  File "/usr/local/miniconda/bin/mriqc", line 11, in <module>
    load_entry_point('mriqc==0.9.4', 'console_scripts', 'mriqc')()
  File "/usr/local/miniconda/lib/python3.6/site-packages/mriqc/bin/mriqc_run.py", line 264, in main
    'BIDS-compliant.' % settings['bids_dir'])
RuntimeError: Error reading BIDS directory (/flywheel/v0/output/work/sub-T1MPRAGE), or the dataset is not BIDS-compliant.
cp: target 'MPRAGE_mriqc.qa.html' is not a directory
No results found in output directory... Exiting
Exit code was -1 after running for 12.266391555s.

Set modality for outputs

At present, when compared to the input files, the outputs of the gear do not set the modality.

Screen Shot 2019-06-19 at 12 40 46 PM

Change gear exit status

Fail when autodetect fails and there's nothing to do.

Possible exit codes to use:

1: general purpose failure
17: invalid inputs
18: invalid options

FW-375

Incorrect regular expression for BIDS compliant functional filename

The MRIQC gear has a check if a filename is already BIDS compliant.

The regular expression that is used to check if the functional image is BIDS compliant is incomplete.

The current regular expression is the following:

bids_func_re="sub-[0-9a-zA-Z]+_task-[0-9a-zA-Z]+(_acq-[0-9a-zA-Z]+)?(_rec-[0-9a-zA-Z]+)?(_run-[0-9]+)?_bold"

It is missing the optional session information as well as echo information. The regular expression should be changed to the following:

bids_func_re="sub-[0-9a-zA-Z]+(_ses-[0-9a-zA-Z]+)?_task-[0-9a-zA-Z]+(_acq-[0-9a-zA-Z]+)?(_rec-[0-9a-zA-Z]+)?(_run-[0-9]+)?(_echo-[0-9]+)?_bold"

Handle measurement with uppercase values

A measurement for an input dataset may contain capital letters. Currently, if the measurement contains an uppercase value, the gear returns a message stating that the measurement is invalid. Update mriqc to be able to correctly handle uppercase values.

Below is a log where the input measurement was 'Anatomy_t1w' and considered invalid:

Starting gear execution.
HOSTNAME=nsinit
TERM=xterm
FW_CONFIG_MEASUREMENT=auto-detect
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/flywheel/v0
SHLVL=1
HOME=/root
_=/usr/bin/env
[flywheel/mriqc]  Starting...
Input filename is not in BIDS format. Detecting measurement...
Auto-detecting input file measurement
Auto-detected measurement is Anatomy_t1w
Measurement needs to be 'anatomy_t1w', 'anatomy_t2w', or 'functional'
MRIQC algorithm will not run - nothing to do - exit(0)
Exit code was 0 after running for 276.26115ms.

Add optional config to save all outputs

Currently, mriqc only outputs the summary html report. Add a configuration that will save all generated outputs from the algorithm.

config info
name: 'save_outputs'
type: 'boolean'
default: off

TODO: Determine if functionality can be added to make gear run as a utility gear or an analysis gear.

invalid metadata.json

Result cannot be uploaded by engine, because the metadata.json is invalid.

Resolution by the end of this week would be greatly appreciated.

I believe this is the offending line. There are several more that may be impacted. https://github.com/flywheel-apps/mriqc/blob/master/run#L268

invalid metadata.json that is generated

{ "acquisition" : { "files" : [{ "name" : "sub-01_ses-retest_task-linebisection_bold_mriqc.qa.html","type": "qa","classification": ,"info" : { "aor": 0.018852278481012657, "aqi": 0.01868801620253165, "bids_meta": { "modality": "bold", "session_id": "retest", "subject_id": "01", "task_id": "linebisection" }, "dummy_trs": 1, "dvars_nstd": 20.261016251567792, "dvars_std": 1.1016295977966106, "dvars_vstd": 1.120930209745763, "efc": 0.3900245152634556, "fber": 2249.833984375, "fd_mean": 0.135749212397187, "fd_num": 36, "fd_perc": 15.189873417721518, "fwhm_avg": 2.6552603245267092, "fwhm_x": 2.552025, "fwhm_y": 3.0362, "fwhm_z": 2.3775559735801273, "gcor": 0.0428054, "gsr_x": -0.006997726392000914, "gsr_y": 0.00818222388625145, "provenance": { "md5sum": "58392e3ead9caeefe148a57c71dd5b44", "settings": { "fd_thres": 0.2, "hmc_fsl": false }, "software": "mriqc", "version": "0.11.0", "webapi_port": null, "webapi_url": null }, "size_t": 237, "size_x": 64, "size_y": 64, "size_z": 30, "snr": 4.872862257593941, "spacing_tr": 2.5, "spacing_x": 4, "spacing_y": 4, "spacing_z": 3.999964714050293, "summary_bg_k": 109.44461293244024, "summary_bg_mad": 2.877626419067383, "summary_bg_mean": 33.1856803894043, "summary_bg_median": 26.64556884765625, "summary_bg_n": 83631, "summary_bg_p05": 15.867087841033936, "summary_bg_p95": 71.81856536865234, "summary_bg_stdv": 29.821584701538086, "summary_fg_k": 2.01237749463263, "summary_fg_mad": 208.70286560058594, "summary_fg_mean": 1303.94677734375, "summary_fg_median": 1330.5316162109375, "summary_fg_n": 14795, "summary_fg_p05": 771.4712768554687, "summary_fg_p95": 1696.5619750976562, "summary_fg_stdv": 273.0400695800781, "tsnr": 44.75415802001953 }}]}}

Extension incorrect if filename contains '.'

If a file is named 1.3.12.2.5.0.0.0.nii.gz, MRIQC will define the file extension as 3.12.2.5.0.0.0.nii.gz causing the BIDS filename to be sub-1_task-_bold.3.12.2.5.0.0.0.nii.gz.

Be able to correctly identify the extension when '.' in the filename.

Measurement/classification of resultant html file is incorrect

Currently the measurement/classification of the output html file is "T1w".
The correct measurement/classification value of a structural T1w image is "Anatomy_t1w".

See screenshot below:
screen shot 2017-09-19 at 9 10 50 am 2

However, since this is an html report and not an actual T1w image, I believe this should not be used.
@lmperry do you have thoughts on what the measurement/classification should be for the MRIQC output html file?

Auto-detect input file measurement

Use input file's classification/metadata (if available) to determine measurement so the user does not have to select it. This will allow this gear to run automatically in many cases.

Could have measurement options as such:

  1. Auto-Detect (default)
  2. Functional
  3. T1w
  4. T2w

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.