help > Field mapping correction
Showing 1-11 of 11 posts
Display:
Results per page:
Feb 13, 2019  08:02 AM | Dayana Hayek - Charite Universität Medizin Berlin
Field mapping correction
Dear all, 

In CONN version 18b, there is an option to correct for field mapping. However, I want to make sure that I understood well this option:

1- So my output from the scanner are two nii files, I assume one is the phase and the other is the magnitude image. Should I merge them and load this 4D image? If yes, can I use the fslmerge or there are other better options?

2- Should I create vdm file in spm before or I just load the magnitude and phase images, and CONN automatically creates vdm?

3- where should I load these images, as far as I understood, I load them in the secondary data set, right?

Thank you so much for the help!

Dayana
Feb 14, 2019  05:02 AM | Alfonso Nieto-Castanon - Boston University
RE: Field mapping correction
 Dear Dayana,

The option to apply distortion correction was already present in previous versions as part of realignment step (in particular the preprocessing step called 'realignment & unwarp & distortion-correction') but in order to be able to use this step users needed to first go to SPM's fieldmap toolbox and manually create there a series of vdm files (voxel-displacement maps), one per subject, from their corresponding fieldmap acquisition magnitude&phase files. This was a time consuming and somewhat complicated process, so in the latest release we simply added the ability to have CONN create these vdm files directly for you from your scanner fieldmap acquisition files (this is the new preprocessing step called 'functional_vdm_create').
In order to use this new vdm-create step you simply need to:

1) define a new secondary dataset in Setup.Functionals and name/label it 'fmap'

2) enter there two files for each subject (or two files per session, if you have obtained different fieldmaps per session), the first should be the magnitude scan, and the second the phase-difference scan. You may combine those two files as a single 4d file before importing them, or you may simply select the two files when importing them in CONN's gui, whatever you find simpler. The imported files should look something like in the attached example image

and 3) running the functional_vdm_create step will create the corresponding vdm files for you, and place them in a new secondary dataset (named 'vdm') where they will be read from when you run the realignment & unwarp & distortion-correction step

Hope this helps
Alfonso


Originally posted by Dayana Hayek:
Dear all, 

In CONN version 18b, there is an option to correct for field mapping. However, I want to make sure that I understood well this option:

1- So my output from the scanner are two nii files, I assume one is the phase and the other is the magnitude image. Should I merge them and load this 4D image? If yes, can I use the fslmerge or there are other better options?

2- Should I create vdm file in spm before or I just load the magnitude and phase images, and CONN automatically creates vdm?

3- where should I load these images, as far as I understood, I load them in the secondary data set, right?

Thank you so much for the help!

Dayana
Attachment: print01.jpg
Feb 15, 2019  03:02 AM | Dayana Hayek - Charite Universität Medizin Berlin
RE: Field mapping correction
Hi Alfonso, 

Thank you so much for the quick reply!

I did exactly what you have said, but I have an error "Error using FieldMap_create (line 139); Funny number of input fieldmap images".

What I found also weird (attached pic) is that when I load the magnitude alone, it appears ok (left side of the pic) and when I load both magnitude and phase, the image changes (right side of the pic). I am not sure what is happening?

One last question, is it possible to load two image for each subject but not manually, for multiple subject? I used the ALT-select option to load functional and structural data for multiple subject, but it doesn't seem to work when there are two file for each subject.

Thanks,
Regards,

Dayana
Attachment: pic1.png
Feb 15, 2019  07:02 AM | Victoria Okuneye - University of Chicago
RE: Field mapping correction
Hi Alfonso,
I'm also interested in using the CONN fieldmap feature.
Can you further clarify the format the fieldmap images need to be in to work with CONN create vdm feature?
I'm asking because the fieldmaps come in many different forms from the scanners and I want to make sure I'm uploading the correct form.

I know you said Phase and Magnitude - Is 2 images only or can it be the short and long echo pair for Phase and Magnitude?
Also does it have to be in wrappped or unwrapped form, is there a specific range of values needed for the maps?

Best,
Victoria Okuneye
Feb 15, 2019  10:02 AM | Alfonso Nieto-Castanon - Boston University
RE: Field mapping correction
Hi Dayana,

Sorry about that, the error message was a bug in the code which was not handling your scenario correctly (you seem to have a single 4d volume containing two magnitude images, and another 3d volume containing the phasediff image). Please try the attached patch and let me know if you still run into any issues (note: this patch is for release 18b, to install it simply copy the attached file to the conn distribution folder overwriting the file with the same name there)

Regarding the image seemingly changing in the display when selecting only the magnitude volume and the magnitude+phase volumes, that is perfectly fine, it is just an issue with the intensity scaling of the display changing between the two displays (the display in the right is scaled in a way that shows both positive and negative values, while the display in the left is scaled differently since all values shown are positive). 

