AlanKuurstra / mousefMRIPrep

1 stars 0 forks source link

Feature Request: Add spatial smoothing and temporal filtering #7

Closed AlanKuurstra closed 4 years ago

AlanKuurstra commented 4 years ago

Temporal filtering could be done wtih fslmaths or feat. Are they the same?

fslmaths -bptf:
Bandpass temporal filtering; nonlinear highpass and Gaussian linear lowpass (with sigmas in volumes, not seconds); set either sigma<0 to skip that filter

FEAT:
uses a local fit of a straight line (Gaussian-weighted within the line to give a smooth response) to remove low frequency artefacts. This is preferable to sharp rolloff FIR-based filtering as it does not introduce autocorrelations into the data. Lowpass temporal filtering reduces high frequency noise by Gaussian smoothing (sigma=2.8s), but also reduces the strength of the signal of interest, particularly for single-event experiments. It is not generally considered to be helpful, so is turned off by default. By default, the temporal filtering that is applied to the data will also be applied to the model. this forum makes it clear that FEAT uses fslmaths: https://jiscmail.ac.uk/cgi-bin/webadmin?A2=FSL;5b8cace9.0902

fmriprep: Seems to do high-pass filtering using a cosine set in the GLM. non-steady-state volumes are high-pass filtered using a DCT.

Spatial filtering can be done with fsl susan or feat or fslmaths

fslmaths -s:
create a gauss kernel of sigma mm and perform mean filtering

SUSAN:
SUSAN noise reduction uses nonlinear filtering to reduce noise in an image (2D or 3D) whilst preserving the underlying structure. It does this by only averaging a voxel with local voxels which have similar intensity. https://users.fmrib.ox.ac.uk/~steve/susan/susan/node2.html#SECTION00020000000000000000

FEAT:
This is intended to reduce noise without reducing valid activation; this is successful as long as the underlying activation area is larger than the extent of the smoothing. Thus if you are looking for very small activation areas then you should maybe reduce smoothing from the default of 5mm, and if you are looking for larger areas, you can increase it, maybe to 10 or even 15mm. To turn off spatial smoothing simply set FWHM to 0. Note that the smoothing is performed via SUSAN, effectively providing Gaussian smoothing within the brain while excluding background voxels.

AlanKuurstra commented 4 years ago

Ideally spatial and temporal filtering can be done simultaneously to reduce the number of interpolations.

AlanKuurstra commented 4 years ago

Conclusion:
For spatial smoothing I think it makes sense to apply susan instead of a straight guassian filter.

For temporal filtering, I'm unsure if fsl's bandpass filter performs better or including cosines as nuisance regressors in a GLM.

Ravi asked for a bandpass filter, so I will start with that implementation.

Both FEAT and fmriprep use the order:
motion correction
slice timing correction
spatial smoothing
temporal filtering

AlanKuurstra commented 4 years ago

It is unclear how many decisions should be made for the user.

For SUSAN smoothing, fmriprep gets the usan from the mean image. They also set the brightness threshold to 75% of the median value. Should we do something similar?

In FEAT, the highpass cutoff is given for the FWHM (in seconds), but in fslmaths the highpass cutoff is given for the HWHM (in TRs). Should we do a conversion so the user can input FWHM in seconds instead of HWHM in TRs?

AlanKuurstra commented 4 years ago

For the first implementation, I think we should: 1) have the command line parameter in seconds and do the conversion to TRs before using fslmaths -bptf 2) from the fmri image provide a default value for SUSAN brightness threshold, which can then be overridden by a command line option 3) not worry about using a different usan provider (such as a mean image)

AlanKuurstra commented 4 years ago

@mklassen does this sound good?

mklassen commented 4 years ago

All units should be physical units, eg seconds and millimetres

mklassen commented 4 years ago

Use the mean image for estimating the USAN because using the actual image would result in a different usan for each time point for the voxel.

mklassen commented 4 years ago

Brightness threshold allow the user to specify percent and precentile, e.g. default to 75% or 50th percentile

AlanKuurstra commented 4 years ago

it is unclear from documentation how fsl susan deals with the n_usans option. Does it replace the intensity part of the weighted average with the new image's intensity, or does it just expand the weighted average to include the new image's intensity weighting as well as the original image's weighting?

https://johnmuschelli.com/fslr/reference/susan.html https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/SUSAN https://www.jiscmail.ac.uk/cgi-bin/wa-jisc.exe?A2=FSL;b06d31f4.1305 https://users.fmrib.ox.ac.uk/~steve/susan/susan/susan.html

AlanKuurstra commented 4 years ago

from testing: if n_usans is 0 then it uses the original image with the \<bt> option if n_usans is 1 then it replaces the original image's intensity weighting with the new image's weighting (this also renders the original \<bt> option useless) if n_usans is 2 then it replaces the original image's intensity weighting, but uses the additional images so that the weighted average contains twice as many elements (again, \<bt> is rendered useless)

AlanKuurstra commented 4 years ago

In order to find the median value (to help set the threshold for susan), we should only be looking at values inside the brain. brain extraction currently happens after preprocessing - so that the average is from a motion corrected time series. therefore we must do an initial brain extraction before calculating the median value. I'm currently using BrainSuite for this extraction because it is quick. However, it is not very robust and a thresholding operation to remove the background (rather than BrainSuite) might be better.

AlanKuurstra commented 4 years ago

In order to find the median value (to help set the threshold for susan), we should only be looking at values inside the brain. brain extraction currently happens after preprocessing - so that the average is from a motion corrected time series. therefore we must do an initial brain extraction before calculating the median value. I'm currently using BrainSuite for this extraction because it is quick. However, it is not very robust and a thresholding operation to remove the background (rather than BrainSuite) might be better.

actually, after some reflection it probably makes more sense to do brain extraction after motion correction but before other preprocessing steps like smoothing and filtering. We do not require two brain extraction steps!