Correctly convert colour (RGB) JPEG2000 images
This commit is contained in:
parent
2f76ace0b7
commit
f09376c06e
@ -98,7 +98,12 @@ def ev_files_to_dcm_file(study_uid, series_uid, series_number, image_number, inp
|
|||||||
ds.Rows = metadata['rows']
|
ds.Rows = metadata['rows']
|
||||||
|
|
||||||
if metadata['color']:
|
if metadata['color']:
|
||||||
ds.PhotometricInterpretation = 'YBR_FULL_422' # Specify YBR as that is how JPEG compression works, even though the JSON says RGB
|
# FIXME: Any proper way to detect this?
|
||||||
|
|
||||||
|
if file_meta.TransferSyntaxUID == '1.2.840.10008.1.2.4.50': # JPEG
|
||||||
|
ds.PhotometricInterpretation = 'YBR_FULL_422' # Specify YBR as that is how JPEG compression works, even though the JSON says RGB
|
||||||
|
else:
|
||||||
|
ds.PhotometricInterpretation = 'RGB'
|
||||||
else:
|
else:
|
||||||
ds.PhotometricInterpretation = 'MONOCHROME2'
|
ds.PhotometricInterpretation = 'MONOCHROME2'
|
||||||
|
|
||||||
@ -110,7 +115,7 @@ def ev_files_to_dcm_file(study_uid, series_uid, series_number, image_number, inp
|
|||||||
|
|
||||||
# Store copy of raw metadata
|
# Store copy of raw metadata
|
||||||
block = ds.private_block(0x0075, 'RunasSudo ev-to-dicom', create=True)
|
block = ds.private_block(0x0075, 'RunasSudo ev-to-dicom', create=True)
|
||||||
block.add_new(0x01, 'UL', 0) # Version
|
block.add_new(0x01, 'UL', 0) # Data format version
|
||||||
del metadata['totalAvailableBytes']
|
del metadata['totalAvailableBytes']
|
||||||
block.add_new(0x02, 'OB', msgpack.packb(metadata))
|
block.add_new(0x02, 'OB', msgpack.packb(metadata))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user