Last, regarding entering these files without using the GUI, you could perhaps use something like the following:

nses = 1;
for nsub = 1:numel(filenames) conn_set_functional(nsub,nses,'fmap',filenames{nsub}); end

where the variables filenames contains the list of the file pairs for each subject, so it should look something like:
  filenames = { ...
                   {'/data/subject1/magnitude.nii','/data/subject1/phase.nii'} ...
                   {'/data/subject2/magnitude.nii','/data/subject2/phase.nii'} ...
                   {'/data/subject3/magnitude.nii','/data/subject3/phase.nii'} ...
   ... etc.
                    }; 

Hope this helps
Alfonso
Originally posted by Dayana Hayek:
Hi Alfonso, 

Thank you so much for the quick reply!

I did exactly what you have said, but I have an error "Error using FieldMap_create (line 139); Funny number of input fieldmap images".

What I found also weird (attached pic) is that when I load the magnitude alone, it appears ok (left side of the pic) and when I load both magnitude and phase, the image changes (right side of the pic). I am not sure what is happening?

One last question, is it possible to load two image for each subject but not manually, for multiple subject? I used the ALT-select option to load functional and structural data for multiple subject, but it doesn't seem to work when there are two file for each subject.

Thanks,
Regards,

Dayana
Feb 15, 2019  12:02 PM | Alfonso Nieto-Castanon - Boston University
RE: Field mapping correction
Hi Victoria,

Regarding the format of fieldmap files supported by CONN's vdm_create procedure, the list of supported formats is generally available in the conn_batch help (look for "vdm_type") and it also appears in the gui after selecting this preprocessing step in the menu named "fieldmap type". Currently we support:

1) one magnitude image and one phase difference image
2) two magnitude images and one phase difference image
3) four images containing the real and imaginary parts of the short and long echo acquisitions
and 4) a single image containing a pre-calculated and unwrapped fieldmap map (typically in Hz units, but also supported rad/s or tesla units as long as the correct units are specified in the 'Units' field of an accompanying json file)

When using phase difference images these are automatically scaled and unwrapped by SPM algorithm (so they can be in any arbitrary units and they do not need to be previously unwrapped)

I believe these are some of the most common formats/scenarios, but please do let me know if you run into other scenarios as I will be happy to add other variants here to try to make this procedure as helpful and general as possible

Best
Alfonso
Originally posted by Victoria Okuneye:
Hi Alfonso,
I'm also interested in using the CONN fieldmap feature.
Can you further clarify the format the fieldmap images need to be in to work with CONN create vdm feature?
I'm asking because the fieldmaps come in many different forms from the scanners and I want to make sure I'm uploading the correct form.

I know you said Phase and Magnitude - Is 2 images only or can it be the short and long echo pair for Phase and Magnitude?
Also does it have to be in wrappped or unwrapped form, is there a specific range of values needed for the maps?

Best,
Victoria Okuneye
Feb 20, 2019  06:02 AM | Dayana Hayek - Charite Universität Medizin Berlin
RE: Field mapping correction
Hi Alfonso, 

Thank you so much!

I ran it and it worked. However, the results look weird. From my understanding of field mapping correction, is to correct for distortions to avoid drop out or signal loss that is most prevalent in the frontal lobe. So ideally, after field mapping correction, frontal lobes should look better and not worse. But in my results, as if frontal lobe is trimmed (attached pic). Could it be a problem of the sequence we acquired? or is there any other technical reason?

Thanks in advance for your support,

Best,
Dayana 
Originally posted by Alfonso Nieto-Castanon:
Hi Dayana,

Sorry about that, the error message was a bug in the code which was not handling your scenario correctly (you seem to have a single 4d volume containing two magnitude images, and another 3d volume containing the phasediff image). Please try the attached patch and let me know if you still run into any issues (note: this patch is for release 18b, to install it simply copy the attached file to the conn distribution folder overwriting the file with the same name there)

Regarding the image seemingly changing in the display when selecting only the magnitude volume and the magnitude+phase volumes, that is perfectly fine, it is just an issue with the intensity scaling of the display changing between the two displays (the display in the right is scaled in a way that shows both positive and negative values, while the display in the left is scaled differently since all values shown are positive). 

Last, regarding entering these files without using the GUI, you could perhaps use something like the following:

nses = 1;
for nsub = 1:numel(filenames) conn_set_functional(nsub,nses,'fmap',filenames{nsub}); end

where the variables filenames contains the list of the file pairs for each subject, so it should look something like:
  filenames = { ...
                   {'/data/subject1/magnitude.nii','/data/subject1/phase.nii'} ...
                   {'/data/subject2/magnitude.nii','/data/subject2/phase.nii'} ...
                   {'/data/subject3/magnitude.nii','/data/subject3/phase.nii'} ...
   ... etc.
                    }; 

