Dear experts,
I have used heudiconv to convert PET data to BIDS format using the following heuristics:
import os
def create_key(template, outtype=('nii.gz'), annotation_classes=None):
if template is None or not template:
raise ValueError('Template must be a valid format string')
return (template, outtype, annotation_classes)
def infotodict(seqinfo):
"""Heuristic evaluator for determining which runs belong where
allowed template fields - follow python string module:
item: index within category
subject: participant id
seqitem: run number during scanning
subindex: sub index within group
"""
pet = create_key('sub-{subject}/pet/sub-{subject}_task-rest_acq-{acq}_rec-{rec}_run-{item:02d}_pet')
info = {pet:[]}
for idx, s in enumerate(seqinfo):
if (s.dim3 == 47) and (s.TR == -1) and ('CERVEAU 3D SALENGRO' in s.protocol_name):
rectype = s.series_description.split('_')[-1]
info[pet].append({'item': s.series_id, 'acq': 'FDG', 'rec': rectype}) # append if multiple series meet criteria
# You can even put checks in place for your protocol
msg = []
if len(info[pet]) != 1: msg.append('Missing correct number of pet runs')
if msg:
raise ValueError('\n'.join(msg))
return info
However, it seems that BIDS validator didn’ t recognize the output format:
Error 1: [Code 61] QUICK_VALIDATION_FAILED
Quick validation failed - the general folder structure does not resemble a BIDS dataset. Have you chosen the right folder (with "sub-*/" subfolders)? Check for structural/naming issues and presence of at least one subject.
Have I done anything wrong ?
Thanks in advance.
Best,
Matt