Skip to content

Commit

Permalink
ENH: Allow aliases for NRRD "type" header in postNRRD (#7664)
Browse files Browse the repository at this point in the history
The NRRD definition lists various aliases
to specify the for the "short" datatype in
the "type" nrrd header field (see
https://teem.sourceforge.net/nrrd/format.html#type).

Pynnrd as a widely used nnrd library
e.g. creates NRRD headers with short
datatypes identified as "int16" and
does not allow to override this.
Consequently, a POST request to the
slicer/volume endpoint will always fail
with data from pynnrrd.

This commit relaxes the type check to
also allow aliases of "short" to pass.
  • Loading branch information
gabuzi committed Mar 28, 2024
1 parent 580e187 commit 35ac3f4
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def postNRRD(self, volumeID, requestBody):
value = line[colonIndex + 2 :]
fields[key] = value

if fields[b"type"] != b"short":
if fields[b"type"] not in [b"short", b"short int", b"signed short", b"signed short int", b"int16", b"int16_t"]:
raise RuntimeError("Can only read short volumes")
if fields[b"dimension"] != b"3":
raise RuntimeError("Can only read 3D, 1 component volumes")
Expand Down

0 comments on commit 35ac3f4

Please sign in to comment.