tag:blogger.com,1999:blog-1405968300258104460.post9043172011838456018..comments2024-03-27T01:18:24.341-04:00Comments on Andy's Brain Blog: Creating Masks In FSLAndrew Jahnhttp://www.blogger.com/profile/16435706598096921650noreply@blogger.comBlogger89125tag:blogger.com,1999:blog-1405968300258104460.post-12377842225827293712021-11-19T13:02:59.994-05:002021-11-19T13:02:59.994-05:00Hi,
Andy, Would you please tell me how to smooth ...Hi,<br /><br />Andy, Would you please tell me how to smooth the edges of the mask? Right now, the edges are really coarse.<br /><br />Many Thanks,<br />Surensurenhttps://www.blogger.com/profile/11486579867689921309noreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-90086535851674970962020-11-13T11:14:01.922-05:002020-11-13T11:14:01.922-05:00Hi there,
You could try a more robust brain extra...Hi there,<br /><br />You could try a more robust brain extraction tool such as optiBET (https://montilab.psych.ucla.edu/fmri-wiki/optibet/), or you could use AFNI's 3dSkullStrip tool with the -avoid_eyes option. The most sophisticated way to generate a brain mask would be with fMRIPREP, which takes a long time, but generates a high-quality mask: https://andysbrainbook.readthedocs.io/en/latest/OpenScience/OS/fMRIPrep_Demo.html<br /><br />-AndyAndrew Jahnhttps://www.blogger.com/profile/16435706598096921650noreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-8595152182182266002020-08-17T13:26:03.530-04:002020-08-17T13:26:03.530-04:00Hi Andrew,
I saw that you suggested using a whole ...Hi Andrew,<br />I saw that you suggested using a whole head mask, which I assume includes the extracranial soft tissues (orbits, etc). Do you have any recommendations for how to generate that, perhaps using bet? I attempted to use fslmaths -bin but there are voxels containing signal outside the brain (and setting a -thr invariably removes some desired tissue within the head). Thanks!Anonymoushttps://www.blogger.com/profile/03249357797267344800noreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-28213384676580771732020-04-25T13:19:19.882-04:002020-04-25T13:19:19.882-04:00I was reading your article and wondered if you had...I was reading your article and wondered if you had considered creating an ebook on this subject. Your writing would sell it fast. You have a lot of writing talent. <a href="https://facemasks.uk" rel="nofollow">face masks</a><br />M. Tahahttps://www.blogger.com/profile/12045558659892762964noreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-42835122626574512722019-10-24T05:43:22.929-04:002019-10-24T05:43:22.929-04:00Hi Andy,
I was hoping you could help me. I'm u...Hi Andy,<br />I was hoping you could help me. I'm using FSLview and math to create different masks based on the Havard-oxford atlases. However, many of them are bilateral, and in some cases I only need the unilateral mask. Do you have an easy way of doing thís? THe only example I found did not work for me, but since I have found great help in your youtube tutorials I thought you might be able to help me on this matter as well. Looking forward to hearing from you.<br />Kind regards, LineLine K Johnsenhttps://www.blogger.com/profile/02429539594972945579noreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-85191028105239156852019-07-12T11:01:02.407-04:002019-07-12T11:01:02.407-04:00Hi Andy,
thank you very much for the video.
I was ...Hi Andy,<br />thank you very much for the video.<br />I was wondering if you have ever tried to register a multiregion mask to a template (like MNI space). I have tried to use FLIRT to do that (actually I registered the T1 to the MNI space and then applied the same transformation to the mask). What happens is that the values of my pre and post registration mask are not the same. Let's say I have a 15 for the insula, in the registered mask I still have 15 in the insula but I have some random 15dots a bit all over the place. <br />Do you know how I can avoid this?<br />Thank you very very much!Mariannanoreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-10064132486592434272019-05-29T09:48:50.020-04:002019-05-29T09:48:50.020-04:00Hi Andy,
Thanks for all this helpful information!...Hi Andy,<br /><br />Thanks for all this helpful information! I'm wondering if there is a way to use this approach but for a specific plane rather than for hemispheres. For example, if you have a structural mask and want to exclude everything posterior to y = 10? <br /><br />Thank you,<br />KristinAnonymoushttps://www.blogger.com/profile/13943536290218099874noreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-57659635068170542052019-05-22T15:38:11.070-04:002019-05-22T15:38:11.070-04:00Hi!
I have a mask for a very small ROI (25 voxels...Hi!<br /><br />I have a mask for a very small ROI (25 voxels) at 2mm. I would like to change resolution to 3mm. I used:<br /><br /> flirt -in 2mm_mask.nii.gz -ref 2mm_mask.nii.gz -init fsl/etc/flirtsch/ident.mat -applyisoxfm 3.0 -interp nearestneighbour -o 3mm_mask.nii.gz<br /><br />This command worked well for my other (larger) ROIs, but for this one, the resulting 3mm ROI is only 2 voxels. Of course, I expect it to shrink, but not by that magnitude. <br /><br />Is the nearestneighbour interpolation the cause? I am able to get something more logical by simply using trilinear interpolation and the thresholding and binarizing the result. However, I would like to determine the cause - I think it's small ROI + nearestneighbour method?<br /><br />Thanks for the helpful blog! <br /><br /><br />Anonymoushttps://www.blogger.com/profile/11399531704236115274noreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-65006964421669238882019-04-24T01:32:59.309-04:002019-04-24T01:32:59.309-04:00Hi Andy,
How are you?
Can you suggest me how to pe...Hi Andy,<br />How are you?<br />Can you suggest me how to perform simple threshold method to create mask on BraTS18 Brain MRI(.nii format) data?<br />There are four types of information for a patient such a flair, t1, t1ce and t2. Golam Moktader Daiyanhttps://www.blogger.com/profile/05010053312074005734noreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-84510863553903025252018-11-27T12:57:48.221-05:002018-11-27T12:57:48.221-05:00Hi Andy,
Thank you so much for this blog. It is v...Hi Andy,<br /><br />Thank you so much for this blog. It is very useful.<br />I need your help in my analysis.<br />I have created ROIs from SPM fMRI analysis, which is in nii format. <br /><br />Using Freesurfer I want to calculate the cortical volume, thickness, area and curvature of these masks. <br /><br />I ran the recon-all for all the subjects. <br />I know how to calculate these measures using DK atlas. But when I have a mask from SPM based fMRI analyses, I don't know how to extract it.<br /><br />Could you please share your thoughts on this problem.<br /><br />Thank you.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-46018152630201035382018-11-19T17:27:20.511-05:002018-11-19T17:27:20.511-05:00Hi Andy, is there any way to save the centroid of ...Hi Andy, is there any way to save the centroid of a mask as a different image in FSL? It is my understanding that you get the coordinates of the centroid of a mask using the fslstats command with the -c or -C option but is there any way to pipe this output to create a mask with a different name (essentially a single pixel mask)? Thanks!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-41730315764588550782018-08-29T14:38:39.605-04:002018-08-29T14:38:39.605-04:00Hi Andy,
These tutorials are so helpful!! I did h...Hi Andy,<br /><br />These tutorials are so helpful!! I did have a question. Would you be able to explain the difference between -thrp and -thrP? I'm running the code: fslmaths name.nii.gz -thrP 5 name_thresh, which i understand. But why does -thrp give me different results?Teran Mickensnoreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-30137207934820783722018-03-26T14:15:31.282-04:002018-03-26T14:15:31.282-04:00Hi Andy,
I was wondering whether I could create a ...Hi Andy,<br />I was wondering whether I could create a mask choosing a range of intensity values from FSLview. We are working on T1 mapping and want to create a mask for voxels with T1 intensities between 900-1100. So basically, create a mask using lower and upper threshold as 900 and 1100.<br /><br />Thanks,<br />ChaitaliChaitali...https://www.blogger.com/profile/04555402626073900502noreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-22324663717193024882018-01-26T18:17:38.565-05:002018-01-26T18:17:38.565-05:00Hi Andy,
You had previously replied to one of the ...Hi Andy,<br />You had previously replied to one of the comments above on how to transform the AAL atlases to subject space using the the inverse transformation matrix using FSL. Is it possible do the same with SPM? <br />I am trying to do this for ROI analysis of Cerebral Blood Flow (CBF) maps. I coregistered the subject's T1 weighted image to the CBF Map. Then used 'Normalize:Estimate' step to get deformation field matrix that can be used to transform T1 image to MNI space. <br />Is there a way to use the inverse of this deformation field to transform the AAL ROIs (which seems to be in MNI space) to the subject's CBF space? Sreekrishna Ramakrishna Pillainoreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-83747638226566017572017-11-22T16:08:17.993-05:002017-11-22T16:08:17.993-05:00Hey there,
The best tool for that would be AFNI&#...Hey there,<br /><br />The best tool for that would be AFNI's 3drotate command; e.g.,<br /><br />3drotate -prefix ROI_Rotated.nii -ashift 0 3 0 ROI.nii<br /><br />This would shift your ROI by 3mm in the y-direction. The arguments after the -ashift option represent the amount to shift the image in the x-, y-, and z-directions.<br /><br /><br />Best,<br /><br />-AndyAndrew Jahnhttps://www.blogger.com/profile/16435706598096921650noreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-26174748249916758872017-11-03T10:43:43.859-04:002017-11-03T10:43:43.859-04:00Hi Andy,
Thanks for maintaining this website and f...Hi Andy,<br />Thanks for maintaining this website and for your responses! Quick question, is there a way to move a binary mask by a known amount in the x, y or z direction(s)? For example, if I want to move the entire mask up by 3 pixels? Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-82156247444884402512017-09-28T13:50:30.981-04:002017-09-28T13:50:30.981-04:00Thanks Andy,
I didn't realize functional data...Thanks Andy,<br /><br />I didn't realize functional data could be used as a reference image.<br /><br />BrandonAnonymoushttps://www.blogger.com/profile/11676727871662196549noreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-4791015540115041952017-09-23T11:37:50.656-04:002017-09-23T11:37:50.656-04:00Hey Brandon,
Thanks! I try to keep things humming...Hey Brandon,<br /><br />Thanks! I try to keep things humming around here.<br /><br />To resample one image to another in FSL, I use flirt; e.g.,<br /><br />flirt -in mask.nii.gz -ref data.nii.gz -out mask_rs.nii.gz<br /><br />Where mask.nii.gz is the mask you created from Atlas Tools, and data.nii.gz is your functional data. Check the output dataset (mask_rs.nii.gz) using fslhd, and make sure that the dimensions and resolution match up.<br /><br />Best,<br /><br />-AndyAndrew Jahnhttps://www.blogger.com/profile/16435706598096921650noreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-37804383993590438552017-09-22T17:44:52.398-04:002017-09-22T17:44:52.398-04:00Hi Andy,
Great website. I have always found your ...Hi Andy,<br /><br />Great website. I have always found your tutorials very helpful!<br /><br />For a project I need to create a mask in fsl, based on Atlas Tools data, that has dimensions of 80 x 80 x 30 with a voxel resolution of 3x3x4, to match that of functional data I have.<br /><br />When I create the mask using the method you describe, I get volume dimensions of 182 x 218 x 182 and a voxel resolution of 1x1x1mm (when using a 1x1x1 standard image). I have figured out how to adjust the voxel size using fslchpixdim, but I'm not sure how to change the volume dimensions. Any suggestions?<br /><br />Thanks!<br /><br />BrandonAnonymoushttps://www.blogger.com/profile/11676727871662196549noreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-27039079555663272882017-07-28T16:16:49.498-04:002017-07-28T16:16:49.498-04:00Thanks Andy! We actually ended up creating our own...Thanks Andy! We actually ended up creating our own mask using fsleyes and an atlas as you'd wonderfully described in one of your videos. <br />Best, <br />IshaIshahttps://www.blogger.com/profile/07728289497252586506noreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-22368087198341050542017-07-27T12:07:53.230-04:002017-07-27T12:07:53.230-04:00Hi Isha,
The easiest way to do that would be to u...Hi Isha,<br /><br />The easiest way to do that would be to use AFNI's 3dWarp tool, and use the following syntax:<br /><br />3dWarp -tta2mni yourdataset.nii -prefix yourdataset_mni.nii<br /><br /><br />Best,<br /><br />-AndyAndrew Jahnhttps://www.blogger.com/profile/16435706598096921650noreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-72707930979920435412017-07-26T11:56:39.337-04:002017-07-26T11:56:39.337-04:00Update: it seems like the mask in in Talairach and...Update: it seems like the mask in in Talairach and I'd like to convert it to MNI coordinates. I have the ROI area names as well as the Talairach z coordinates. Would you know of a way to accomplish this?<br />Many thanks, <br />Isha Ishahttps://www.blogger.com/profile/07728289497252586506noreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-5420894713765028842017-07-25T21:45:33.397-04:002017-07-25T21:45:33.397-04:00Hi Andy, thanks for the awesome videos! This may b...Hi Andy, thanks for the awesome videos! This may be a ridiculous question but I have a ROI mask that is not in MNI space, that I want to use to analyze my data. Is there a way to bring this into MNI space? I don't know what structural was used to register it but it's a whole brain mask with multiple ROIs so I'm wondering if I can somehow move it to MNI space?<br />Thanks, <br />Isha Ishahttps://www.blogger.com/profile/07728289497252586506noreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-61084377533569612722017-07-10T09:14:30.230-04:002017-07-10T09:14:30.230-04:00Hi Andy,
By "combining" I mean that rat...Hi Andy,<br /><br />By "combining" I mean that rather than loading the T1 image in fslview and then adding the mask file to be able to see it on top of the T1, I want to be able to make it one file so that I can view one nifti file and it will be the T1 image with the mask on it. The reason for doing this is in ExploreDTI I can only add one .nii file, I need to view the tracts on top of both the T1 and the mask but cannot do this if they are separate files. I tried the fslmerge command but it just showed the T1 image, the same as when I used fslmaths.<br /><br />Thanks<br /><br />Zoe Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1405968300258104460.post-91147141078693632202017-07-06T15:51:14.292-04:002017-07-06T15:51:14.292-04:00Hi Zoe,
What do you mean exactly by "combini...Hi Zoe,<br /><br />What do you mean exactly by "combining" the T1 and the mask? If you mean that you want them to be in the same file, you can use a command like fslmerge to combine the two; e.g., fslmerge -t T1_mask_combined.nii T1.nii mask.nii<br /><br />This example would create a 4D dataset, with the T1 image as the first volume and the mask as the second volume.<br /><br /><br />Best,<br /><br />-AndyAndrew Jahnhttps://www.blogger.com/profile/16435706598096921650noreply@blogger.com