-
Notifications
You must be signed in to change notification settings - Fork 145
Description
General Support Request
Description
I am encountering a hypothalamus segmentation error in FastSurfer.
I also tried running the pipeline using the bias-corrected image (orig_nu.mgz), but the problem persists. When I use the --no_hypothal flag, the pipeline completes successfully.
I would appreciate your clarification on the following points:
-
Could you explain the underlying reason why this hypothalamus segmentation error occurs?
-
I use both volumetric and cortical thickness measures.
When applying the --no_hypothal flag, which ROIs are not generated?In particular, are any other subcortical structures (e.g., hippocampus) affected, or is the exclusion limited strictly to the hypothalamus? -
Does using the --no_hypothal flag have any impact on cortical thickness estimates?
-
When using the --no_hypothal flag, is the eTIV (estimated total intracranial volume) identical to the result obtained without this flag?
If there are any recommended approaches to resolve this issue without disabling hypothalamus segmentation, I would greatly appreciate your advice.
Thank you very much for your continued support.
Log Files / Screenshots
[INFO: run_prediction.py: 647]: Checking or downloading default checkpoints ...
[INFO: common.py: 820]: Single subject with absolute file path for input.
[INFO: common.py: 878]: Analyzing single subject /data/sub-b046_ses-2/mri/orig_nu.mgz
[INFO: common.py: 979]: Output will be stored in Subjects Directory: /output
[INFO: common.py: 106]: Using device: cuda
[INFO: common.py: 99]: Found 4.0 GB GPU memory, but 4.0 GB was required.
[INFO: common.py: 106]: Using viewagg_device: cpu
[INFO: run_prediction.py: 245]: Running view aggregation on cpu
[INFO: inference.py: 200]: Loading checkpoint /fastsurfer/checkpoints/aparc_vinn_coronal_v2.0.0.pkl
[INFO: inference.py: 200]: Loading checkpoint /fastsurfer/checkpoints/aparc_vinn_sagittal_v2.0.0.pkl
[INFO: inference.py: 200]: Loading checkpoint /fastsurfer/checkpoints/aparc_vinn_axial_v2.0.0.pkl
[INFO: run_prediction.py: 324]: Successfully loaded image from /data/sub-b046_ses-2/mri/orig_nu.mgz.
[INFO: run_prediction.py: 441]: Output image directory /output/sub-b046_ses-2/mri/orig does not exist. Creating it now...
[INFO: run_prediction.py: 454]: Successfully saved image as /output/sub-b046_ses-2/mri/orig/001.mgz.
[INFO: conform.py: 826]: A min-conformedconformed image must satisfy the following criteria:
[INFO: conform.py: 828]: - Number of Dimensions 3 : True
[INFO: conform.py: 828]: - Dimensions 256x256x256 : True
[INFO: conform.py: 828]: - Voxel Size 1.0x1.0x1.0 : True
[INFO: conform.py: 828]: - Orientation LIA : True
[INFO: conform.py: 828]: - Dtype uint8 : True
[INFO: run_prediction.py: 454]: Successfully saved image as /output/sub-b046_ses-2/mri/orig.mgz.
[INFO: run_prediction.py: 400]: Run coronal prediction
[INFO: dataset.py: 78]: Loading Coronal with input voxelsize (1.0, 1.0)
100%|███████████████████████████████████████| 256/256 [00:21<00:00, 11.96batch/s]
[INFO: inference.py: 408]: Inference on 256 batches for coronal successful
[INFO: inference.py: 469]: Coronal inference on /data/sub-b046_ses-2/mri/orig_nu.mgz finished in 21.4076 seconds
[INFO: run_prediction.py: 400]: Run sagittal prediction
[INFO: dataset.py: 69]: Loading Sagittal with input voxelsize (1.0, 1.0)
100%|███████████████████████████████████████| 256/256 [00:22<00:00, 11.16batch/s]
[INFO: inference.py: 408]: Inference on 256 batches for sagittal successful
[INFO: inference.py: 469]: Sagittal inference on /data/sub-b046_ses-2/mri/orig_nu.mgz finished in 22.9474 seconds
[INFO: run_prediction.py: 400]: Run axial prediction
[INFO: dataset.py: 74]: Loading Axial with input voxelsize (1.0, 1.0)
100%|███████████████████████████████████████| 256/256 [00:23<00:00, 11.04batch/s]
[INFO: inference.py: 408]: Inference on 256 batches for axial successful
[INFO: inference.py: 469]: Axial inference on /data/sub-b046_ses-2/mri/orig_nu.mgz finished in 23.1818 seconds
[INFO: run_prediction.py: 454]: Successfully saved image as /output/sub-b046_ses-2/mri/aparc.DKTatlas+aseg.deep.mgz.
[INFO: run_prediction.py: 724]: Creating brainmask based on segmentation...
Creating dilated mask ...
Frontal region special treatment: 18202
Found 1 connected component(s)!
[INFO: run_prediction.py: 454]: Successfully saved image as /output/sub-b046_ses-2/mri/mask.mgz.
[INFO: run_prediction.py: 743]: Creating aseg based on segmentation...
Reducing to aseg ...
FlipWM: rh 0 and lh 0 flipped.
[INFO: run_prediction.py: 454]: Successfully saved image as /output/sub-b046_ses-2/mri/aseg.auto_noCCseg.mgz.
[INFO: run_prediction.py: 762]: Running volume-based QC check on segmentation...
Checking total volume ...
Voxel size in mm3: 1.0
Total segmentation volume in liter: 1.12
INFO: Running N4 bias-field correction...
python3.10 -s /fastsurfer/recon_surf/N4_bias_correct.py --in /output/sub-b046_ses-2/mri/orig.mgz --rescale /output/sub-b046_ses-2/mri/orig_nu.mgz --aseg /output/sub-b046_ses-2/mri/aseg.auto_noCCseg.mgz --threads 8
N4 Bias Correction Parameters:
- verbosity: -1
- input volume: /output/sub-b046_ses-2/mri/orig.mgz
- output volume: do not save
- rescaled volume: /output/sub-b046_ses-2/mri/orig_nu.mgz
- mask: default (>0)
- aseg: /output/sub-b046_ses-2/mri/aseg.auto_noCCseg.mgz
- shrink factor: 4
- number fitting levels: 4
- number iterations: 50
- convergence threshold: 0.0
- threads: 8
read MGZ (FreeSurfer) image via nibabel...
executing N4 correction ...
- mask: ones (default)
normalize WM to 105.0 (find WM from aseg)
read MGZ (FreeSurfer) image via nibabel...
- source white matter intensity: 80.36
- m: 1.3057
converting rescaled to UCHAR
writing PosixPath: /output/sub-b046_ses-2/mri/orig_nu.mgz
write MGZ (FreeSurfer) image via nibabel...
INFO: Running talairach registration...
/fastsurfer/recon_surf/talairach-reg.sh /output/sub-b046_ses-2/scripts/deep-seg.log --dir /output/sub-b046_ses-2/mri --conformed_name /output/sub-b046_ses-2/mri/orig.mgz --norm_name /output/sub-b046_ses-2/mri/orig_nu.mgz --3T
INFO: Using the 3T atlas for talairach registration.
talairach_avi --i /output/sub-b046_ses-2/mri/orig_nu.mgz --xfm /output/sub-b046_ses-2/mri/transforms/talairach.auto.xfm --atlas 3T18yoSchwartzReactN32_as_orig
@#@FSLOADPRE 2026:02:07:08:58:48 talairach_avi N 6 2.59 1.03 0.61
getfullpath: Command not found.
getfullpath: Command not found.
Started at Sat Feb 7 08:58:48 UTC 2026
Ended at Sat Feb 7 08:59:05 UTC 2026
talairach_avi done
@#@FSTIME 2026:02:07:08:58:48 talairach_avi N 6 e 17.80 S 0.69 U 8.95 P 54% M 255616 F 0 R 400523 W 0 c 29 w 18411 I 0 O 32 L 2.59 1.03 0.61
@#@FSLOADPOST 2026:02:07:08:59:05 talairach_avi N 6 2.16 1.01 0.61
cp /output/sub-b046_ses-2/mri/transforms/talairach.auto.xfm /output/sub-b046_ses-2/mri/transforms/talairach.xfm
@#@FSLOADPRE 2026:02:07:08:59:05 cp N 2 2.16 1.01 0.61
@#@FSTIME 2026:02:07:08:59:05 cp N 2 e 0.00 S 0.00 U 0.00 P 0% M 2304 F 0 R 129 W 0 c 0 w 37 I 0 O 0 L 2.16 1.01 0.61
@#@FSLOADPOST 2026:02:07:08:59:05 cp N 2 2.16 1.01 0.61
lta_convert --src /output/sub-b046_ses-2/mri/orig.mgz --trg /opt/freesurfer/average/mni305.cor.mgz --inxfm /output/sub-b046_ses-2/mri/transforms/talairach.xfm --outlta /output/sub-b046_ses-2/mri/transforms/talairach.xfm.lta --subject fsaverage --ltavox2vox
@#@FSLOADPRE 2026:02:07:08:59:05 lta_convert N 11 2.16 1.01 0.61
7.4.1
--src: /output/sub-b046_ses-2/mri/orig.mgz src image (geometry).
--trg: /opt/freesurfer/average/mni305.cor.mgz trg image (geometry).
--inmni: /output/sub-b046_ses-2/mri/transforms/talairach.xfm input MNI/XFM transform.
--outlta: /output/sub-b046_ses-2/mri/transforms/talairach.xfm.lta output LTA.
--s: fsaverage subject name
--ltavox2vox: output LTA as VOX_TO_VOX transform.
LTA read, type : 1
1.01282 0.04481 0.01946 1.23538;
-0.12077 1.15694 0.20805 7.74652;
-0.03292 -0.29502 1.16205 -3.91057;
0.00000 0.00000 0.00000 1.00000;
setting subject to fsaverage
Writing LTA to file /output/sub-b046_ses-2/mri/transforms/talairach.xfm.lta...
lta_convert successful.
@#@FSTIME 2026:02:07:08:59:05 lta_convert N 11 e 0.19 S 0.00 U 0.11 P 63% M 8192 F 0 R 1087 W 0 c 4 w 958 I 0 O 0 L 2.16 1.01 0.61
@#@FSLOADPOST 2026:02:07:08:59:06 lta_convert N 11 2.07 1.01 0.61
softlink_or_copy talairach.xfm.lta talairach_with_skull.lta /output/sub-b046_ses-2/scripts/deep-seg.log
ln -sf talairach.xfm.lta talairach_with_skull.lta
@#@FSLOADPRE 2026:02:07:08:59:06 ln N 3 2.07 1.01 0.61
@#@FSTIME 2026:02:07:08:59:06 ln N 3 e 0.00 S 0.00 U 0.00 P 0% M 1664 F 0 R 96 W 0 c 0 w 3 I 0 O 0 L 2.07 1.01 0.61
@#@FSLOADPOST 2026:02:07:08:59:06 ln N 3 2.07 1.01 0.61
softlink_or_copy talairach.xfm.lta talairach.lta /output/sub-b046_ses-2/scripts/deep-seg.log
ln -sf talairach.xfm.lta talairach.lta
@#@FSLOADPRE 2026:02:07:08:59:06 ln N 3 2.07 1.01 0.61
@#@FSTIME 2026:02:07:08:59:06 ln N 3 e 0.00 S 0.00 U 0.00 P 0% M 1792 F 0 R 98 W 0 c 0 w 2 I 0 O 0 L 2.07 1.01 0.61
@#@FSLOADPOST 2026:02:07:08:59:06 ln N 3 2.07 1.01 0.61
mri_add_xform_to_header -c /output/sub-b046_ses-2/mri/transforms/talairach.xfm /output/sub-b046_ses-2/mri/orig_nu.mgz /output/sub-b046_ses-2/mri/nu.mgz
@#@FSLOADPRE 2026:02:07:08:59:06 mri_add_xform_to_header N 4 2.07 1.01 0.61
INFO: extension is mgz
@#@FSTIME 2026:02:07:08:59:06 mri_add_xform_to_header N 4 e 1.05 S 0.03 U 0.66 P 65% M 22656 F 0 R 4546 W 0 c 3 w 1726 I 0 O 0 L 2.07 1.01 0.61
@#@FSLOADPOST 2026:02:07:08:59:07 mri_add_xform_to_header N 4 2.07 1.01 0.61
python3.10 -s /fastsurfer/FastSurferCNN/segstats.py --segfile /output/sub-b046_ses-2/mri/aparc.DKTatlas+aseg.deep.mgz --segstatsfile /output/sub-b046_ses-2/stats/aseg+DKT.stats --normfile /output/sub-b046_ses-2/mri/orig_nu.mgz --threads 8 --empty --excludeid 0 --sd /output --sid sub-b046_ses-2 --ids 2 4 5 7 8 10 11 12 13 14 15 16 17 18 24 26 28 31 41 43 44 46 47 49 50 51 52 53 54 58 60 63 77 251 252 253 254 255 1002 1003 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1034 1035 2002 2003 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2034 2035 --lut /fastsurfer/FastSurferCNN/config/FreeSurferColorLUT.txt measures --compute Mask(/output/sub-b046_ses-2/mri/mask.mgz) BrainSeg BrainSegNotVent SupraTentorial SupraTentorialNotVent SubCortGray rhCerebralWhiteMatter lhCerebralWhiteMatter CerebralWhiteMatter EstimatedTotalIntraCranialVol BrainSegVol-to-eTIV MaskVol-to-eTIV
None of the labels [251, 252, 253, 254, 255] for merged label 10007 exist in the segmentation.
Partial volume stats for 100 labels written to /output/sub-b046_ses-2/stats/aseg+DKT.stats.
Calculation took 3.26 seconds using up to 8 threads.
python3.10 -s /fastsurfer/CerebNet/run_prediction.py --t1 /data/sub-b046_ses-2/mri/orig_nu.mgz --asegdkt_segfile /output/sub-b046_ses-2/mri/aparc.DKTatlas+aseg.deep.mgz --conformed_name /output/sub-b046_ses-2/mri/orig.mgz --cereb_segfile /output/sub-b046_ses-2/mri/cerebellum.CerebNet.nii.gz --seg_log /output/sub-b046_ses-2/scripts/deep-seg.log --async_io --batch_size 1 --viewagg_device auto --device auto --threads 8 --norm_name /output/sub-b046_ses-2/mri/orig_nu.mgz --cereb_statsfile /output/sub-b046_ses-2/stats/cerebellum.CerebNet.stats --sd /output
[INFO: run_prediction.py: 154]: Checking or downloading default checkpoints ...
[INFO: common.py: 820]: Single subject with absolute file path for input.
[INFO: common.py: 878]: Analyzing single subject /data/sub-b046_ses-2/mri/orig_nu.mgz
[INFO: common.py: 106]: Using device: cuda
[INFO: common.py: 106]: Using viewagg_device: cuda
[INFO: inference.py: 434]: 26-02-07_08:59:14
[INFO: inference.py: 357]: Saving CerebNet cerebellum segmentation at /output/sub-b046_ses-2/mri/cerebellum.CerebNet.nii.gz
[INFO: inference.py: 512]: Subject 1/1 with id 'orig_nu.mgz' processed in 8.62 sec.
Subject: 100%|█████████████████████████████████████| 1/1 [00:09<00:00, 9.06s/it]
python3.10 -s /fastsurfer/HypVINN/run_prediction.py --sd /output --sid sub-b046_ses-2 --reg_mode coreg --threads 8 --async_io --batch_size 1 --seg_log /output/sub-b046_ses-2/scripts/deep-seg.log --device auto --viewagg_device auto --t1 /output/sub-b046_ses-2/mri/orig_nu.mgz
[INFO: mode_config.py: 49]: Setting up input mode...
[INFO: run_prediction.py: 437]: Checking or downloading default checkpoints ...
[INFO: run_prediction.py: 282]: Running HypVINN segmentation pipeline on subject sub-b046_ses-2
[INFO: run_prediction.py: 285]: Output will be stored in: /output/sub-b046_ses-2
[INFO: run_prediction.py: 286]: T1 image input /output/sub-b046_ses-2/mri/orig_nu.mgz
[INFO: run_prediction.py: 287]: T2 image input None
[INFO: run_prediction.py: 306]: Setting up HypVINN run
[INFO: run_prediction.py: 311]: axial model configuration from /fastsurfer/HypVINN/config/HypVINN_axial_v1.1.0.yaml
[INFO: run_prediction.py: 311]: coronal model configuration from /fastsurfer/HypVINN/config/HypVINN_coronal_v1.1.0.yaml
[INFO: run_prediction.py: 311]: sagittal model configuration from /fastsurfer/HypVINN/config/HypVINN_sagittal_v1.1.0.yaml
[INFO: run_prediction.py: 505]: Loading T1 image from : /output/sub-b046_ses-2/mri/orig_nu.mgz
[INFO: common.py: 106]: Using device: cuda
[INFO: common.py: 99]: Found 4.0 GB GPU memory, but 4.0 GB was required.
[INFO: common.py: 106]: Using viewagg_device: cpu
[INFO: inference.py: 109]: Running view aggregation on cpu
[INFO: run_prediction.py: 340]: ------------------------------------------------------------------------------------------------------------------------
[INFO: run_prediction.py: 341]: Evaluating hypothalamus model on sub-b046_ses-2
Input: min: 2 max: 255
rescale: min: 2.0 max: 251.711 scale: 1.0211804846402441
Output: min: 0.0 max: 255.0
[INFO: run_prediction.py: 350]: Scale factor: (1.0, 1.0, 1.0)
[INFO: run_prediction.py: 609]: Evaluating axial model, cpkt :/fastsurfer/checkpoints/HypVINN_axial_v1.1.0.pkl
[INFO: inference.py: 183]: Loading checkpoint /fastsurfer/checkpoints/HypVINN_axial_v1.1.0.pkl
[INFO: dataset.py: 166]: Loading t1 axial with input voxelsize (1.0, 1.0)
[INFO: dataset.py: 114]: Successfully loaded Image from sub-b046_ses-2 for axial model
[INFO: dataset.py: 126]: For inference T1 block weight was set to: 1.0 and the T2 block was set to: 0.0
100%|██████████████████████████████████████████| 256/256 [00:27<00:00, 9.31it/s]
[INFO: inference.py: 345]: ---> axial Model Testing Done.
[INFO: inference.py: 404]: axial Inference on sub-b046_ses-2 finished in 27.4980 seconds
[INFO: run_prediction.py: 609]: Evaluating coronal model, cpkt :/fastsurfer/checkpoints/HypVINN_coronal_v1.1.0.pkl
[INFO: inference.py: 183]: Loading checkpoint /fastsurfer/checkpoints/HypVINN_coronal_v1.1.0.pkl
[INFO: dataset.py: 160]: Loading t1 coronal with input voxelsize (1.0, 1.0)
[INFO: dataset.py: 114]: Successfully loaded Image from sub-b046_ses-2 for coronal model
[INFO: dataset.py: 126]: For inference T1 block weight was set to: 1.0 and the T2 block was set to: 0.0
100%|██████████████████████████████████████████| 256/256 [00:26<00:00, 9.54it/s]
[INFO: inference.py: 345]: ---> coronal Model Testing Done.
[INFO: inference.py: 404]: coronal Inference on sub-b046_ses-2 finished in 26.8482 seconds
[INFO: run_prediction.py: 609]: Evaluating sagittal model, cpkt :/fastsurfer/checkpoints/HypVINN_sagittal_v1.1.0.pkl
[INFO: inference.py: 183]: Loading checkpoint /fastsurfer/checkpoints/HypVINN_sagittal_v1.1.0.pkl
[INFO: dataset.py: 153]: Loading t1 sagittal with input voxelsize (1.0, 1.0)
[INFO: dataset.py: 114]: Successfully loaded Image from sub-b046_ses-2 for sagittal model
[INFO: dataset.py: 126]: For inference T1 block weight was set to: 1.0 and the T2 block was set to: 0.0
100%|██████████████████████████████████████████| 256/256 [00:27<00:00, 9.45it/s]
[INFO: inference.py: 345]: ---> sagittal Model Testing Done.
[INFO: inference.py: 404]: sagittal Inference on sub-b046_ses-2 finished in 27.1020 seconds
[INFO: run_prediction.py: 363]: Model prediction finished in 83.3292 seconds
[INFO: run_prediction.py: 364]: Saving results in /output/sub-b046_ses-2
[INFO: img_processing_utils.py: 97]: Orig data orientation : ('L', 'I', 'A')
[INFO: img_processing_utils.py: 101]: HypVINN Mask orientation: ('R', 'A', 'S')
[INFO: img_processing_utils.py: 103]: HypVINN Mask after re-orientation: ('L', 'I', 'A')
[INFO: img_processing_utils.py: 109]: HypVINN Prediction orientation: ('R', 'A', 'S')
[INFO: img_processing_utils.py: 111]: HypVINN Prediction after re-orientation: ('L', 'I', 'A')
[INFO: run_prediction.py: 381]: Prediction successfully saved in 1.9169142246246338 seconds.
[INFO: run_prediction.py: 395]: Computing stats
[INFO: brainvolstats.py: 1415]: Replacing segmentation volume to compute volume measures from with the segmentation file /output/sub-b046_ses-2/mri/hypothalamus.HypVINN.nii.gz.
Traceback (most recent call last):
File "/fastsurfer/HypVINN/run_prediction.py", line 674, in <module>
sys.exit(main(**args))
File "/fastsurfer/HypVINN/run_prediction.py", line 396, in main
return_value = compute_stats(
File "/fastsurfer/HypVINN/utils/stats_utils.py", line 74, in compute_stats
return main(args)
File "/fastsurfer/FastSurferCNN/segstats.py", line 902, in main
out = pv_calc(seg_data, pv_data, norm_data, labels, return_maps=save_maps, **kwargs)
File "/fastsurfer/FastSurferCNN/segstats.py", line 1868, in pv_calc
stds = {lab: get_std(lab, nvox) for lab, nvox in robust_vc_it if nvox > eps}
File "/fastsurfer/FastSurferCNN/segstats.py", line 1868, in <dictcomp>
stds = {lab: get_std(lab, nvox) for lab, nvox in robust_vc_it if nvox > eps}
File "/fastsurfer/FastSurferCNN/segstats.py", line 1866, in get_std
return np.sqrt((sums_2[lab] - means[lab] * sums[lab]) / (nvox - 1))
ZeroDivisionError: float division by zero
ERROR: Hypothalamus Segmentation failed!
Environment
FastSurfer Verions: 2.4.2
Installation type: Docker
OS: Windows (WSL2, Ubuntu 22.04)
Additional Context
The data were acquired on a 3T Siemens MRI scanner using a T1-weighted MPRAGE sequence with a 1×1×1 mm³ voxel size.