ImagingDataCommons / highdicom

High-level DICOM abstractions for the Python programming language
https://highdicom.readthedocs.io
MIT License
176 stars 37 forks source link

Enforce positive series and instance numbers #127

Closed CPBridge closed 3 years ago

CPBridge commented 3 years ago

As discussed in #125, we are a little uncertain about the requirements on instance numbers. This PR adds checks to enforce that all instance and series numbers are positive integers. This may be somewhat opinionated.

Do you think we should add these checks @hackermd ?

hackermd commented 3 years ago

The standard does seem to explicitly require these numbers to be positive integers. For example, the Instance Number attribute is described as follows:

A number that identifies this Composite Instance.

The Series Number and Instance Number attributes both have Value Representation Integer String (IS), which is defined as follows:

A string of characters representing an Integer in base-10 (decimal), shall contain only the characters 0 - 9, with an optional leading "+" or "-". It may be padded with leading and/or trailing spaces. Embedded spaces are not allowed. The integer, n, represented shall be in the range: -231<= n <= (231-1).

However, I think it's a good idea to restrict the number to be a positive integer (at least for creation).