ignore index included in foreground when calculating dataset fingerprint
Author: c-winderCreated Jul 19, 2026Updated Jul 19, 2026
Labelsbugneeds-maintainer
I noticed odd foreground_intensities for my dataset.
I have this dataset.json
{
"channel_names": {
"0": "CT"
},
"labels": {
"background": 0,
"sm": 1,
"sat": 2,
"vat": 3,
"other_tissue": 4,
"ignore": 5
},
"numTraining": 3056,
"file_ending": ".nii.gz"
}Preprocessing gives the following stats:
foreground_intensity_properties_per_channel": {
"0": {
"max": 10623.0,
"mean": -321.3395918581319,
"median": -66.0,
"min": -3040.0,
"percentile_00_5": -3024.0,
"percentile_99_5": 701.0,
"std": 790.7851868216073
}
},When calculating manually I got much more reasonable values (99% -160HU to 100HU, mean ~-40HU). I figured it might be that nnunet was including the ignore class when calculating the statistics. Looking at DatasetFingerprintExtractor.collect_foreground_intensities I see foreground_mask = segmentation[0] > 0, which I think confirms my suspicion.
Fix: update foreground mask to properly exclude the ignore class (if present)
Source: MIC-DKFZ/nnUNet