Deep-MI / FastSurfer

PyTorch implementation of FastSurferCNN
Apache License 2.0
452 stars 119 forks source link

Corresponding Stats output of FastSurfer to "Recon-all" #546

Open MeIngBest opened 1 month ago

MeIngBest commented 1 month ago

Dear all,

in the Stats folder after running FastSurfer I have the following files:

-rw-r--r-- 1 stn stn 12703 Jul 13 19:25 aseg+DKT.stats
-rw-r--r-- 1 stn stn  9736 Jul 14 04:17 aseg.presurf.hypos.stats
-rw-rw-r-- 1 stn stn  9533 Jul 14 03:53 aseg.stats
-rw-r--r-- 1 stn stn  1719 Jul 14 03:28 brainvol.stats
-rw-r--r-- 1 stn stn  5054 Jul 13 19:26 cerebellum.CerebNet.stats
-rw-r--r-- 1 stn stn  6377 Jul 14 03:19 lh.aparc.DKTatlas.mapped.stats
-rw-r--r-- 1 stn stn  4339 Jul 14 05:06 lh.BA_exvivo.stats
-rw-r--r-- 1 stn stn  4367 Jul 14 05:06 lh.BA_exvivo.thresh.stats
-rw-rw-r-- 1 stn stn 16429 Jul 14 02:55 lh.curv.stats
-rw-r--r-- 1 stn stn  6012 Jul 14 03:20 lh.w-g.pct.stats
-rw-r--r-- 1 stn stn  6268 Jul 14 03:20 rh.aparc.DKTatlas.mapped.stats
-rw-r--r-- 1 stn stn  4339 Jul 14 05:06 rh.BA_exvivo.stats
-rw-r--r-- 1 stn stn  4367 Jul 14 05:06 rh.BA_exvivo.thresh.stats
-rw-rw-r-- 1 stn stn 16494 Jul 14 03:11 rh.curv.stats
-rw-r--r-- 1 stn stn  5882 Jul 14 03:20 rh.w-g.pct.stats
-rw-r--r-- 1 stn stn 10327 Jul 14 05:06 wmparc.DKTatlas.mapped.stats

With the conventional freesurfer command "recon-all" I could extract the information of volume, mean curvature and cortical thickess of the results with these commands.

aparcstats2table --subjects `cat done.txt` --hemi rh  --meas thickness  --tablefile rh_aparc_stats_thickness.txt --skip
aparcstats2table --subjects `cat done.txt` --hemi lh  --meas thickness --tablefile lh_aparc_stats_thickness.txt --skip
aparcstats2table --subjects `cat done.txt` --hemi rh  --meas meancurv  --tablefile rh_aparc_stats_meancurv.txt --skip
aparcstats2table --subjects `cat done.txt` --hemi lh  --meas meancurv  --tablefile lh_aparc_stats_meancurv.txt --skip
aparcstats2table --subjects `cat done.txt` --hemi rh  --meas area  --tablefile rh_aparc_stats_area.txt --skip
aparcstats2table --subjects `cat done.txt` --hemi lh  --meas area  --tablefile lh_aparc_stats_area.txt --skip
aparcstats2table --subjects `cat done.txt` --hemi rh  --meas volume  --tablefile rh_aparc_stats_volume.txt --skip
aparcstats2table --subjects `cat done.txt` --hemi lh  --meas volume --tablefile lh_aparc_stats_volume.txt --skip
asegstats2table --subjects `cat done.txt` --meas volume --tablefile aseg_stats.txt --skip

Which Stats output of FastServer does now correspond to the thickness, meancurv and volume output of recon-all freesurfer?

dkuegler commented 1 month ago

Generally, the file naming conventions between FreeSurfer and FastSurfer are the same. So you should be able to run the same commands with FastSurfer outputs as with FreeSurfer outputs.

Here, I would recommend to use change --subjects `cat done.txt` to --subjectsfile done.txt (assuming done.txthas one subject per line). You also need to make sure the SUBJECTS_DIR enviroment variable is set correctly.

MeIngBest commented 1 month ago

Thanks a lot for the answer. After running recon-all with freesurfer I have a lot more files in the surf folder e.g.

Bildschirmfoto 2024-07-15 um 13 51 22

as after running FastSurfer (files mentioned above). Do I need to give extra arguments to FastSurfer to get the same results?

I currently use


..
 --fs_license /fs_license/license.txt \
           --t1 /xy.nii \
           --sid xy --sd /output \
           --parallel --3T

with no extra arguments.

dkuegler commented 1 month ago

The thickness, curvature, etc. information is stored in the {rh,lh}.{thick,curv,... } files. The other files produced by FreeSurfer mostly concern other segmentation protocols (like a2009s -- FastSurfer only generates the aparc.DKTatlas surface segmentation) or smoothing of statistics (see fwhm).

I am not really sure, why you generated this many smoothed statistics in your reference run, but generally this is not the default FreeSurfer behavior. In any way, it is not necessary to have this statistic.

So I would expect you do not need to manually create other atlas-surface segmentations (call mris_ca_label) as your command only processes the default (--parc <...>not specified).

MeIngBest commented 1 month ago

I see.

But in the stats output of FastSurfer is no e.g. rh.aparc.stats and running:


aparcstats2table --subjects xy/ --hemi rh  --meas thickness  --tablefile rh_aparc_stats_thickness.tx
SUBJECTS_DIR : /FastSurfer
Parsing the .stats files

ERROR: Cannot find stats file /FastSurfer/xy/stats/rh.aparc.stats

(paths are correct)

dkuegler commented 1 month ago

FastSurfer uses the the DKTatlas, so adding --parc aparc.DTKatlas.mapped should solve this.

m-reuter commented 1 month ago

Yes, we should document all this a little better. Freesurfer also generates the DKTatlas but it is not the default (although many people think it should be). The DKT it is only a minor modification from the older aparc with some clean up and a few unreliable labels merged. In FastSurfer, you can use the --fs-aparc flag which will generate more stats files, but will be a little slower obviously. For most applications the default DKTatlas.mapped one will be fine. This is the volume based DKT atlas segmentation mapped to the surface, so it does not even require a spherical non-linear registration.