Hope this helps
Alfonso
Originally posted by Dayana Hayek:
Hi Alfonso, 

Thank you so much for the quick reply!

I did exactly what you have said, but I have an error "Error using FieldMap_create (line 139); Funny number of input fieldmap images".

What I found also weird (attached pic) is that when I load the magnitude alone, it appears ok (left side of the pic) and when I load both magnitude and phase, the image changes (right side of the pic). I am not sure what is happening?

One last question, is it possible to load two image for each subject but not manually, for multiple subject? I used the ALT-select option to load functional and structural data for multiple subject, but it doesn't seem to work when there are two file for each subject.

Thanks,
Regards,

Dayana
Attachment: pic2.png
Feb 20, 2019  07:02 AM | Alfonso Nieto-Castanon - Boston University
RE: Field mapping correction
Hi Dayana,

It could be a problem with the sequence itself, but perhaps most likely it might just be a mis-specification of the acquisition parameters, since those effectively control the scale and directionality of the applied spatial correction. The general tips are:

1) if you see that the correction seems to be doing just the opposite of what it "should" do (e.g something that looked compressed along the phase-encoded direction before the correction, now it looks even more compressed after the correction) then that might indicate an incorrect BLIP direction specification, so simply try again but now switching the BLIP directionality (if you used -1 switch to +1, and viceversa)

2) if you see that the correction seems to go in the correct direction, but either doing too much or too little (e.g. something that looked compressed along the phase-encoded direction before the correction, now it looks too elongated after the correction) that might indicate an incorrect timing information. Double-check your First- and Second- echo time values (these are values specific to your fieldmap sequence, and often vendor-specific) and your EPI total readout time (this is a value specific to your functional sequence). A common mistake here, for example, is to enter the total readout time of your fieldmap acquisition instead of the value of your actual EPI / functional-data acquisition, as those are often widely different values. If in doubt, check the original DICOM files to look for those values, and/or use dcm2niix to attempt to extract that information automatically and save it to sidecar .json files (which then CONN can read). 

Hope this helps
Alfonso 


Originally posted by Dayana Hayek:
Hi Alfonso, 

Thank you so much!

I ran it and it worked. However, the results look weird. From my understanding of field mapping correction, is to correct for distortions to avoid drop out or signal loss that is most prevalent in the frontal lobe. So ideally, after field mapping correction, frontal lobes should look better and not worse. But in my results, as if frontal lobe is trimmed (attached pic). Could it be a problem of the sequence we acquired? or is there any other technical reason?

Thanks in advance for your support,

Best,
Dayana 
Originally posted by Alfonso Nieto-Castanon:
Hi Dayana,

Sorry about that, the error message was a bug in the code which was not handling your scenario correctly (you seem to have a single 4d volume containing two magnitude images, and another 3d volume containing the phasediff image). Please try the attached patch and let me know if you still run into any issues (note: this patch is for release 18b, to install it simply copy the attached file to the conn distribution folder overwriting the file with the same name there)

Regarding the image seemingly changing in the display when selecting only the magnitude volume and the magnitude+phase volumes, that is perfectly fine, it is just an issue with the intensity scaling of the display changing between the two displays (the display in the right is scaled in a way that shows both positive and negative values, while the display in the left is scaled differently since all values shown are positive). 

Last, regarding entering these files without using the GUI, you could perhaps use something like the following:

nses = 1;
for nsub = 1:numel(filenames) conn_set_functional(nsub,nses,'fmap',filenames{nsub}); end

where the variables filenames contains the list of the file pairs for each subject, so it should look something like:
  filenames = { ...
                   {'/data/subject1/magnitude.nii','/data/subject1/phase.nii'} ...
                   {'/data/subject2/magnitude.nii','/data/subject2/phase.nii'} ...
                   {'/data/subject3/magnitude.nii','/data/subject3/phase.nii'} ...
   ... etc.
                    }; 

Hope this helps
Alfonso
Originally posted by Dayana Hayek:
Hi Alfonso, 

Thank you so much for the quick reply!

I did exactly what you have said, but I have an error "Error using FieldMap_create (line 139); Funny number of input fieldmap images".

What I found also weird (attached pic) is that when I load the magnitude alone, it appears ok (left side of the pic) and when I load both magnitude and phase, the image changes (right side of the pic). I am not sure what is happening?

One last question, is it possible to load two image for each subject but not manually, for multiple subject? I used the ALT-select option to load functional and structural data for multiple subject, but it doesn't seem to work when there are two file for each subject.

Thanks,
Regards,

Dayana
Feb 20, 2019  08:02 AM | Dayana Hayek - Charite Universität Medizin Berlin
RE: Field mapping correction
Well, I did the common mistake and put the total readout timing of the field mapping and not the BOLD :) Now it works perfectly fine!
Thank you so much :)

