The store_instances method accepts a set of DICOM frames, dumps them to bytes, and, finally, encodes them into a multipart/related request.
The above process results in storing the original DICOM frames in memory 3 times:
as the original pydicom.Dataset instances passed into store_instances
as bytes encoded in store_instances
as the concatenation of the above bytes created in _encode_multipart_message
Using a generator in store_instances reduces memory footprint by 1/3, since the original pydicom.Datasets are dumped into bytes one by one while the multipart request body is being created by _encode_multipart_message.
in
store_instances
ofDICOMwebClient
.The
store_instances
method accepts a set of DICOM frames, dumps them to bytes, and, finally, encodes them into a multipart/related request.The above process results in storing the original DICOM frames in memory 3 times:
pydicom.Dataset
instances passed intostore_instances
store_instances
_encode_multipart_message
Using a generator in
store_instances
reduces memory footprint by 1/3, since the originalpydicom.Dataset
s are dumped into bytes one by one while the multipart request body is being created by_encode_multipart_message
.