User Tools

Site Tools


neuroimagen:aseg2fsl
aseg.mgz to FSL

De: http://surfer.nmr.mgh.harvard.edu/fswiki/FsAnat-to-NativeAnat

<subjid> → sujeto

<study> → estudio

Convert from FreeSurfer Space Back to Native Anatomical Space:

mri_label2vol --seg $SUBJECTS_DIR/<subjid>/mri/aseg.mgz --temp $SUBJECTS_DIR/<subjid>/mri/rawavg.mgz --o $STUDY_DIR/working/subjid_tmp_aseg.mgz --regheader $SUBJECTS_DIR/<subjid>/mri/aseg.mgz

Convert from mgz to nii.gz:

mri_convert $STUDY_DIR/working/subjid_tmp_aseg.mgz $STUDY_DIR/working/subjid_tmp_aseg.nii.gz

Reorient:

fslreorient2std $STUDY_DIR/working/subjid_tmp_aseg.nii.gz $STUDY_DIR/working/subjid_aseg.nii.gz

Now, /usr/local/freesurfer/ASegStatsLUT.txt has the values for every segmented region.

<value> <name> <R> <G> <B> <A>

(my $value, my $name) = /^(\d{1,4})\s([A-Z,a-z,\-,\_]*)\s\d+\s\d+\s\d+\s\d+/

After isolate

%rois[$name]=$value

, do

fslmaths $STUDY_DIR/working/subjid_aseg.nii.gz -uthr $value -thr $value $STUDY_DIR/working/tmp_aseg_subjid/$name.nii.gz

y luego para extraer valor medio de algun funcional ya en el espacio original:

fslstats $STUDY_DIR/working/subjid_pet(or_whatever)_in_struc.nii.gz -k $STUDY_DIR/working/tmp_aseg_subjid/$name.nii.gz -m -s (-M -S)?
neuroimagen/aseg2fsl.txt · Last modified: 2020/08/04 10:58 (external edit)