| Author |
Topic  |
|
|
dvsmith
Advanced Member
    
USA
218 Posts |
Posted - May 04 2008 : 11:52:58 AM
|
I've been going back forth Steve Smith about the masking problem in FSL 4.0, and he's given me the code to fix it (see posts). Could this be added to the nodes? Hopefully they will integrate it into the next patch, but in the meantime people can use my fix (below).
You should follow the threads here:
http://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind0710&L=FSL&P=R63174&I=-3 http://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind0711&L=FSL&P=R41158&I=-3 http://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind0803&L=FSL&D=0&I=-3&P=18172 (Steve's fix is one of the last posts in this thread)
My fix works almost as well as Steve Smith revised code (http://fourier.biac.duke.edu/wiki/doku.php/huettel:fsl:bad_mask_fix_in_4.0).
The basic steps are below:
1. Run prestats only on your data, making sure you do not do BET and that you set the %brain/background setting to zero. I think you'll see from the FSL post above that you don't want do your anlayses using different "%brain/background" settings, so stick with something for your whole analysis.
2. You should now have a directory (ending in ‘.feat’) containing your filtered_func_data.nii.gz (i.e., your pre-processed data that has not been brain extracted) and a mean_func.nii.gz file, which is the mean functional image. 3. Now you want to make a mask based on mean_func.nii.gz image. You can do this in BET, and you can change the fractional intensity setting to make the mask bigger or smaller. 4. So, now you have a suitable mask, but your pre-processed data still isn’t "brain-extracted". To extract your brain, you simply take the mask you created in step 3 and multiply that by your filtered_func_data.nii.gz file (essentially, mask your data with the mask you made). Since the mask is binary (i.e., ones and zeros), doing this will eliminate voxels outside of the mask and leave the voxels within the masks unchanged. 5. Use the new data file in subsequent analyses like MELODIC or FEAT, but DO NOT RUN PRE-STATS AGAIN!!!.
Example of the bash code to implement the steps above:
SUBJ=$1
RUN=$2
F_VALUE=0.45 #this seems to work well. probably don't want to go above 0.55 or below 0.40
MAINDIR=${EXPERIMENT}/Analysis/Cluster/ActiveTask/$SUBJ/Prestats.1
REALOUTPUT=${MAINDIR}/${SUBJ}_prestats${RUN}.feat
cd $REALOUTPUT
BETINPUT=mean_func.nii.gz
BETOUTPUT=new
BETCMD="bet $BETINPUT $BETOUTPUT -f ${F_VALUE} -m"
eval $BETCMD
rm -f new.nii.gz #removing extraneous file created during mask creation stage
#the mask you'll want to use for multiplication is the new_mask.nii.gz file
fslmaths filtered_func_data.nii.gz -mul new_mask.nii.gz new_filtered_func_data
#deleting the old filtered_func_data.nii.gz to save space
if [ -e new_filtered_func_data.nii.gz ]; then
rm -f filtered_func_data.nii.gz
else
echo "Error on subject ${SUBJ} run ${RUN}: The new data file wasn't created, so I'm not deleting the old one..." >> mask_error.log
fi
To avoid confusion, I recommend simply updating the feat code so that we won't have to worry fixing the data in a post-hoc fashion. It's really easy to do and I've tested it on the VMware player. I'm not sure how long it will be before Steve Smith implements the fix into FSL or if he will (see posts). Not many people were complaining about the masks despite their poor quality.
Thanks, David
|
|
|
dvsmith
Advanced Member
    
USA
218 Posts |
Posted - May 06 2008 : 2:27:17 PM
|
Just to be clear, this is what the 3rd level masks look like with the default settings in FSL 4.0:
 for whatever reason, this Forum does not seem to like picture uploads, so the link to the pic is here: \\gall.dhe.duke.edu\Docs\forum_pics_tmp\badmasks.png
Please consider patching the version of the FSL on the cluster with the fix that Steve Smith provided. http://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind0803&L=FSL&D=0&I=-3&P=45864
Note that if you use either fix, you'll have to rerun your entire analysis so that all participants are ran using the same grand mean intensity settings (see post above for further details). That's probably not a problem if you're missing large regions of the brain at the third level like in the picture above -- you'll have to rerun everything anyway.
Thanks, David |
 |
|
|
josh.bizzell
BIAC Staff
   
USA
118 Posts |
Posted - May 08 2008 : 11:24:00 AM
|
I've updated FSL on all of the nodes to reflect the changes suggested by Steve Smith. Please let me know if you encounter any errors,
Josh
|
 |
|
|
dvsmith
Advanced Member
    
USA
218 Posts |
Posted - May 08 2008 : 11:47:13 AM
|
Thanks, Josh. Everyone please be aware of what Steve Smith said about doing this (see below).
Here's critical info from Steve Smith's post:
quote:
Warning: one big gotcha here relates to the 4D (aka "grand mean") intensity normalisation. This normalisation derives a single intensity scaling factor for the whole dataset, in order to make different sessions' analyses "compatible" with each other. However, this scaling factor is affected by the exact brain masking/thresholding, so it is very important NOT to mix (in second-level analyses) first-level FEAT outputs that have been created with different versions of FEAT if the preprocessing has changed (like it has between FSL3 and FSL4.0 and between FSL4.0 and the attached code). Just make sure that all first- level sessions are processed with the same version of the software.
So, as I indicated earlier, you have to rerun your first levels for this fix to work appropriately. The main thing that will get screwy is the scaling factors between subjects. I really don't think this should be a problem if you used the default settings and had huge holes in the brain at the third level.
Thanks again, David
|
 |
|
| |
Topic  |
|
|
|