Deep-MI / FastSurfer

PyTorch implementation of FastSurferCNN
Apache License 2.0
455 stars 120 forks source link

Fastsurfer taking forever on very high-res stroke images #453

Closed evaaamodt closed 7 months ago

evaaamodt commented 7 months ago

Question/Support Request

Hi, I`m running Fastsurfer on multple IDs via Docker, first with --seg_only and then now --surf_only. It is taking a really long time to run - it has been stuck on the first ID for 2 hours. Still running and no error, but it says that there were quite a few ambigious voxels that it needs to do. Have I done something wrong, is there not enough memory, or does it just take this long sometimes?

Execution

sudo docker run --gpus all \ -v /home/eaamodt/fastsurfer/data:/data \ -v /home/eaamodt/fastsurfer/output:/output \ -v /home/eaamodt/fastsurfer/FastSurfer-stable:/fs_license \ --entrypoint "/fastsurfer/brun_fastsurfer.sh" \ --rm --user $(id -u):$(id -g) \ deepmi/fastsurfer:latest \ --fs_license /fs_license/license.txt \ --sd /output --subject_list /data/subject_listaa --surf_only --threads 30 --3T --viewagg_device cpu \


Version: 2.2.0+9f37d02 Running run_fastsurfer.sh on a /fastsurfer/recon_surf /fastsurfer ./recon-surf.sh --sid subject_id1 --sd /output --t1 /output/subject_id1/mri/orig.mgz --asegdkt_segfile /output/subject_id1/mri/aparc.DKTatlas+aseg.deep.mgz --3T --threads 30 --py python-s

sid subject_id1 T1 /output/subject_id1/mri/orig.mgz asegdkt_segfile /output/subject_id1/mri/aparc.DKTatlas+aseg.deep.mgz

Checking Input Segmentation Quality ... python-s /fastsurfer/recon_surf//../FastSurferCNN/quick_qc.py --asegdkt_segfile /output/subject_id1/mri/aparc.DKTatlas+aseg.deep.mgz Reading in aparc+aseg: /output/subject_id1/mri/aparc.DKTatlas+aseg.deep.mgz ... Estimating ventricle-background intersection volume... Ventricle-background intersection volume in mm3: 61.09 Checking total volume ... Voxel size in mm3: 0.07934069633483887 Total segmentation volume in liter: 0.95

Thu Feb 8 19:12:19 UTC 2024

export SUBJECTS_DIR=/output cd /fastsurfer/recon_surf ./recon-surf.sh --sid subject_id1 --sd /output --t1 /output/subject_id1/mri/orig.mgz --asegdkt_segfile /output/subject_id1/mri/aparc.DKTatlas+aseg.deep.mgz --3T --threads 30 --py python-s

freesurfer-linux-ubuntu22_x86_64-7.4.1-20230614-7eb8460 $Id$ Linux fcd9dc64d1a6 5.4.0-150-generic #167~18.04.1-Ubuntu SMP Wed May 24 00:51:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

RUNNING both hemis SEQUENTIALLY RUNNING 30 number of OMP THREADS RUNNING 30 number of ITK THREADS

================== Creating orig and rawavg from input =========================

python-s /fastsurfer/recon_surf/../FastSurferCNN/data_loader/conform.py -i /output/subject_id1/mri/orig.mgz --check_only --vox_size min --verbose Reading input: /output/subject_id1/mri/orig.mgz ... A min-conformed image must satisfy the following criteria:

@#@FSTIME 2024:02:08:19:12:19 python-s N 7 e 0.56 S 2.58 U 0.85 P 609% M 41716 F 0 R 6834 W 0 c 583489 w 35 I 0 O 0 L 1.33 5.62 8.44 @#@FSLOADPOST 2024:02:08:19:12:20 python-s N 7 1.33 5.62 8.44 python-s /fastsurfer/recon_surf/../FastSurferCNN/data_loader/conform.py -i /output/subject_id1/mri/aparc.DKTatlas+aseg.deep.mgz --check_only --vox_size 0.4297 --dtype any --verbose Reading input: /output/subject_id1/mri/aparc.DKTatlas+aseg.deep.mgz ... A 0.4297-conformed image must satisfy the following criteria:

@#@FSTIME 2024:02:08:19:12:20 python-s N 9 e 0.63 S 2.68 U 1.03 P 588% M 41616 F 0 R 6836 W 0 c 544735 w 38 I 0 O 0 L 1.33 5.62 8.44 @#@FSLOADPOST 2024:02:08:19:12:21 python-s N 9 1.33 5.62 8.44 The voxel size 0.4297 is less than 0.999, so we are proceeding with hires options. mri_convert /output/subject_id1/mri/orig.mgz /output/subject_id1/mri/orig.mgz mri_convert /output/subject_id1/mri/orig.mgz /output/subject_id1/mri/orig.mgz reading from /output/subject_id1/mri/orig.mgz... TR=0.00, TE=0.00, TI=0.00, flip angle=0.00 i_ras = (-1, 0, 0) j_ras = (0, 0, -1) k_ras = (0, 1, 0) writing to /output/subject_id1/mri/orig.mgz... @#@FSTIME 2024:02:08:19:12:21 mri_convert N 2 e 2.56 S 0.13 U 7.82 P 310% M 142324 F 0 R 34928 W 0 c 78 w 63 I 0 O 25832 L 1.33 5.62 8.44 @#@FSLOADPOST 2024:02:08:19:12:23 mri_convert N 2 1.47 5.57 8.41 mri_convert /output/subject_id1/mri/aparc.DKTatlas+aseg.deep.mgz /output/subject_id1/mri/aparc.DKTatlas+aseg.orig.mgz mri_convert /output/subject_id1/mri/aparc.DKTatlas+aseg.deep.mgz /output/subject_id1/mri/aparc.DKTatlas+aseg.orig.mgz reading from /output/subject_id1/mri/aparc.DKTatlas+aseg.deep.mgz... TR=0.00, TE=0.00, TI=0.00, flip angle=0.00 i_ras = (-1, 0, 0) j_ras = (0, 0, -1) k_ras = (0, 1, 0) writing to /output/subject_id1/mri/aparc.DKTatlas+aseg.orig.mgz... @#@FSTIME 2024:02:08:19:12:23 mri_convert N 2 e 7.45 S 0.12 U 15.59 P 210% M 273416 F 0 R 107785 W 0 c 106 w 60 I 0 O 3640 L 1.47 5.57 8.41 @#@FSLOADPOST 2024:02:08:19:12:31 mri_convert N 2 1.51 5.51 8.38 /output/subject_id1/mri /fastsurfer/recon_surf ln -sf orig.mgz rawavg.mgz @#@FSTIME 2024:02:08:19:12:31 ln N 3 e 0.00 S 0.00 U 0.00 P 100% M 1820 F 0 R 92 W 0 c 0 w 1 I 0 O 0 L 1.51 5.51 8.38 @#@FSLOADPOST 2024:02:08:19:12:31 ln N 3 1.51 5.51 8.38 /fastsurfer/recon_surf

============= Computing Talairach Transform and NU (bias corrected) ============

/output/subject_id1/mri /fastsurfer/recon_surf Using the 3T atlas for talairach registration. talairach_avi --i /output/subject_id1/mri/orig_nu.mgz --xfm /output/subject_id1/mri/transforms/talairach.auto.xfm --atlas 3T18yoSchwartzReactN32_as_orig getfullpath: Command not found. getfullpath: Command not found. Started at Thu Feb 8 19:12:31 UTC 2024 Ended at Thu Feb 8 19:13:55 UTC 2024 talairach_avi done @#@FSTIME 2024:02:08:19:12:31 talairach_avi N 6 e 84.20 S 7.15 U 76.96 P 99% M 2022584 F 0 R 2080879 W 0 c 226 w 217 I 0 O 2359656 L 1.51 5.51 8.38 @#@FSLOADPOST 2024:02:08:19:13:55 talairach_avi N 6 1.66 4.58 7.80 cp /output/subject_id1/mri/transforms/talairach.auto.xfm /output/subject_id1/mri/transforms/talairach.xfm @#@FSTIME 2024:02:08:19:13:55 cp N 2 e 0.00 S 0.00 U 0.00 P 100% M 2368 F 0 R 125 W 0 c 0 w 1 I 0 O 8 L 1.66 4.58 7.80 @#@FSLOADPOST 2024:02:08:19:13:55 cp N 2 1.66 4.58 7.80 lta_convert --src /output/subject_id1/mri/orig.mgz --trg /opt/freesurfer/average/mni305.cor.mgz --inxfm /output/subject_id1/mri/transforms/talairach.xfm --outlta /output/subject_id1/mri/transforms/talairach.xfm.lta --subject fsaverage --ltavox2vox 7.4.1

--src: /output/subject_id1/mri/orig.mgz src image (geometry). --trg: /opt/freesurfer/average/mni305.cor.mgz trg image (geometry). --inmni: /output/subject_id1/mri/transforms/talairach.xfm input MNI/XFM transform. --outlta: /output/subject_id1/mri/transforms/talairach.xfm.lta output LTA. --s: fsaverage subject name --ltavox2vox: output LTA as VOX_TO_VOX transform. LTA read, type : 1 1.14417 -0.04247 0.07183 0.35832; 0.01913 1.11654 0.20641 -40.17072; -0.09450 -0.22084 1.18031 -27.24236; 0.00000 0.00000 0.00000 1.00000; setting subject to fsaverage Writing LTA to file /output/subject_id1/mri/transforms/talairach.xfm.lta... lta_convert successful. @#@FSTIME 2024:02:08:19:13:55 lta_convert N 11 e 0.54 S 0.00 U 0.54 P 100% M 8388 F 0 R 1084 W 0 c 3 w 1 I 0 O 8 L 1.66 4.58 7.80 @#@FSLOADPOST 2024:02:08:19:13:56 lta_convert N 11 1.66 4.58 7.80 /output/subject_id1/mri/transforms /output/subject_id1/mri /fastsurfer/recon_surf ln -sf talairach.xfm.lta talairach_with_skull.lta @#@FSTIME 2024:02:08:19:13:56 ln N 3 e 0.00 S 0.00 U 0.00 P 100% M 1988 F 0 R 93 W 0 c 0 w 1 I 0 O 0 L 1.66 4.58 7.80 @#@FSLOADPOST 2024:02:08:19:13:56 ln N 3 1.66 4.58 7.80 ln -sf talairach.xfm.lta talairach.lta @#@FSTIME 2024:02:08:19:13:56 ln N 3 e 0.00 S 0.00 U 0.00 P 50% M 1900 F 0 R 90 W 0 c 0 w 1 I 0 O 0 L 1.66 4.58 7.80 @#@FSLOADPOST 2024:02:08:19:13:56 ln N 3 1.66 4.58 7.80 /output/subject_id1/mri /fastsurfer/recon_surf mri_add_xform_to_header -c /output/subject_id1/mri/transforms/talairach.xfm /output/subject_id1/mri/orig_nu.mgz /output/subject_id1/mri/nu.mgz INFO: extension is mgz @#@FSTIME 2024:02:08:19:13:56 mri_add_xform_to_header N 4 e 2.59 S 0.08 U 9.15 P 356% M 141644 F 0 R 35181 W 0 c 84 w 65 I 0 O 24888 L 1.66 4.58 7.80 @#@FSLOADPOST 2024:02:08:19:13:58 mri_add_xform_to_header N 4 1.60 4.52 7.76 /fastsurfer/recon_surf

============ Creating brainmask from aseg and norm, and update aseg ============

mri_mask /output/subject_id1/mri/nu.mgz /output/subject_id1/mri/mask.mgz /output/subject_id1/mri/norm.mgz DoAbs = 0 maskval=0, outval=0 Writing masked volume to /output/subject_id1/mri/norm.mgz...done. @#@FSTIME 2024:02:08:19:13:58 mri_mask N 3 e 5.75 S 0.29 U 18.21 P 321% M 541360 F 0 R 193135 W 0 c 526 w 115 I 0 O 19224 L 1.60 4.52 7.76 @#@FSLOADPOST 2024:02:08:19:14:04 mri_mask N 3 1.55 4.46 7.72 mri_normalize -g 1 -seed 1234 -mprage /output/subject_id1/mri/nu.mgz /output/subject_id1/mri/T1.mgz -noconform using max gradient = 1.000 setting seed for random number genererator to 1234 assuming input volume is MGH (Van der Kouwe) MP-RAGE reading mri_src from /output/subjectid1/mri/nu.mgz... normalizing image... NOT doing gentle normalization with control points/label talairach transform 1.14417 -0.04247 0.07183 0.35832; 0.01913 1.11654 0.20641 -40.17072; -0.09450 -0.22084 1.18031 -27.24236; 0.00000 0.00000 0.00000 1.00000; processing without aseg, no1d=0 MRInormInit(): INFO: Modifying talairach volume c(r,a,s) based on average_305 MRInormalize(): MRIsplineNormalize(): npeaks = 19 Starting OpenSpline(): npoints = 19 building Voronoi diagram... performing soap bubble smoothing, sigma = 8...

Iterating 2 times

3d normalization pass 1 of 2 white matter peak found at 110 white matter peak found at 110 gm peak at 85 (83), valley at 28 (26) csf peak at 42, setting threshold to 70 building Voronoi diagram... performing soap bubble smoothing, sigma = 8...

3d normalization pass 2 of 2 white matter peak found at 110 white matter peak found at 110 gm peak at 88 (86), valley at 28 (26) csf peak at 43, setting threshold to 73 building Voronoi diagram... performing soap bubble smoothing, sigma = 8... Done iterating --------------------------------- writing output to /output/subject_id1/mri/T1.mgz 3D bias adjustment took 25 minutes and 4 seconds. @#@FSTIME 2024:02:08:19:14:04 mri_normalize N 8 e 1507.61 S 12.84 U 1625.60 P 108% M 4351480 F 0 R 14092308 W 0 c 5354 w 413 I 0 O 22568 L 1.55 4.46 7.72 @#@FSLOADPOST 2024:02:08:19:39:12 mri_normalize N 8 2.07 1.92 2.89 mri_mask /output/subject_id1/mri/T1.mgz /output/subject_id1/mri/mask.mgz /output/subject_id1/mri/brainmask.mgz DoAbs = 0 maskval=0, outval=0 Writing masked volume to /output/subject_id1/mri/brainmask.mgz...done. @#@FSTIME 2024:02:08:19:39:12 mri_mask N 3 e 5.57 S 0.25 U 17.94 P 326% M 541332 F 0 R 192430 W 0 c 293 w 122 I 0 O 16888 L 2.07 1.92 2.89 @#@FSLOADPOST 2024:02:08:19:39:17 mri_mask N 3 2.14 1.93 2.89 mri_cc -aseg aseg.auto_noCCseg.mgz -o aseg.auto.mgz -lta /output/subject_id1/mri/transforms/cc_up.lta subject_id1 will read input aseg from aseg.auto_noCCseg.mgz writing aseg with cc labels to aseg.auto.mgz will write lta as /output/subject_id1/mri/transforms/cc_up.lta reading aseg from /output/subject_id1/mri/aseg.auto_noCCseg.mgz reading norm from /output/subject_id1/mri/norm.mgz 473135 voxels in left wm, 302062 in right wm, xrange [251, 275] searching rotation angles z=[-12 2], y=[-6 8] searching scale 1 Z rot 1.6 global minimum found at slice 257.0, rotations (0.88, -5.19) final transformation (x=257.0, yr=0.879, zr=-5.188): 0.99579 0.09043 0.01527 -153.88019; -0.09041 0.99590 -0.00139 -87.39334; -0.01534 -0.00000 0.99988 -147.02600; 0.00000 0.00000 0.00000 1.00000; updating x range to be [124, 137] in xformed coordinates best xformed slice 128 min_x_fornix = 82 min_x_fornix = 56 min_x_fornix = 58 min_x_fornix = 62 min_x_fornix = 63 cc center is found at 128 240 279 eigenvectors: 0.00072 -0.00312 0.99999; -0.11344 -0.99354 -0.00302; 0.99354 -0.11344 -0.00107; error in mid anterior detected - correcting... writing aseg with callosum to /output/subject_id1/mri/aseg.auto.mgz... corpus callosum segmentation took 5.8 minutes

VMPC# mri_cc VmPeak 1341196

mri_cc done @#@FSTIME 2024:02:08:19:39:17 mri_cc N 7 e 349.14 S 1.43 U 362.20 P 104% M 957996 F 0 R 1234020 W 0 c 1115 w 173 I 0 O 2792 L 2.14 1.93 2.89 @#@FSLOADPOST 2024:02:08:19:45:07 mri_cc N 7 1.53 1.87 2.58 python-s /fastsurfer/recon_surf/paint_cc_into_pred.py -in_cc /output/subject_id1/mri/aseg.auto.mgz -in_pred /output/subject_id1/mri/aparc.DKTatlas+aseg.deep.mgz -out /output/subject_id1/mri/aparc.DKTatlas+aseg.deep.withCC.mgz Reading inputs: /output/subject_id1/mri/aseg.auto.mgz /output/subject_id1/mri/aparc.DKTatlas+aseg.deep.mgz... Writing segmentation with corpus callosum to: /output/subject_id1/mri/aparc.DKTatlas+aseg.deep.withCC.mgz @#@FSTIME 2024:02:08:19:45:07 python-s N 7 e 7.38 S 3.79 U 7.31 P 150% M 711904 F 0 R 295591 W 0 c 74 w 61 I 0 O 7736 L 1.53 1.87 2.58 @#@FSLOADPOST 2024:02:08:19:45:14 python-s N 7 1.57 1.87 2.58

========= Creating filled from brain (brainfinalsurfs, wm.asegedit, wm) =======

recon-all -s subject_id1 -asegmerge -normalization2 -maskbfs -segmentation -fill -hires -threads 30 -itkthreads 30 INFO: hi-res volumes are conformed to the min voxel size fs-check-version --s subject_id1 --o /tmp/tmp.iMadMn Thu Feb 8 19:45:14 UTC 2024

setenv SUBJECTS_DIR /output cd /fastsurfer/recon_surf /opt/freesurfer/bin/fs-check-version --s subject_id1 --o /tmp/tmp.iMadMn -rwxr-xr-x 1 root root 18565 Dec 14 15:06 /opt/freesurfer/bin/fs-check-version

freesurfer-linux-ubuntu22_x86_64-7.4.1-20230614-7eb8460 $Id$ Linux fcd9dc64d1a6 5.4.0-150-generic #167~18.04.1-Ubuntu SMP Wed May 24 00:51:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux pid 1000 Current FS Version freesurfer-linux-ubuntu22_x86_64-7.4.1-20230614-7eb8460 Subject does not have a bstampfile, copying /opt/freesurfer/build-stamp.txt Subject FS Version: freesurfer-linux-ubuntu22_x86_64-7.4.1-20230614-7eb8460 No constraints on version because REQ=UnSet and FsVerFile=NotThere

@#% fs-check-version match = 1

fs-check-version Done INFO: SUBJECTS_DIR is /output Actual FREESURFER_HOME /opt/freesurfer Linux fcd9dc64d1a6 5.4.0-150-generic #167~18.04.1-Ubuntu SMP Wed May 24 00:51:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux /output/subject_id1/mri/transforms /output/subject_id1 /output/subject_id1

--------------------------------------

@# Merge ASeg Thu Feb 8 19:45:17 UTC 2024

cp aseg.auto.mgz aseg.presurf.mgz

--------------------------------------------

@# Intensity Normalization2 Thu Feb 8 19:45:17 UTC 2024

/output/subject_id1/mri

mri_normalize -seed 1234 -mprage -noconform -aseg aseg.presurf.mgz -mask brainmask.mgz norm.mgz brain.mgz

setting seed for random number genererator to 1234 assuming input volume is MGH (Van der Kouwe) MP-RAGE not interpolating and embedding volume to be 256^3... using segmentation for initial intensity normalization using MR volume brainmask.mgz to mask input volume... reading mri_src from norm.mgz... Reading aseg aseg.presurf.mgz aseg read with width 512 (src width 512) ** resampling aseg to account for mismatch with source image *** normalizing image... NOT doing gentle normalization with control points/label processing with aseg removing outliers in the aseg WM... 4109 control points removed Building bias image building Voronoi diagram... performing soap bubble smoothing, sigma = 0... Smoothing with sigma 8 Applying bias correction building Voronoi diagram... performing soap bubble smoothing, sigma = 8...

Iterating 2 times

3d normalization pass 1 of 2 white matter peak found at 110 white matter peak found at 109 gm peak at 82 (82), valley at 0 (-1) csf peak at 41, setting threshold to 68 building Voronoi diagram... performing soap bubble smoothing, sigma = 8...

3d normalization pass 2 of 2 white matter peak found at 110 white matter peak found at 110 gm peak at 83 (83), valley at 0 (-1) csf peak at 41, setting threshold to 69 building Voronoi diagram... performing soap bubble smoothing, sigma = 8... Done iterating --------------------------------- writing output to brain.mgz 3D bias adjustment took 36 minutes and 5 seconds.

--------------------------------------------

@# Mask BFS Thu Feb 8 20:21:54 UTC 2024

/output/subject_id1/mri

mri_mask -T 5 brain.mgz brainmask.mgz brain.finalsurfs.mgz

threshold mask volume at 5 DoAbs = 0 Found 13949583 voxels in mask (pct= 10.39) maskval=0, outval=0 Writing masked volume to brain.finalsurfs.mgz...done. cp brain.finalsurfs.mgz brain.finalsurfs.manedit.mgz

--------------------------------------------

@# WM Segmentation Thu Feb 8 20:22:02 UTC 2024

AntsDenoiseImageFs -i brain.mgz -o antsdn.brain.mgz

mri_segment -wsizemm 13 -mprage antsdn.brain.mgz wm.seg.mgz

wsizemm = 13, voxres = 0.4297, wsize = 30 Widening wm low from 89 to 79 assuming input volume is MGH (Van der Kouwe) MP-RAGE wm mean: 110 wsize: 30 wm low: 79 wm hi: 125 gray low: 30 gray hi: 99 Doing initial trinary intensity segmentation MRIintensitySegmentation() wm_low=79, wm_hi=125, gray_hi=99 white = 6525875, nonwhite = 123469181, ambig = 4222672, nmask = 0 Using local statistics to label ambiguous voxels Autodetecting stats Computing class statistics for intensity windows... CCS WM (100.0): 100.3 +- 6.6 [79.0 --> 125.0] CCS GM (77.0) : 78.3 +- 11.6 [30.0 --> 95.0] white_mean 100.268 white_sigma 6.56018 gray_mean 78.2804 gray_sigma 11.6364 setting bottom of white matter range wm_low to 89.9 setting top of gray matter range gray_hi to 99.3 wm_low 89.9168 wm_hi 125 gray_low 30 gray_hi 99.2677 Redoing initial intensity segmentation... MRIintensitySegmentation() wm_low=89.9168, wm_hi=125, gray_hi=99.2677 white = 6525875, nonwhite = 125283909, ambig = 2407944, nmask = 0 Recomputing local statistics to label ambiguous voxels... wm_low 89.9168 wm_hi 125 gray_low 30 gray_hi 99.2677 using local geometry to label remaining ambiguous voxels... polvwsize = 5, polvlen = 3, gray_hi = 99.2677, wm_low = 89.9168 MRIcpolvMedianCurveSegment(): wsize=5, len=3, gmhi=99.2677, wmlow=89.9168 2343299 voxels processed (1.75%) 1127574 voxels white (0.84%) 1215725 voxels non-white (0.91%)

Reclassifying voxels using Gaussian border classifier niter=1 MRIreclassify(): wm_low=84.9168, gray_hi=99.2677, wsize=30 3351947 voxels tested (2.50%) 467109 voxels changed (0.35%) 517603 multi-scale searches (0.39%) Recovering bright white MRIrecoverBrightWhite() wm_low 89.9168 wm_hi 125 slack 6.56018 pct_thresh 0.33 intensity_thresh 131.56 nvox_thresh 8.58 251 voxels tested (0.00%) 188 voxels changed (0.00%)

removing voxels with positive offset direction... MRIremoveWrongDirection() wsize=3, lowthr=84.9168, hithr=99.2677 smoothing input volume with sigma = 0.250 1327823 voxels tested (0.99%) 133017 voxels changed (0.10%) thicken = 1 removing 1-dimensional structures... MRIremove1dStructures(): max_iter=10000, thresh=2, WM_MIN_VAL=5 3016 sparsely connected voxels removed in 1 iterations thickening thin strands.... thickness 4 nsegments 20 wm_hi 125 11034 diagonally connected voxels added... MRIthickenThinWMStrands(): thickness=4, nsegments=20 20 segments, 698 filled MRIfindBrightNonWM(): 278 bright non-wm voxels segmented. MRIfilterMorphology() WM_MIN_VAL=5, DIAGONAL_FILL=230 white matter segmentation took 83.9 minutes writing output to wm.seg.mgz...

mri_edit_wm_with_aseg -keep-in wm.seg.mgz brain.mgz aseg.presurf.mgz wm.asegedit.mgz

mri_edit_wm_with_aseg -keep-in wm.seg.mgz brain.mgz aseg.presurf.mgz wm.asegedit.mgz preserving editing changes in input volume...

m-reuter commented 7 months ago

It hasn't even started creating surfaces. It should not take that long. What computer and operating system are you using? How much ram ? You can try running a single case.

evaaamodt commented 7 months ago

Linux Ubuntu.. 575G mem available (whilst running). I've tried running it on a single ID; a couple of different ones, and it's the same problem. I've double checked the skullstripping and it's fine. Are there any preprocessing steps that are crucial that I might've missed? Or something else that could've happened?

evaaamodt commented 7 months ago

Btw, these are brains of stroke patients, but most of them (and the ones I've tried this far) have very small strokes. Could that be it? I have run Freesurfer on stroke patients and Freesurfer did really (surprisingly) well. But maybe Fastsurfer requires 'perfect' brains?

m-reuter commented 7 months ago

Ahh, yes, that could be the problem (I changed the title accordingly). We have never trained on stroke images and therefore this can be problematic. Note, however, that the surface pipeline in FastSurfer uses mainly FreeSurfer methods so I doubt that FreeSurfer will work so well on these images. Maybe you can try to directly compare the case above using the same FreeSurfer version as we (7.4.1). It probably also has difficulties finding the WM?

evaaamodt commented 7 months ago

I think 20%-ish of the stroke patients (different cohort) failed using Freesurfer. Which is surprisingly good. I'll try to run Freesurfer on one of these and see. Sounds like I'll probably get into trouble even with Freesurfer. Any plans on ever creating FastSurferStroke? He he.

m-reuter commented 7 months ago

There can also be differences between FreeSurfer versions, for example newer versions use an ANTs denoising before finding the WM. So it would be important for a fair comparison to use FreeSurfer version 7.4.1.

We are currently working on a FastSurfer version that can deal with all kinds of stuff (like tumor, resection cavities). But the first versions would require a mask of the affected region. Do you have stroke masks ?

Also I noticed that your voxel size is much below what we trained and tested:

Voxel Size 0.4297x0.4297x0.4297: True

FastSurfer is relatively safe to use from around .6 or .7 to 1.1 or 1.2 mm (better 1mm). Outside nobody can tell what will happen.

Are these images even from 3T ? For 7T you need much more heavy bias field removal to even get it working and that is very experimental.

evaaamodt commented 7 months ago

I'm guessing that's the main problem, then. These are actually 3T.. Will Freesurfer be able to handle smaller voxels?

I do not have stroke masks yet, but planning on having them. Great to hear this is in the works!

m-reuter commented 7 months ago

You can try to downsample the images to, e.g. .7 mm isotropic (or even 1mm) and see if that helps. In FastSurfer you can just add the flag --vox_size 0.7 to do that.

evaaamodt commented 7 months ago

Oh, great! I'll give that a shot. Thank you so much for great help!

evaaamodt commented 7 months ago

Downsampling did not help, unfortunately. I'm taking this down as a 'stroke pathology brain' problem and give up (and use more basic and non-ideal alternatives) for the time being. Unless you have another suggestion?

m-reuter commented 7 months ago

Currently no other suggestion. If you have a stroke mask, we can take another look to see if our lesion-robust tool will work (unless these are images with contrast agent, which will not be supported).