I've posted a question about a strange behavior of mri_segstats if voxel size isn't 1 mm3 and --pv option is used.
I found a reason of this problem in the source code of mri_segstats.c (release_5_1_0 branch was checked out from read-only CVS source-code repository)
In mri_segstats.c the return value from MRIvoxelsInLabelWithPartialVolumeEffects is used as the number of voxels;
nhits = MRIvoxelsInLabelWithPartialVolumeEffects (seg, pvvol, StatSumTable[n].id, NULL, NULL); vol = nhits*voxelvolume;
However, MRIvoxelsInLabelWithPartialVolumeEffects in utils/mri.c returns volume (e.g. volume += vox_vol; or volume += vox_vol * pv;), not the number of voxels.
nhits value is adjusted by voxel volume in mri_segstats.c (vol = nhits*voxelvolume), so that the voxelvolume (vox_vol) is multiplied twice.
The volume reported by mri_segstats, therefore, is too small if the voxel volume is less than 1 mm^3 or too large if the voxel volume is larger than 1 mm3.
Note that this is not a problem when voxel volume is conformed to 1 mm3 (default option in recon-all).
I think many of FreeSurfer programs do not support high-resolution (< 1mm3) image without conforming to 1 mm3 voxel, but could you fix the problem of mri_segstats? I want to use mri_segstats with partial volume correction for high-resolution MRI image.
Thank you,
--Masaya
On 06/26/2012 08:40 AM, Masaya Misaki wrote:
Hello all,
I found volume size reported by mri_segstats is changed very much depending on voxel size when partial volume correction (--pv option) is used. The difference was much larger than that can be explained by the difference of image resolution. (mri_segstats version is 1.75.22 2011/4/27 in FreeSurfer v5.1.0)
When I performed segmentation for high-resolution image (voxel size = 0.5 mm^3), I found all volumes of segmented regions in aseg.stats was too small; about 8 times smaller than that was estimated from 1mm^3 conformed image.
So I tested the effect of voxel size on mri_segstats. At first, recon-all was run with conforming 1mm^3 voxel (default option). Then aseg.mgz and norm.mgz were conformed to small voxel size, and mri_segstats was applied to the conformed files:
mri_convert aseg.mgz aseg_cs05.mgz -cs 0.5 rt nearest mri_convert norm.mgz norm_cs05.mgz -cs 0.5 mri_segstats --seg aseg_cs05.mgz --pv norm_cs05.mgz \ --ctab $FREESURFER_HOME/FreeSurferColorLUT.txt \ --nonempty --excludeid 0 --sum aseg_cs05.stats
(these are just for testing the effect of voxel size, not for actual analysis)
All volumes reported in aseg_cs05.stats (for 0.5mm^3 voxel) was about 8 times smaller than aseg.stats (for 1mm^3 voxel). So the reported volume was scaled with the same ratio as the voxel size. Same effect was observed when voxel size was conformed to larger one (e.g. 1.5mm^3); reported volumes were about 3 times larger than those for 1mm^3-voxel. The number of voxels in the segmented regions (Nvoxels column in aseg.stats) were similar across different voxel sizes while voxel sizes are different.
When --pv option was not used, the reported volumes were almost the same across different voxel sizes. So the partial volume correction in mri_segstats seems to depend on voxel size.
Can I fix this with some missed options or shouldn't I use --pv option for the image with voxel size other than 1mm^3?
thanks,
-- Masaya Misaki Ph.D.
Hi Masaya, you are correct. I've put a new version here: ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/mri_segstats.linux Can you test it out? It also fixes the partial volume computation problem. thanks! doug
On 07/06/2012 02:23 PM, Masaya Misaki wrote:
I've posted a question about a strange behavior of mri_segstats if voxel size isn't 1 mm3 and --pv option is used.
I found a reason of this problem in the source code of mri_segstats.c (release_5_1_0 branch was checked out from read-only CVS source-code repository)
In mri_segstats.c the return value from MRIvoxelsInLabelWithPartialVolumeEffects is used as the number of voxels;
nhits = MRIvoxelsInLabelWithPartialVolumeEffects (seg, pvvol, StatSumTable[n].id, NULL, NULL); vol = nhits*voxelvolume;
However, MRIvoxelsInLabelWithPartialVolumeEffects in utils/mri.c returns volume (e.g. volume += vox_vol; or volume += vox_vol * pv;), not the number of voxels.
nhits value is adjusted by voxel volume in mri_segstats.c (vol = nhits*voxelvolume), so that the voxelvolume (vox_vol) is multiplied twice.
The volume reported by mri_segstats, therefore, is too small if the voxel volume is less than 1 mm^3 or too large if the voxel volume is larger than 1 mm3.
Note that this is not a problem when voxel volume is conformed to 1 mm3 (default option in recon-all).
I think many of FreeSurfer programs do not support high-resolution (< 1mm3) image without conforming to 1 mm3 voxel, but could you fix the problem of mri_segstats? I want to use mri_segstats with partial volume correction for high-resolution MRI image.
Thank you,
--Masaya
On 06/26/2012 08:40 AM, Masaya Misaki wrote:
Hello all,
I found volume size reported by mri_segstats is changed very much depending on voxel size when partial volume correction (--pv option) is used. The difference was much larger than that can be explained by the difference of image resolution. (mri_segstats version is 1.75.22 2011/4/27 in FreeSurfer v5.1.0)
When I performed segmentation for high-resolution image (voxel size = 0.5 mm^3), I found all volumes of segmented regions in aseg.stats was too small; about 8 times smaller than that was estimated from 1mm^3 conformed image.
So I tested the effect of voxel size on mri_segstats. At first, recon-all was run with conforming 1mm^3 voxel (default option). Then aseg.mgz and norm.mgz were conformed to small voxel size, and mri_segstats was applied to the conformed files:
mri_convert aseg.mgz aseg_cs05.mgz -cs 0.5 rt nearest mri_convert norm.mgz norm_cs05.mgz -cs 0.5 mri_segstats --seg aseg_cs05.mgz --pv norm_cs05.mgz \ --ctab $FREESURFER_HOME/FreeSurferColorLUT.txt \ --nonempty --excludeid 0 --sum aseg_cs05.stats
(these are just for testing the effect of voxel size, not for actual analysis)
All volumes reported in aseg_cs05.stats (for 0.5mm^3 voxel) was about 8 times smaller than aseg.stats (for 1mm^3 voxel). So the reported volume was scaled with the same ratio as the voxel size. Same effect was observed when voxel size was conformed to larger one (e.g. 1.5mm^3); reported volumes were about 3 times larger than those for 1mm^3-voxel. The number of voxels in the segmented regions (Nvoxels column in aseg.stats) were similar across different voxel sizes while voxel sizes are different.
When --pv option was not used, the reported volumes were almost the same across different voxel sizes. So the partial volume correction in mri_segstats seems to depend on voxel size.
Can I fix this with some missed options or shouldn't I use --pv option for the image with voxel size other than 1mm^3?
thanks,
-- Masaya Misaki Ph.D.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Thanks Doug! New version of mri_segstats is working fine for images with small voxels (<1mm3).
--Masaya
On 07/16/2012 09:43 AM, Douglas N Greve wrote:
Hi Masaya, you are correct. I've put a new version here: ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/mri_segstats.linux Can you test it out? It also fixes the partial volume computation problem. thanks! doug
On 07/06/2012 02:23 PM, Masaya Misaki wrote:
I've posted a question about a strange behavior of mri_segstats if voxel size isn't 1 mm3 and --pv option is used.
I found a reason of this problem in the source code of mri_segstats.c (release_5_1_0 branch was checked out from read-only CVS source-code repository)
In mri_segstats.c the return value from MRIvoxelsInLabelWithPartialVolumeEffects is used as the number of voxels;
nhits = MRIvoxelsInLabelWithPartialVolumeEffects (seg, pvvol, StatSumTable[n].id, NULL, NULL); vol = nhits*voxelvolume;
However, MRIvoxelsInLabelWithPartialVolumeEffects in utils/mri.c returns volume (e.g. volume += vox_vol; or volume += vox_vol * pv;), not the number of voxels.
nhits value is adjusted by voxel volume in mri_segstats.c (vol = nhits*voxelvolume), so that the voxelvolume (vox_vol) is multiplied twice.
The volume reported by mri_segstats, therefore, is too small if the voxel volume is less than 1 mm^3 or too large if the voxel volume is larger than 1 mm3.
Note that this is not a problem when voxel volume is conformed to 1 mm3 (default option in recon-all).
I think many of FreeSurfer programs do not support high-resolution (< 1mm3) image without conforming to 1 mm3 voxel, but could you fix the problem of mri_segstats? I want to use mri_segstats with partial volume correction for high-resolution MRI image.
Thank you,
--Masaya
On 06/26/2012 08:40 AM, Masaya Misaki wrote:
Hello all,
I found volume size reported by mri_segstats is changed very much depending on voxel size when partial volume correction (--pv option) is used. The difference was much larger than that can be explained by the difference of image resolution. (mri_segstats version is 1.75.22 2011/4/27 in FreeSurfer v5.1.0)
When I performed segmentation for high-resolution image (voxel size = 0.5 mm^3), I found all volumes of segmented regions in aseg.stats was too small; about 8 times smaller than that was estimated from 1mm^3 conformed image.
So I tested the effect of voxel size on mri_segstats. At first, recon-all was run with conforming 1mm^3 voxel (default option). Then aseg.mgz and norm.mgz were conformed to small voxel size, and mri_segstats was applied to the conformed files:
mri_convert aseg.mgz aseg_cs05.mgz -cs 0.5 rt nearest mri_convert norm.mgz norm_cs05.mgz -cs 0.5 mri_segstats --seg aseg_cs05.mgz --pv norm_cs05.mgz \ --ctab $FREESURFER_HOME/FreeSurferColorLUT.txt \ --nonempty --excludeid 0 --sum aseg_cs05.stats
(these are just for testing the effect of voxel size, not for actual analysis)
All volumes reported in aseg_cs05.stats (for 0.5mm^3 voxel) was about 8 times smaller than aseg.stats (for 1mm^3 voxel). So the reported volume was scaled with the same ratio as the voxel size. Same effect was observed when voxel size was conformed to larger one (e.g. 1.5mm^3); reported volumes were about 3 times larger than those for 1mm^3-voxel. The number of voxels in the segmented regions (Nvoxels column in aseg.stats) were similar across different voxel sizes while voxel sizes are different.
When --pv option was not used, the reported volumes were almost the same across different voxel sizes. So the partial volume correction in mri_segstats seems to depend on voxel size.
Can I fix this with some missed options or shouldn't I use --pv option for the image with voxel size other than 1mm^3?
thanks,
-- Masaya Misaki Ph.D.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
freesurfer@nmr.mgh.harvard.edu