Hello All,
I have run into an error that I have had trouble figuring out: when I use fslmaths to make a sphere with radius greater than 10, the output image looks terrible (sphere ghosting and noise). Making a sphere less than radius 10 or less causes no problem. I have tried this with multiple point masks and filtering operations with the same result. For example:
This works fine:
fslmaths point_mask_test -kernel sphere 10 -fmean -bin sphere_mask_test_10mm
However, this produces noise:
fslmaths point_mask_test -kernel sphere 11 -fmean -bin sphere_mask_test_11mm
The point_mask.nii.gz image was generated through the procedure described below.
Any ideas? Thanks for your advice.
Cheers,
ted
Hi,
Actually it will also work if you just put -odt float on the second fslmaths
command and leave it off the first one. Creating point_mask is not so much
as problem as it not being able to save sphere_mask with floating point
numbers. I often force everything to be floating point just to avoid such
problems, although occasionally it is handy to use the rounding/truncation
offered by integer types.
All the best,
Mark
John Herrington wrote:
> Hi,
>
> I tried your suggestion as well as the one just posted by Martin, and
> they both worked, presumably for the same reason - the need to do
> floating-point calculations to avoid things averaging to zero. Here's
> a slightly modified version of Martin's commands (here, including the
> -bin flag in the second command):
>
> fslmaths thresh_zstat1.nii.gz -roi 50 1 50 1 50 1 0 1 point_mask
> fslmaths point_mask -kernel sphere 10 -fmean -bin sphere_mask
>
> And here's a working version of the command I way trying, including
> Mark's suggestions:
>
> fslmaths MNI152_T1_2mm_brain_mask -roi 50 1 50 1 50 1 0 1 point_mask
> -odt float
> fslmaths point_mask -kernel sphere 10 -fmean -bin sphere_mask
>
> So all is well here. One thing I gather from this approach to making
> spherical ROIs is that the initial input to fslmaths is more relevant
> to the procedure than I realized (i.e., whether the image input it has
> data within the ROI area, and whether it's floating point), even if
> don't really care about that image and all I want to do is make a
> sphere in a 3D space.
>
> Thanks!
>
> John
>
> Mark Jenkinson wrote:
>> Hi,
>>
>> Problem is that the input image is integer and so it tries to write
>> an output image that is integer too, but rounds down values to zero.
>>
>> Try adding -odt float at the end of your fslmaths commands. That
>> should make it work for the MNI152_T1_2mm_brain_mask as well
>> as the float images like zstat.
>>
>> All the best,
>> Mark
>>
>> P.S. Note that the kernels in fslmaths sum to 1, and hence their
>> individual voxel values are less than one.
>>
>>
>>
>> Martin M Monti wrote:
>>> John,
>>>
>>> ha, that's true. On the other hand, try that same syntax with a
>>> thresh_zstat*.nii.gz image. Does it work? (It does on my side --
>>> provided the voxel you pick is active in the thresh_zstat you pick..).
>>>
>>> So I dunno what the problem is, but I'd presume something to do with
>>> the voxel size or resolution and the like?
>>>
>>> let me know if that works..
>>>
>>> for completeness, here is the syntax I've been successfully using
>>> (all the $... are just variabls, so ignore them..):
>>>
>>> fslmaths ../thresh_zstat1.nii.gz -roi $x 1 $y 1 $z 1 0 1
>>> ${sub}_SMA_sphere
>>> fslmaths ${sub}_SMA_sphere -kernel sphere 10 -fmean ${sub}_SMA_sphere
>>>
>>> fslmaths ${sub}_SMA_sphere -bin ${sub}_SMA_sphere
>>>
>>> cheers
>>>
>>> martin
>>>
>>>
>>> John Herrington wrote:
>>>> Hi Martin,
>>>>
>>>> Thanks much for your input. Just tried the following, including
>>>> your revised second line:
>>>>
>>>> fslmaths MNI152_T1_2mm_brain_mask -roi 50 1 50 1 50 1 0 1 point_mask
>>>> fslmaths point_mask -kernel sphere 10 -fmean sphere_mask
>>>>
>>>> ... and the final image (sphere_mask) is empty, as demonstrated on
>>>> visual inspection and using fslstats (like so):
>>>>
>>>> > fslstats sphere_mask -R
>>>> 0.000000 0.000000
>>>>
>>>> Any ideas why?
>>>>
>>>> Thank again - John
>>>>
>>>> Martin M Monti wrote:
>>>>> Hi John,
>>>>>
>>>>> your second command may be incorrect. Try
>>>>>
>>>>> > fslmaths point_mask -kernel sphere 10 -fmean sphere_mask
>>>>>
>>>>> cheers
>>>>>
>>>>> martin
>>>>>
>>>>>
>>>>> John Herrington wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I'm having trouble getting the syntax right to implement the
>>>>>> strategy written about below (a prior listserv email) for making
>>>>>> a spherical ROI mask. I've based the commands off of this email
>>>>>> and the syntax output of fslmaths. For example, I tried the
>>>>>> following commands to make a 10x10x10mm sphere around point
>>>>>> 50,50,50 in matrix space like so:
>>>>>>
>>>>>> fslmaths MNI152_T1_2mm_brain_mask -roi 50 1 50 1 50 1 0 1 point_mask
>>>>>> fslmaths point_mask -kernel sphere 10x10x10 -fmean sphere_mask
>>>>>>
>>>>>> The creation of the roi (the first command) works great, but not
>>>>>> the second command. I've tried a number of variations of the
>>>>>> above syntax, including putting everything into one fslmaths
>>>>>> command, but all I get for final output is either a single point
>>>>>> ROI (i.e., the original point_mask above) or a null image.
>>>>>>
>>>>>> Could someone point me to the right command/syntax for
>>>>>> implementing this? I'm running it on Ubuntu Gutsy, FSL version
>>>>>> 4.0.3-2.
>>>>>>
>>>>>> Thanks - John
>>>>>>
>>>>>> Mark Jenkinson wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> It isn't possible to save an image that is not rectangular.
>>>>>>> But you can certainly mask an image by making everything zero
>>>>>>> outside a
>>>>>>> spherical region. The best way is to make a spherical mask and
>>>>>>> then
>>>>>>> just mask with this. To do that I recommend making an image
>>>>>>> with the
>>>>>>> everything zero except the centre voxel (you can easily do this
>>>>>>> with
>>>>>>> the -roi option in fslmaths) and then use the -kernel sphere option
>>>>>>> in fslmaths together with -fmean to turn this single voxel into a
>>>>>>> sphere. You can then (separately) use this result to mask your
>>>>>>> image
>>>>>>> in fslmaths.
>>>>>>>
>>>>>>> All the best,
>>>>>>> Mark
>>>>>>>
>>>>>>>
>>>>>>> On 18 Feb 2008, at 18:03, Martin M Monti wrote:
>>>>>>>
>>>>>>>> Hi, I know you can use fslroi to create cubic or similar ROIs
>>>>>>>> -- using it in its first form -- is there a way to produce a
>>>>>>>> spherical ROI, specifying the center in voxels/mm and a radius
>>>>>>>> -- for example?
>>>>>>>>
>>>>>>>> cheers
>>>>>>>>
>>>>>>>> martin
>>>>>>>>
>>>>>>>
>>>>>
>>>
>>
|