Dear Michael,
You are right on both counts, and the intended actions are not quite happening, although this is not that bad, which I think is why no-one has noticed it before.
The fugue line should have "--mask=FM_UD_fmap_mag_brain_mask" although this doesn't make a lot of difference as other masking fixes this later on, but it will have a subtle effect on the despiking. The existing version also does median filtering, which doesn't have a lot of effect in general, but for nice fieldmaps it is probably good to turn it off.
The fslmaths line should be as you say - we had it wrong - and so the outer edge was not being filtered correctly. For anyone using fsl_prepare_fieldmap (as we use internally) this was a moot point as this script already did the despiking, and hence this is another reason that we haven't spotted this error. However, I have now corrected these in our code base and the fixes will be rolled out in the upcoming release. Until then, feel free to correct these lines in your own version.
Thanks for bringing this to our attention.
All the best,
Mark
On 8 Aug 2012, at 18:16, Michael Hallquist wrote:
> Hi all,
>
> We recently went through some of our FEAT logs to understand better
> what processing steps are applied to the GRE fieldmap images before
> unwarping the EPI data using FUGUE. At one point in the pipeline, the
> fieldmap image is median filtered and despiked:
>
> featlib.tcl line 5082
>
> fugue --loadfmap=FM_UD_fmap --savefmap=FM_UD_fmap_tmp_fmapfilt -m
> FM_UD_fmap_mag_brain_mask --despike --despikethreshold=2.1
>
> Our first source of confusion was the effect of including
> FM_UD_fmap_mag_brain_mask in the arguments. This wasn't included using
> --mask, and -m (median filter) doesn't expect an argument. Is this an
> undocumented feature? Running with and without this the mask in the
> command line did appear to mask out of some voxels.
>
> The second issue is how the filtered/smoothed fieldmap is applied to
> the original fieldmap. The comments in featlib.tcl indicate that the
> goal is to despike edge voxels and the command provided is this:
>
> featlib.tcl line 5083
>
> fslmaths FM_UD_fmap_tmp_fmapfilt -sub FM_UD_fmap -mas
> FM_UD_fmap_mag_brain_mask_ero -add FM_UD_fmap FM_UD_fmap
>
> Looking at the logic here and the resulting images, however, I believe
> this does exactly the opposite of what is stated, smoothing the
> interior and making no changes to the edge voxels. The command
> essentially takes the smoothed image, leaves voxels within the eroded
> brain mask unchanged (-add and -sub have no effect within the mask),
> and restores the original unsmoothed voxels at the edge.
>
> I believe this is what was intended, but I wanted to check with the
> FSL group to verify that I haven't misunderstood something.
>
> fslmaths FM_UD_fmap -sub FM_UD_fmap_tmp_fmapfilt -mas
> FM_UD_fmap_mag_brain_mask_ero -add FM_UD_fmap_tmp_fmapfilt FM_UD_fmap
>
> That is, only add the smoothed fieldmap at the edge and leave the
> interior unchanged. I have attached an image of the before and after
> with the current FEAT pipeline, where I subtracted the images (areas
> that are black have no change before and after application of the
> fslmaths subtract + add + mask routine above).
>
> Thanks for your help,
> Michael
> <fmap_smoothdiff.png>
|