Do not append JPEG 2000 end of codestream marker if already present
This commit is contained in:
parent
d24fbd0503
commit
ae015e051e
|
@ -113,8 +113,8 @@ def ev_files_to_dcm_file(study_uid, series_uid, series_number, image_number, inp
|
||||||
block.add_new(0x02, 'OB', msgpack.packb(metadata))
|
block.add_new(0x02, 'OB', msgpack.packb(metadata))
|
||||||
|
|
||||||
if metadata['imageFormat'] == 0:
|
if metadata['imageFormat'] == 0:
|
||||||
# JPEG 2000 - For some reason, the end of codestream tag is missing
|
# JPEG 2000 - For some reason, the end of codestream marker is (always?) missing
|
||||||
ds.PixelData = encapsulate([pixel_data + b'\xff\xd9' for pixel_data in pixel_datas])
|
ds.PixelData = encapsulate([pixel_data if pixel_data.endswith(b'\xff\xd9') else pixel_data + b'\xff\xd9' for pixel_data in pixel_datas])
|
||||||
else:
|
else:
|
||||||
ds.PixelData = encapsulate(pixel_datas)
|
ds.PixelData = encapsulate(pixel_datas)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue