[RESOLVED] CreateSessionInfo when one has two FieldMaps (Magnitude files)

Hi,

I’m mapping a data set from BIDS to HCP format to preprocess via qunex (legacystyle). I’m having trouble importing my field maps correctly (2 magnitude + 1 phase diff).

Here is a portion of my mapping txt file:

HCP mapping description file

----------------------------

T1w => T1w
T2w => T2w
phasediff => FM-Phase
magnitude1 => FM-Magnitude
magnitude2 => FM-Magnitude
task-rest_run-1_bold => bold:rest1
task-rest_run-2_bold => bold:rest2

However, when importing multiple FM-Magnitude files (*_magnitude1.nii.gz and *_magnitude2.nii.gz) from BIDS to HCP folder structure using CreateSessionInfo, it only maps the first fieldmap _magnitude1.nii.gz into the HCP directory ($hcpbase/unprocessed/FieldMap1/__FieldMap_Magnitude.nii.gz). *_magnitude2.nii.gz is left in the BIDS directory and doesn’t appear to be used again. The new ‘mapped’ file appears to always be identical to the *_magnitude1.nii.gz BIDS file.

I’m not sure if qunex is meant to support this functionality, but from what I understand the HCP pipelines should be able to take in a 4D fieldmap file (e.g., two fieldmaps concatenated, so dimensions of (x,y,z,2)) for distortion correction (in PreFS/hcp1). This would be run by the “FieldMapPreprocessingAll.sh” script within the PreFS pipeline.

Is there a way to make the 4D fieldmap magnitude file within Qunex for PreFS processing? The alternative is to run fslmerge outside of qunex prior to running hcp1 to appropriately map magnitude1.nii.gz + magnitude2.nii.gz => FM-Magnitude in to a 4d file in the unprocessed/ directory, and then begin hcp1.

Thanks!
Taku

Hi Taku,
we will assign a developer to this issue and will let you know once it has been resolved.

1 Like

Hi Taku,

Based on your previous post, I assume you are preprocessing Siemens data. Field map distortion correction on Siemens data requires two separate field map files, one containing the magnitude information and the other the phase difference. Here is a snippet of the usage information for the PreFreeSurferPipeline.sh.

--fmapmag=<file path>               Siemens/Philips Gradient Echo Fieldmap magnitude file
--fmapphase=<file path>             Siemens/Philips Gradient Echo Fieldmap phase file
--fmapgeneralelectric=<file path>   General Electric Gradient Echo Field Map file
                                  Two volumes in one file
                                  1. field map in deg
                                  2. magnitude

As you can see above, both Siemens and Philips data preprocessing require two separate files, while General Electric data requires a single 4D image as input.

Could you please give us more information about the two magnitude images you are using for the field map correction. Were they acquired consecutively or at different times (intended for correcting different structural scans)? Does one image contain real and the other imaginary field map components?

Hi @aleksij.kraljic,

Yes - they were acquired consecutively with two different echo times (Siemens default echo time difference is 2.46ms).

This should correspond to the parameter (that can be input into qunex as):
_hcp_echodiff : 2.46

In the PreFreSurferPipeline.sh, I believe this corresponds to this parameter:
--echodiff=<delta TE> Delta TE in ms for field map or "NONE" if not used

From what I understand, this echodiff corresponds to the difference in TEs for the two field magnitude maps. In the HCPPipelines repository, there is a global/ scripts directory where the following function is used to process FieldMaps: FieldMapPreprocessingAll.sh (HCPpipelines/FieldMapPreprocessingAll.sh at cd8f164d51cb116120b5236ac1efdb9fda66d7ed · Washington-University/HCPpipelines · GitHub)

It lists fmapmag parameter as a 4D file (line 45 onwards):

echo "            --method=<distortion correction method(SiemensFieldMap/PhilipsFieldMap/GeneralElectricFieldMap)>"
echo "            --fmapmag=<input Siemens/Philips fieldmap magnitude image - can be a 4D containing more than one>"
echo "            --fmapphase=<input Siemens/Philips fieldmap phase image - in radians>"
echo "            --fmap=<input General Electric fieldmap with fieldmap in deg and magnitude image>"
echo "            --echodiff=<echo time difference for Siemens and Philips fieldmap images (in milliseconds)>"
echo "            --ofmapmag=<output distortion corrected fieldmap magnitude image>"
echo "            --ofmapmagbrain=<output distortion-corrected brain-extracted fieldmap magnitude image>"
echo "            --ofmap=<output distortion corrected fieldmap image (rad/s)>"
echo "            [--gdcoeffs=<gradient distortion coefficients file>]"`

Let me know if there is any additional information I can provide (or if the question is unclear).

Best,
Taku

Hi @takuya.ito,

Siemens scanners acquire two separate scans with different TE from which a single image with phase difference information is computed, giving you two magnitude images, one for each TE, and a single phase image. The phase difference information is used for fieldmap distortion correction, while the magnitude image is used to create a brain mask for the phase image.

The FSL’s guide to preparing Siemens fieldmap images recommends that you select one of the magnitude scans. If you have a 4D magnitude image, the script FieldMapPreprocessingAll.sh generates a 3D magnitude image by averaging over the volumes (line 167: ${FSLDIR}/bin/fslmaths ${MagnitudeInputName} -Tmean ${ WD }/Magnitude).

This is written in the FSL Guide when using fsl_prepare_fieldmap script (called by FieldMapPreprocessingAll.sh)

Fieldmap data from a SIEMENS scanner takes the form of one phase difference image and two magnitude images (one for each echo time). In the following, where a magnitude image is required, pick the “best looking” one.

Ah, I see - thanks for the clarification. (And sorry for the confusion!)

Best,
Taku