Print

Print


Hi Zhang,

You can do this using fslstats - first, calculate the proportion of 100
voxels relative to the total size of your image:

  prop = 100 / <total number of voxels in your image>

Then use fslstats to find the percentile value at this proportion:

  fslstats <my_image> -p <100 - 100 * prop>

(Use '-a' before '-p' if you are interested in absolute values)

You can then use this percentile value as a threshold in fslmaths, to
create a mask containing the 100 voxels with the highest intensity:

  fslmaths <my_image> -thr <threshold_from_fslstats> -bin <my_mask>

Cheers,

Paul

On 7 July 2015 at 07:01, zhang mingxia <[log in to unmask]> wrote:

> Hi Iwo,
>
> I don't want to creat a sphere ROI. I want the 100 voxels with the largest
> z value in zstat.nii.gz to be the ROI mask. My question is how to find out
> the 100 voxels with largest z value in zstat.nii.gz?
>
> Thank you again!
>
> Mingxia Zhang
>
> On Mon, Jul 6, 2015 at 7:28 PM, Iwo Bohr <[log in to unmask]> wrote:
>
>> Sorry, one correction to the previous message: the coordinates of the ROI
>> central point are expressed in voxels, not in mm! (see below)
>>
>> Iwo
>>
>>
>>  ----- Forwarded Message -----
>>  *From:* Iwo Bohr <[log in to unmask]>
>> *To:* [log in to unmask]
>> *Sent:* Monday, 6 July 2015, 12:22
>> *Subject:* Re: [FSL] making mask of a fixed number of voxels of the most
>> responsive ones
>>
>> In terms of creating your ROI these two commands could be helpful:
>>
>> 1) fslmaths /usr/local/fsl/data/standard/MNI152_T1_2mm -mul 0 -add 1 -roi
>> $c1 1 $c2 1 $c3 1 0 1 ${out}point -odt float
>> 2) fslmaths ${out}point -kernel sphere $rad -fmean ${out}$name -odt float
>>
>> where:
>> $c1-$c3 are x,y,z coordinates (voxels) of the centre
>> $rad : to replaced by the radius (mm)
>>
>> The above is for creating a  ROI in the MNI space, but it could be
>> replaced by any space.
>> First command creates the centre of the ROI, second the spherical ROI
>> (centred around the point).
>>
>> Hope this helps,
>>
>> Iwo
>>
>>
>>
>>  ------------------------------
>>  *From:* zhang mingxia <[log in to unmask]>
>> *To:* [log in to unmask]
>> *Sent:* Monday, 6 July 2015, 10:39
>> *Subject:* [FSL] making mask of a fixed number of voxels of the most
>> responsive ones
>>
>> Dear FSL experts,
>>
>> I need to create a mask of the most responsive voxels. Specifically, in
>> my study , I got the z value image of one condition (e.g., zstat1.nii.gz).
>> Now, I need to create a mask of a fixed number of voxels(e.g., 100) with
>> max z value in zstat1.nii.gz. Does any one know how I can do?
>>
>> Thanks in advance!
>>
>> Mingxia Zhang
>>
>>
>>
>>
>>
>