Best,
Dayana 
Originally posted by Alfonso Nieto-Castanon:
Hi Dayana,

It could be a problem with the sequence itself, but perhaps most likely it might just be a mis-specification of the acquisition parameters, since those effectively control the scale and directionality of the applied spatial correction. The general tips are:

1) if you see that the correction seems to be doing just the opposite of what it "should" do (e.g something that looked compressed along the phase-encoded direction before the correction, now it looks even more compressed after the correction) then that might indicate an incorrect BLIP direction specification, so simply try again but now switching the BLIP directionality (if you used -1 switch to +1, and viceversa)

2) if you see that the correction seems to go in the correct direction, but either doing too much or too little (e.g. something that looked compressed along the phase-encoded direction before the correction, now it looks too elongated after the correction) that might indicate an incorrect timing information. Double-check your First- and Second- echo time values (these are values specific to your fieldmap sequence, and often vendor-specific) and your EPI total readout time (this is a value specific to your functional sequence). A common mistake here, for example, is to enter the total readout time of your fieldmap acquisition instead of the value of your actual EPI / functional-data acquisition, as those are often widely different values. If in doubt, check the original DICOM files to look for those values, and/or use dcm2niix to attempt to extract that information automatically and save it to sidecar .json files (which then CONN can read). 

Hope this helps
Alfonso 


Originally posted by Dayana Hayek:
Hi Alfonso, 

Thank you so much!

I ran it and it worked. However, the results look weird. From my understanding of field mapping correction, is to correct for distortions to avoid drop out or signal loss that is most prevalent in the frontal lobe. So ideally, after field mapping correction, frontal lobes should look better and not worse. But in my results, as if frontal lobe is trimmed (attached pic). Could it be a problem of the sequence we acquired? or is there any other technical reason?

Thanks in advance for your support,

Best,
Dayana 
Originally posted by Alfonso Nieto-Castanon:
Hi Dayana,

Sorry about that, the error message was a bug in the code which was not handling your scenario correctly (you seem to have a single 4d volume containing two magnitude images, and another 3d volume containing the phasediff image). Please try the attached patch and let me know if you still run into any issues (note: this patch is for release 18b, to install it simply copy the attached file to the conn distribution folder overwriting the file with the same name there)

Regarding the image seemingly changing in the display when selecting only the magnitude volume and the magnitude+phase volumes, that is perfectly fine, it is just an issue with the intensity scaling of the display changing between the two displays (the display in the right is scaled in a way that shows both positive and negative values, while the display in the left is scaled differently since all values shown are positive). 

Last, regarding entering these files without using the GUI, you could perhaps use something like the following:

nses = 1;
for nsub = 1:numel(filenames) conn_set_functional(nsub,nses,'fmap',filenames{nsub}); end

where the variables filenames contains the list of the file pairs for each subject, so it should look something like:
  filenames = { ...
                   {'/data/subject1/magnitude.nii','/data/subject1/phase.nii'} ...
                   {'/data/subject2/magnitude.nii','/data/subject2/phase.nii'} ...
                   {'/data/subject3/magnitude.nii','/data/subject3/phase.nii'} ...
   ... etc.
                    }; 

Hope this helps
Alfonso
Originally posted by Dayana Hayek:
Hi Alfonso, 

Thank you so much for the quick reply!

I did exactly what you have said, but I have an error "Error using FieldMap_create (line 139); Funny number of input fieldmap images".

What I found also weird (attached pic) is that when I load the magnitude alone, it appears ok (left side of the pic) and when I load both magnitude and phase, the image changes (right side of the pic). I am not sure what is happening?

One last question, is it possible to load two image for each subject but not manually, for multiple subject? I used the ALT-select option to load functional and structural data for multiple subject, but it doesn't seem to work when there are two file for each subject.

Thanks,
Regards,

Dayana
Feb 21, 2019  06:02 PM | Zhaoxia Qin
RE: Field mapping correction
Dear, Alfonso:
I meet some problem,when conducted field mapping correction.
ERROR DESCRIPTION:

Error using conn_setup_preproc (line 2433)
insufficient information for vdm creation. Skipping subject 1 session 1...
Error in conn (line 1081)
ok=conn_setup_preproc('',varargin{2:end});
Error in conn_menumanager (line 120)
feval(CONN_MM.MENU{n0}.callback{n1}{1},CONN_MM.MENU{n0}.callback{n1}{2:end});
I wonder where is the problem
Thank you!
zhaoxia
Attachment: fileld_mapping.zip
16 hours ago | Boris Rauchmann - LMU
RE: Field mapping correction
Dear Alfonso,

I was struggling finding your third step "functional_vdm_create". How does it work? I successfully selected the magnitude and the phasediff image but I was wondering how to go on. could You please help me?


Best regards,
Boris R.