#2410·nnUNet

Inconsistent Axis Order in `median_image_size_in_voxels` After Running `nnUNet_plan_and_preprocess` on Different Datasets

Author: KaterinaKrejci231054Created Jul 30, 2024Updated Sep 27, 2026

Hello,

We noticed that when running nnUNet_plan_and_preprocess on two different datasets separately, the order of axis (median_image_size_in_voxels) is changed in a different way:

  • first dataset contains nifti files with shape [242, 192, 368] and spacing [0.70652175, 0.69999725, 0.70652175] (loaded by Nibabel) and after running nnUNet_plan_and_preprocess with NibabelIO, the median_image_size_in_voxels is [242, 368, 192]:
Using <class 'nnunetv2.imageio.nibabel_reader_writer.NibabelIO'> reader/writer
3D fullres U-Net configuration:
{'data_identifier': 'nnUNetPlans_3d_fullres', ... , 'median_image_size_in_voxels': array([242., 368., 192.])
  • second dataset contains nifti files with shape [64, 320, 300] and spacing [0.79999882, 0.80000001, 0.80000007] (loaded by Nibabel) and after running nnUNet_plan_and_preprocess with NibabelIO, the median_image_size_in_voxels is [300, 320, 64].
Using <class 'nnunetv2.imageio.nibabel_reader_writer.NibabelIO'> reader/writer
3D fullres U-Net configuration:
{'data_identifier': 'nnUNetPlans_3d_fullres', ... , 'median_image_size_in_voxels': array([300., 320., 64.])

It seems that for the first dataset, two last axes are swapped: [242, 192, 368] --> [242, 368, 192] But for the second dataset, the first and third axes are swapped: [64, 320, 300] --> [300, 320, 64]