populse / mia_processes

The default processes repository for mia
Other
1 stars 2 forks source link

[MRIQC] Bold_mriqc pipeline iteration issue #31

Closed manuegrx closed 1 year ago

manuegrx commented 1 year ago

Sometimes (not all the time but very often), when launching an iteration for the Bold_mriqc pipeline, an issue occurs for some subjects: the pipeline fails because of an issue in GCOR brick.

It is not a problem related to a subject because if we launch an other time it works.

The GCOR brick launches the AFNI script @compute_gcor via Nipype. This script launches several command and create at least 4 temporary files (tmp.unit+orig.BRIK, tmp.unit+orig.HEAD, tmp.unit.gmean.1D tmp.gcor.1D) in order to compute GCOR. Those files are created in the current directory and are removed at the end of the @compute_gcor script.

Two different issues has been spotted (by looking at standard outputs for GCOR brick in soma workflow) :

This error occurs because of the file tmp.unit+orig.HEAD dos not exist

if ( ! -f $tmpunit$view.HEAD ) then
  echo "** command failure:" $cmd $inset\[$nfirst..\$]
  exit
endif

This errors occurs because the file ./tmp.unit+orig.BRIK dos not exist

In MIA the current directory is "project/derived_data" (checked by printing cwd in @compute_gcor script and by removing the suppression of the temporary files). So, when we use iteration, the temporary files are created for several subjects with the same name and in the same folder potentially at the same time. It could explain the bug.

To do : maybe it is possible to create the file in a temporary folder in derived_data (as for SPM)

manuegrx commented 1 year ago

Quick update :

Test done : change self.output_directory in the GCOR brick by added a sub folder for each subject (name_data for example) --> in this case no more errors

However we still have an issue with the initialization of self.output_directory during iteration (see https://github.com/populse/mia_processes/issues/40 ) , so I will wait until issue 40 is fixed before to fix this issue

servoz commented 1 year ago

Does closing ticket #40 also fix this issue?

manuegrx commented 1 year ago

I can make a modification the GCOR brick by added a sub folder for each subject as for the SPM stat brick. In this case the issue will be fix! However, as no files are created at the end of the GCOR brick, it will create an empty sub-folder for each subject, is it an issue ?

servoz commented 1 year ago

Please try with a real case in your side, with a freshly updated populse, then if it's ok for you, take pleasure in closing this ticket!

manuegrx commented 1 year ago

It works with these modifications, thanks !