Skip to content

Write to NRRD writes the wrong data type to the file #5462

@MattTheCuber

Description

@MattTheCuber

Description

Writing images at NRRD files outputs the wrong type to the NRRD header.

Steps to Reproduce

import SimpleITK as sitk

image = ...  # Create sitk image
print(img.GetPixelIDTypeAsString())  # '16-bit signed integer'
sitk.WriteImage(image, "test.nrrd")

Expected behavior

NRRD0004
...
type: int16

Actual behavior

NRRD0004
...
type: short

Reproducibility

This happens 100% of the time for int16 data type, but likely happens with other data types as well.

Versions

I am using the latest Python SimpleITK wrapper.

Environment

Python 3.13 on RHEL 9.5

Additional Information

I use sed -e '/./!Q' /path/to/nrrd/file.nrrd to read the NRRD header easily.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:BugInconsistencies or issues which will cause an incorrect result under some or all circumstances

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions