Dear experts,
I am currently converting a dataset that have acquired a scan from different scanner for different subjects. So I have few T1w images that were mprage (named differently) and few that were spgr. Also, its 2nd and 3rd dimensions keeps varying. Please see example below. How should I define my heuristic file in this case so that it identifies my T1 correctly?
|dim1|dim2|dim3|protocol_name
|256|240|176|MP-RAGE
256|240|176|SAG MPRAGE
256|240|176|SAG MPRAGE REPEAT
|256|240|176|MP-RAGE
|256|240|352|MP-RAGE
256|256|170|MPRAGE CLEAR
|256|256|1408|Sag T1 MEMPRAGE_4e_p2_1mm_iso nomoco
|256|256|352|Sag T1 MEMPRAGE_4e_p2_1mm_iso nomoco RMS
256|256|200|3D SAG ADNI IR-SPGR
For now I have following criteria that recognizes mprages fine, but how should I also incorporate a criteria to identify spgr in the same if/else statement? Can I add both “or” and “and” criteria?
protocol = s.protocol_name.lower()
if (s.dim1 == 256) and (‘rage’ in protocol) and (‘average’ not in protocol):
info[t1w] = [s.series_id]
Thank you!
Sneha
Hi @snp2003,
Just to clarify, which T1w acquisitions in your list above pertain to which subject IDs?
Regarding you question more directly, you could do something like
protocol = s.protocol_name.lower()
> if any(x in protocol for x in [“mprage”, “spgr”]) and (“average” not in protocol):
info[t1w] = [s.series_id]
However, in your example code t1w
isn’t defined.
Thank you Dan.
T1w acquisitions I showed is for different subject IDs. There are only few subjects in the entire cohort who had both spgr and mprage sequence. Otherwise, either subjects have mprage or spgr, hence heuristic was skipping those subjects that did not identify one of them in the criteria. Thank you for your suggestion, I shall run it that way as I ended up adding another if/else statement to look for spgr if it missed mprage which is not quite elegant. I have defined keys for t1w and other acquisitions in the script as follow:
t1w = create_key('sub-{subject}/{session}/anat/sub-{subject}_{session}_T1w')
dwi = create_key('sub-{subject}/{session}/dwi/sub-{subject}_{session}_dwi')
func_rest = create_key('sub-{subject}/{session}/func/sub-{subject}_{session}_task-rest_bold')
info = {t1w: [], dwi: [], func_rest: []}
Thank you,
Sneha