question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MRIQC T1w Classifier

See original GitHub issue

I have MRIQC Outputs of approximately 1000 T1w images. I would like to produce the default T1w classifier using the mriqc_clf command. Since I’m working with singularity on a HPC server I use the following command after loading the singularity module:

singularity exec -c -B $SCRATCH:/mnt/ $SCRATCH/.scinet/mriqc-sandbox.img mriqc_clf --load-classifier -X /mnt/MRIQC/Study_QC/T1w.csv

with the exception of the following minor warning there are no errors.

Fontconfig warning: ignoring C.UTF-8: not a valid language tag

No new output is generated after the command is run and no new additional column is created in the T1w.csv. I’m not sure what has gone wrong here?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nathankchancommented, Jul 5, 2018

Hi @n2parker and @oesteban,

I ran into a similar issue using mriqc with singularity on the same HPC server. Like @n2parker, I received no warnings or errors when running mriqc_clf (exit status is 0), and the T1w.csv is not modified.

Replicating the original issue

The command I ran is below. Note that:

  1. $HOME on the HPC server I work with is readable but not writeable for jobs run on compute nodes. As such, I send -H $SCRATCH/sing_home to assign a writeable $HOME for singularity containers.
  2. Singularity imports the environment when running docker containers. To avoid using the environment python, I unset PYTHONPATH to force singularity to use the container’s python.
$ PYTHONPATH="" singularity exec \
-H $SCRATCH/sing_home \
-B $SCRATCH/BIDS/mriqc_clf/CN_BIDS_output:/output \
$HOME/BIDS_apps/mriqc/poldracklab_mriqc_0.11.0-2018-06-05-b7b338730c42.img \
mriqc_clf --load-classifier \
-X /output/T1w.csv \

To check whether T1w.csv was modified, I ran ls -l $SCRATCH/BIDS/mriqc_clf/CN_BIDS_output/T1w.csv before and after singularity exec as above. The file modification times are not altered, and no new columns are added to T1w.csv. Additionally, echo $? (the most recent exit code) returns 0 after running singularity exec.

As mentioned by @oesteban above, I tried the -o flag, but as reported by @n2parker, it was not recognized. I suspect this is because I’m using mriqc 0.11.0 where -o is not supported.

Further troubleshooting

I re-ran the command with mriqc_clf -v to increase verbosity. The output with -v states:

> 2018-07-05 18:09:40,840 mriqc.classifier:INFO Results saved as /scratch/a/agraff/channa13/sing_home/mclf_run-20180705-180940*

Navigating to $SCRATCH/sing_home, I found the file mclf_run-20180705-180940_data-unseen_pred.csv. I then ran:

$ cat /scratch/a/agraff/channa13/sing_home/mclf_run-20180705-180940_data-unseen_pred.csv | head -n 5
> subject_id,prob_y,pred_y
002S0295,0.147785410865424,0
002S0413,0.3250233296316222,0
002S1261,0.2381351524431868,0
002S1280,0.308822544009952,0

The .csv contains 3 columns: subject_id, prob_y, and pred_y. The subject_id values correspond with the subject IDs from my BIDS input folder, while prob_y values seem to be propensity scores(?), and pred_y values seem to be the classifier’s rating (i.e. 0 or 1).

Remaining issues

Based on the comment from @oesteban here, it seems like the expected behaviour of mriqc_clf is to add values in pred_y from mclf_run-*_data_unseen_pred.csv to the respective subject_id row in T1w.csv. Can someone from Poldrack Lab please confirm whether this is the case?

If the pred_y values in mclf_run-*_data-unseen_pred.csv are the correct values, one approach to resolution might be…

  • If $HOME it is not writeable, then mriqc should return an error and stop.
  • If $HOME is writeable, then mriqc should direct mriqc_clf to make mclf_run-*_data-unseen_pred.csv and properly append the column pred_y to T1w.csv.

Note that a new mclf_run-*_data-unseen_pred.csv is created in $HOME each time singularity exec is run. This file is not deleted when the singularity command exits. As such, using the same $HOME directory with mriqc_clf may get confusing when running multiple datasets (the .csv files are distinguished by timestamp only).

0reactions
oestebancommented, Aug 14, 2018

Hi @n2parker, @nathankchan.

I can confirm all that @nathankchan described, and add some details:

  • the mclf_run-*_data-unseen_pred.csv files are created in the working directory (not $HOME)
  • my comment here is wrong. The predictions will not be added to the original T1w.csv file. Sorry for the confusion.
  • the pred_y column are the prediction scores (threshold = 0.5) of the random forests.

I’ll work in making the interface of the classifier more intuitive. I agree it is quite a mess at this moment. Sorry about that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The MRIQC classifier for T1w images
The MRIQC classifier for T1w images¶. MRIQC is shipped with a random-forests classifier, using the combination of the ABIDE and DS030 datasets as...
Read more >
MRIQC T1w Classifier · Issue #699 - GitHub
I have MRIQC Outputs of approximately 1000 T1w images. I would like to produce the default T1w classifier using the mriqc_clf command.
Read more >
MRIQC Classifier - Neurostars
I have a quick question about the MRIQC classifier function (mriqc_clf). ... mriqc_clf --load-classifier \ -X /path/to/derivatives/T1w.csv.
Read more >
mriqc-learn - PyPI
MRIQC is released with two classifiers (already trained) to predict image quality of T1w images. Tip. You can customize the MRIQC classifier ......
Read more >
how to use mriqc_clf in docker - Google Groups
mriqc_clf --load-classifier c:\programdata\anaconda3\lib\site-packages\mriqc\data\rfc-nzs-full-1.0.pklz -X T1w.csv -o outputs\mypredictionsT1w.csv.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found