2.1.0#
Enhancements#
Large testing data is no longer distributed within the pydicom package with the aim to reduce the package download size. These test files will download on-the-fly whenever either the tests are run, or should the file(s) be requested via the data manager functions. For example:
To download all files and get their paths on disk you can run
pydicom.data.get_testdata_files()
.To download an individual file and get its path on disk you can use
pydicom.data.get_testdata_file()
, e.g. forRG1_UNCI.dcm
usepydicom.data.get_testdata_file("RG1_UNCI.dcm")
Added a new pixel data handler based on pylibjpeg which supports all (non-retired) JPEG transfer syntaxes (#1127)
Added
apply_rescale()
aliasAdded
apply_voi()
andapply_windowing()
Added prefer_lut keyword parameter to
apply_voi_lut()
and handle empty VOI LUT module elements (#1234, #1237)Added ability to register external data sources for use with the functions in
pydicom.data
(#1156)__contains__
,__next__
and__iter__
implementations added toPersonName
(#1103)Added convenience constants for the MPEG transfer syntaxes to
pydicom.uid
(#1155)Added support for decoding Waveform Data:
Added
pydicom.waveforms
module andgenerate_multiplex()
andmultiplex_array()
functions.Added
Dataset.waveform_array()
which returns anndarray
for the multiplex group at index within a Waveform Sequence element.
When JPEG 2000 image data is unsigned and the Pixel Representation is 1 the image data is converted to signed (#1149)
Added
keyword
property for the new UID keywords in version 2020d of the DICOM StandardAdded testing of the variable names used when setting
Dataset
attributes andINVALID_KEYWORD_BEHAVIOR
config option to allow customizing the behavior when a camel case variable name is used that isn’t a known element keyword (#1014)Added
INVALID_KEY_BEHAVIOR
config option to allow customizing the behavior when an invalid key is used with theDataset
in
operator (#1200)Implemented full support (loading, accessing, modifying, writing) of DICOM File-sets and their DICOMDIR files via the
FileSet
class (#9, #243, #1093)Added
AllTransferSyntaxes
Added option to turn on pydicom future breaking behavior to allow user code to check itself against the next major version release. Set environment variable “PYDICOM_FUTURE” to “True” or call
future_behavior()
Added another signature to the bulk_data_uri_handler in from_json to allow for the communication of not just the URI but also the tag and VR to the handler. Previous handlers will work as expected, new signature handlers will get the additional information.
pack_bits()
can now be used with 2D or 3D input arrays and will pad the packed data to even length by default.Elements with the
IS
VR accept float strings that are convertible to integers without loss, e.g. “1.0” (#1240)Added
encapsulate_extended()
function for use when an Extended Offset Table is required (#1178)
Changes#
Dropped support for Python 3.5 (only Python 3.6+ supported)
Reading and adding unknown non-private tags now does not raise an exception per default, only when
enforce_valid_values
is set (#1161)Data dictionaries updated to version 2020d of the DICOM Standard
Updated a handful of the SOP Class variable names in
_storage_sopclass_uids
to use the new UID keywords. Variables withMultiframe
in them becomeMultiFrame
, those withand
in them becomeAnd
, andDICOSQuadrupoleResonanceQRStorage
becomesDICOSQuadrupoleResonanceStorage
.The following UID constants are deprecated and will be removed in v2.2:
JPEGBaseline
: useJPEGBaseline8Bit
JPEGExtended
: useJPEGExtended12Bit
JPEGLossless
: useJPEGLosslessSV1
JPEGLSLossy
: useJPEGLSNearLossless
JPEG2000MultiComponentLossless
: useJPEG2000MCLossless
JPEG2000MultiComponent
: useJPEG2000MC
In v3.0 the value for
JPEGLossless
will change from 1.2.840.10008.1.2.4.70 to 1.2.840.10008.1.2.4.57 to match its UID keywordThe following lists of UIDs are deprecated and will be removed in v2.2:
JPEGLossyCompressedPixelTransferSyntaxes
: useJPEGTransferSyntaxes
JPEGLSSupportedCompressedPixelTransferSyntaxes
: useJPEGLSTransferSyntaxes
JPEG2000CompressedPixelTransferSyntaxes
: useJPEG2000TransferSyntaxes
RLECompressedLosslessSyntaxes
: useRLETransferSyntaxes
UncompressedPixelTransferSyntaxes
: useUncompressedTransferSyntaxes
PILSupportedCompressedPixelTransferSyntaxes
DicomDir
and thedicomdir
module are deprecated and will be removed in v3.0. UseFileSet
instead (#1211)pydicom.overlay_data_handlers
is deprecated, usepydicom.overlays
insteadRemoved transfer syntax limitations when converting overlays to an
ndarray
(#1181)The
overlay_data_handlers
config option is deprecated, the default handler will always be used.
Fixes#
Dataset.copy()
now works as expected (#1146)Optimistically parse undefined length non-SQ data as if it’s encapsulated pixel data to avoid erroring out on embedded sequence delimiter (#1140)
Fixed
get_testdata_file()
andget_testdata_files()
raising an exception if no network connection is available (#1156)Fixed GDCM < v2.8.8 not returning the pixel array for datasets not read from a file-like (#1153)
Raise
TypeError
ifdcmread()
ordcmwrite()
is called with wrong argumentGracefully handle empty Specific Character Set (#1190)
Fixed empty ambiguous VR elements raising an exception (#1193)
Allow
apply_voi_lut()
to apply VOI lookup to an input float arrayFixed
Dataset.setdefault()
not adding working correctly when the default value isNone
and not adding private elements whenenforce_valid_values
isTrue
(#1215)