Heudiconv: Automatically include "IntendedFor" field in the metadata

Dear community,
we are using heudiconv and fmriprep for preprocessing functional MRI data. As we would like to use fieldmaps to unwarp these images, the fieldmap-metadata has to include the key “IntendedFor” in order to be used with fmriprep.
Is there a way for heudiconv to automatically include this data in the metadata using the heuristic file? I have seen that the package fw-heudiconv does include it, but we would appreciate using the docker version of heudiconv.
Thank you very much for you support!
Best,
Christian

Hi Chrisitian,
Is this field required?

Christian, please see ENH: Adds populate_intended_for for fmaps by pvelasco · Pull Request #482 · nipy/heudiconv · GitHub for likely to be added approach. Please review is applicability to your data and provide feedback there.

Kodi, See Magnetic Resonance Imaging - Brain Imaging Data Structure v1.5.0 . So at the level of bids it is recommended but not required. But for fmriprep, to get them used, you do need to provide it AFAIK

Thank you , Yarik. I modified jason files by including this pair. But, it still does not validate. It is similar to :

I bet it is critically different . Paste output here

Making sure the input data is BIDS compliant (warnings can be ignored in most cases).
1: [ERR] Files with such naming scheme are not part of BIDS specification. This error is most commonly caused by typos in file names that make them not BIDS compatible. Please consult the specification and make sure your files are named correctly. If this is not a file naming issue (for example when including files not yet covered by the BIDS specification) you should include a “.bidsignore” file in your dataset (see GitHub - bids-standard/bids-validator: Validator for the Brain Imaging Data Structure for details). Please note that derived (processed) data should be placed in /derivatives folder and source data (such as DICOMS or behavioural logs in proprietary formats) should be placed in the /sourcedata folder. (code: 1 - NOT_INCLUDED)
./sub-01/fmaps/sub-01_dir-AP_run-1_epi.json
Evidence: sub-01_dir-AP_run-1_epi.json
./sub-01/fmaps/sub-01_dir-AP_run-1_epi.nii.gz
Evidence: sub-01_dir-AP_run-1_epi.nii.gz
./sub-01/fmaps/sub-01_dir-PA_run-1_epi.json
Evidence: sub-01_dir-PA_run-1_epi.json
./sub-01/fmaps/sub-01_dir-PA_run-1_epi.nii.gz
Evidence: sub-01_dir-PA_run-1_epi.nii.gz

    Please visit https://neurostars.org/search?q=NOT_INCLUDED for existing conversations about this issue.

Directory Tree

|-- ./CHANGES
|-- ./dataset_description.json
|-- ./participants.json
|-- ./participants.tsv
|-- ./README
-- ./sub-01 |-- ./sub-01/anat | |-- ./sub-01/anat/sub-01_acq-MPRAGE_T1w.json | – ./sub-01/anat/sub-01_acq-MPRAGE_T1w.nii.gz
|-- ./sub-01/dwi
| |-- ./sub-01/dwi/sub-01_acq-96dirX6b0Xmb_dwi.bval
| |-- ./sub-01/dwi/sub-01_acq-96dirX6b0Xmb_dwi.bvec
| |-- ./sub-01/dwi/sub-01_acq-96dirX6b0Xmb_dwi.json
| -- ./sub-01/dwi/sub-01_acq-96dirX6b0Xmb_dwi.nii.gz – ./sub-01/fmaps
|-- ./sub-01/fmaps/sub-01_dir-AP_run-1_epi.json
|-- ./sub-01/fmaps/sub-01_dir-AP_run-1_epi.nii.gz
|-- ./sub-01/fmaps/sub-01_dir-PA_run-1_epi.json
`-- ./sub-01/fmaps/sub-01_dir-PA_run-1_epi.nii.gz

And /sub-01/fmaps/sub-01_dir-AP_run-1_epi.json is

{
“AcquisitionMatrixPE”: 140,
“AcquisitionNumber”: 1,
“AcquisitionTime”: “13:10:37.080000”,
“BandwidthPerPixelPhaseEncode”: 10.352,
“BaseResolution”: 140,
“BodyPartExamined”: “BRAIN”,
“ConsistencyInfo”: “N4_VE11C_LATEST_20160120”,
“ConversionSoftware”: “dcm2niix”,
“ConversionSoftwareVersion”: “v1.0.20181114 GCC7.3.0”,
“DerivedVendorReportedEchoSpacing”: 0.000689998,
“DeviceSerialNumber”: “66112”,
“DwellTime”: 2.1e-06,
“EchoTime”: 0.088,
“EchoTrainLength”: 105,
“EffectiveEchoSpacing”: 0.000689998,
“FlipAngle”: 90,
“ImageComments”: “Unaliased_MB3_PE3”,
“ImageOrientationPatientDICOM”: [0.99944, 0.0330408, 0.00528444, -0.0331549, 0.956572, 0.289605],
“ImageType”: [
“ORIGINAL”,
“PRIMARY”,
“DIFFUSION”,
“NONE”,
“MB”,
“ND”
],
“ImagingFrequency”: 123.252,
“InPlanePhaseEncodingDirectionDICOM”: “COL”,
"Institution…
"InstitutionName,
“InstitutionalDepartmentName”: "Departm
“IntendedFor”:“dwi/sub-01_acq-96dirX6b0Xmb_dwi.nii.gz”,
“MRAcquisitionType”: “2D”,
“MagneticFieldStrength”: 3,
“Manufacturer”: “Siemens”,
“ManufacturersModelName”: “Prisma”,
“Modality”: “MR”,
“PartialFourier”: 0.75,
“PatientPosition”: “HFS”,
“PercentPhaseFOV”: 100,
“PhaseEncodingDirection”: “j-”,
“PhaseEncodingSteps”: 105,
“PhaseResolution”: 1,
“PixelBandwidth”: 1700,


Yarik, this dataset is at /data/QA/spacetop/data in hydra.

Should be fmap/ not fmaps/ (re hydra: away from laptop - laptop free (mostly) weekend)

PS note that we highjacked original question/discussion which isn’t good. Should have been posted as an independent new question

Thank you! That was it. validated!!!
One more thing. I checked some of the old ‘pepolar’ fieild maps, I think they are ending with _phasediff instead of _epi. Could it be a problem? We may have to fix it. We also need to figure out why heudiconv did not convert this dataset correctly as there will be many more datasets like this. Who is doing the conversion at dbic, user? After covnersion , are they usually automatically validated?

Good to have a life apart from …

As for the hijack, what do we do now?

Thank you.

Hey Kodi,
Yes, any automated and reliable solution would be highly appreciated!
Thanks!
Christian