nencki-lobi / bids-flow

Connecting orthanc, heudiconv and mriqc
1 stars 0 forks source link

Conversion crashes if multiple sessions are placed together #3

Open mslw opened 5 years ago

mslw commented 5 years ago

The problem

If two sessions for the given subject are dumped together (as is often the case in the dysleksja study), like this:

dicom_dump/subject_code/HEAD 32ch/*/*.dcm
dicom_dump/subject_code/HEAD 12ch/*/*.dcm

our heudiconv call will end with a crash:

AssertionError: Conflicting study identifiers found

and there will be no data for QC. This is similar to #1 but this time the sessions came to bite us on a different level.

Potential solution

In such cases, we could try working around it by putting {session} in the dicom directory template and running heudiconv for each session separately (unfortunately, the session has to be specified explicitly in such case):

heudiconv ... -d /data/{subject}/{session}/*/*.dcm --ses 'HEAD 32ch' ...

However (unless we use the session label in our heuristic) this will again be relying on an assumption that those session use different task names - otherwise we will be overwriting stuff.

Also, in our dicom patterns, the directory after subject seems to be the combination of date and study_description, and something like 20190314 - HEAD 32ch_NameOfPI makes a poor session name.

mslw commented 5 years ago

On an afterthought - instead of using {session} we can just put the subfolder as part of path if we are not using the session label further down (in the heuristic) -- that would seem more natural. Of course, there would still be hoping that scans won't conflict between those subfolders.

bkossows commented 5 years ago

I would rather name all the sessions according to acquisition date. It seems to be in line with bids standard.

mslw commented 5 years ago

It would be valid BIDS (for the purpose of bids-apps at least), but not very intuitive if we were to further use the nifti data (a given study would end up with as many sessions as subjects).

So I would rather try something different. But this idea is definitely worth considering.

For the dysleksja I am tempted to try and create a special case, where session name would be either 32ch or 12ch, based on dicom (sub-)folder name (if controlled in bash) or study_description (if controlled in the heuristic). We could see if it works and try to generalise from there.