#############extracting the mean and STD##############Please see the code and write your feedback. Is this look ok?Hi Paul and Niels,This is the code for WINSORIZATION with I have pulled up from initial comments and later write up. Thanks all for the help.fslmaths all_OD_skeletonised.nii.gz -mas ROI_01_mas.nii.gz -thr 0 all_OD_skeletonised_ROI_01.nii.gz fslstats all_OD_skeletonised_ROI_01.nii.gz -M > ROI_01_OD_M.txt
fslstats all_OD_skeletonised_ROI_01.nii.gz -S > ROI_01_OD_S.txt
mu=`more ROI_01_OD_M.txt`
sd=`more ROI_01_OD_S.txt`
3sd_low=`echo "mu - 3*(sd)" | bc -l`
3sd_high=`echo "mu + 3*(sd)" | bc -l`#######generation of WINSORIZED ROI ################fslmaths all_OD_skeletonised_ROI_01.nii.gz -thr 3sd_low -uthr 3sd_high all_OD_skeletonised_ROI_01_ thr.nii.gz
fslmaths all_OD_skeletonised_ROI_01.nii.gz -uthr 3sd_low all_OD_skeletonised_ROI_01_ lthr.nii.gz -bin -mul 3sd_low all_OD_skeletonised_ROI_01_ lthr.nii.gz
fslmaths all_OD_skeletonised_ROI_01.nii.gz -thr 3sd_high all_OD_skeletonised_ROI_01_ lthr.nii.gz -bin -mul 3sd_high all_OD_skeletonised_ROI_01_ uthr.nii.gz
fslmaths 3sd_high all_OD_skeletonised_ROI_01_thr.nii.gz -add all_OD_skeletonised_ROI_01_ lthr.nii.gz -add all_OD_skeletonised_ROI_01_ uthr.nii.gz all_OD_skeletonised_ROI_01_ win.nii.gz ########################Extracting mean and std from WINSORIZED ROI
fslstats all_OD_skeletonised_ROI_01_win.nii.gz -M > ROI_01_OD_M_win.txt
fslstats all_OD_skeletonised_ROI_01_win.nii.gz -M > ROI_01_OD_S_win.txt ###################END##################### Please see to it, and give your commentsKind regardssourajitOn Thu, Sep 29, 2016 at 3:18 PM, Niels Bergsland <[log in to unmask]> wrote:You could alternatively modify your previous command and use -min and -max options instead.--
On Thursday, September 29, 2016, Paul Robinson <[log in to unmask]> wrote:'lo again.Sorry, it occurs to me that the code above simply truncates your roi which is not really Winsorization. However, it should remove those voxels which are 3 sds more or less than the mean, which is an okay first step. I would use fslmaths to create separate images of those voxels which exceed mu+/-3sd (-thr/-uthr), binarize them (-bin), and then multiply them by the appropriate constraint (-mul). Then you can simply add these three rois together.Best,PaulOn Thu, Sep 29, 2016 at 9:57 AM, Paul Robinson <[log in to unmask]> wrote:Hi, SourajitSomething like this?### Or however you want to get the mean and sdmu=`more ROI_01_OD_M.txt`sd=`more ROI_01_OD_S.txt`3sd_low=`echo "mu - 3*(sd)" | bc -l`3sd_high=`echo "mu + 3*(sd)" | bc -l`fslmaths all_OD_skeletonised_ROI_01.nii.gz -thr 3sd_low -uthr 3sd_high all_OD_skeletonised_ROI_01_win .nii.gz Hope this helps,PaulOn Thu, Sep 29, 2016 at 9:44 AM, Sourajit Mitra Mustafi <[log in to unmask]> wrote:Dear admin,
I have extracted an ROI image in FSL and computed its mean, median and standard deviation for non-zero voxel using
the following option.
fslmaths all_OD_skeletonised.nii.gz -mas ROI_01_mas.nii.gz -thr 0 all_OD_skeletonised_ROI_01.nii.gz
fslstats -t all_OD_skeletonised_ROI_01.nii.gz -M > ROI_01_OD_M.txt
fslstats -t all_OD_skeletonised_ROI_01.nii.gz -S > ROI_01_OD_S.txt
fslstats -t all_OD_skeletonised_ROI_01.nii.gz -P 50 > ROI_01_OD_P.txt
Is there is any way to WINSORIZE an image for non-zero voxel in FSL. I am trying a method based on ROI analysis and for that reason winsorization of image is important. fslstats doesn't provide that option. Please help me out.
Kind regards
sourajit
Niels Bergsland
Integration Director
Buffalo Neuroimaging Analysis Center
100 High St. Buffalo NY 14203
[log in to unmask]