User Tools

Site Tools


mbstring extension must be loaded in order to run mPDF
neuroimagen:pet_any_roi

Como sacar el SUVR de cualquier ROI en PET

El analisis PET(amiloide) actual se basa el la ROI especifica utilizada para calcular el Centiloide. No obstante, suponiendo que querramos sacar el SUVR en alguna otra ROI, tambien se puede implementar sin demasiada complejidad.

Este metodo esta basado en el nuevo pipeline para PET(tau). Solo hay que cambiar el tipo de input, las ROI y ROR y poco mas. El analisis no difire nada sea el PET que sea. :-O

Registro a T1w

apet_reg.sh
#!/bin/sh
 
study=$1
shift
id=$1
shift
wdir=$1
shift
src=$1
shift
 
td=${wdir}'/.tmp_'${id}
if [ ! -d "$td" ]; then
        mkdir $td
fi
debug=0
${FREESURFER_HOME}/bin/mri_convert --in_type mgz --out_type nii ${SUBJECTS_DIR}/${study}_${id}/mri/rawavg.mgz ${wdir}/${id}_struc.nii.gz
${FSLDIR}/bin/fslsplit ${src} ${td}/${id}_piece_ -t
for x in ${td}/${id}_piece_*; do
        ${ANTS_PATH}/antsRegistrationSyNQuick.sh -d 3 -f ${wdir}/${id}_struc.nii.gz -m ${x} -t a -o ${x%.nii.gz}_movingToFixed_;
        ${ANTS_PATH}/antsApplyTransforms -d 3 -r ${wdir}/${id}_struc.nii.gz -i ${x} -t ${x%.nii.gz}_movingToFixed_0GenericAffine.mat -o ${x%.nii.gz}_reg.nii.gz;
done
a=`for i in ${td}/*_reg.nii.gz; do echo " $i"; done`
${FSLDIR}/bin/fslmerge -t ${td}/${id}_corr.nii.gz $a
${FSLDIR}/bin/fslmaths ${td}/${id}_corr.nii.gz -Tmean ${wdir}/${id}_pet.nii.gz
if [ $debug = 0 ] ; then
    rm -rf ${td}/*_piece_*
fi

Report

Mascaras

                foreach my $roi (@rois){
                        $ptask{'output'} = $outdir.'/pet_roi_'.$roi.'_'.$subject;
                        $ptask{'filename'} = $outdir.'/'.$subject.'_roi_'.$roi.'.sh';
                        $ptask{'command'} = $ENV{'PIPEDIR'}.'/bin/get_proi.sh '.$study.'_'.$subject.' '.$w_dir.'/.tmp_'.$subject.' '.$roi;
                        $mask_chain.= $w_dir.'/.tmp_'.$subject.'/rois/'.$roi.'.nii.gz ';
                        send2slurm(\%ptask);
                }
                #Hacer mascara de cerebelo
                $ptask{'output'} = $outdir.'/pet_cgm_'.$subject;
                $ptask{'filename'} = $outdir.'/'.$subject.'_cgm.sh';
                $ptask{'command'} = $ENV{'PIPEDIR'}.'/bin/get_cbgm.sh '.$study.'_'.$subject.' '.$w_dir.'/.tmp_'.$subject;
                $mask_chain.= $w_dir.'/.tmp_'.$subject.'/rois/cerebgm.nii.gz';
                send2slurm(\%ptask);
                #Juntar todas las mascaras en un 4D
                $ptask{'output'} = $outdir.'/pet_merge_'.$subject;
                $ptask{'filename'} = $outdir.'/'.$subject.'_merge.sh';
                $ptask{'command'} = $ENV{'FSLDIR'}.'/bin/fslmerge -t '.$w_dir.'/'.$subject.'_masks '.$mask_chain;
                #$ptask{'mailtype'} = 'FAIL,END';
                $ptask{'dependency'} = 'singleton';
                my $mjob_id = send2slurm(\%ptask);
get_proi.sh
#!/bin/sh
subject=$1
shift
 
tmp_dir=$1
shift
 
roi=$1
shift
 
if [ ! -f ${tmp_dir}/rois/register.dat ]; then
        mkdir -p ${tmp_dir}/rois/;
        tkregister2 --mov $SUBJECTS_DIR/${subject}/mri/rawavg.mgz --noedit --s ${subject} --regheader --reg ${tmp_dir}/rois/register.dat;
        sleep 10;
fi
if [ ! -f ${tmp_dir}/all_aseg.nii.gz ]; then
        mri_label2vol --seg $SUBJECTS_DIR/${subject}/mri/aparc+aseg.mgz --temp $SUBJECTS_DIR/${subject}/mri/rawavg.mgz --o ${tmp_dir}/all_aseg.nii.gz --reg ${tmp_dir}/rois/register.dat;
        sleep 10;
fi
mkdir ${tmp_dir}/rois/${roi};
for x in `cat ${PIPEDIR}/lib/pet/${roi}.roi`; do
        sleep 10;
        rlabel=$(echo ${x} | awk -F"," '{print $1}');
        nlabel=$(echo ${x} | awk -F"," '{print $2}');
        ${FSLDIR}/bin/fslmaths ${tmp_dir}/all_aseg.nii.gz -uthr ${rlabel} -thr ${rlabel} -div ${rlabel} ${tmp_dir}/rois/${roi}/${nlabel};
done
a=$(for x in ${tmp_dir}/rois/${roi}/*.nii.gz; do echo "${x} -add "; done)
a=$(echo ${a} | sed 's/\(.*\)-add$/\1/')
${FSLDIR}/bin/fslmaths ${a} ${tmp_dir}/rois/${roi}

Normalizacion

PVC

Metricas

neuroimagen/pet_any_roi.txt · Last modified: 2021/05/16 16:51 by osotolongo