Skip to content

Problem writing dicom file after decompression #1586

Answered by mrbean-bremen
jstefanis asked this question in Q&A
Discussion options

You must be logged in to vote

Your data is in a compressed transfer syntax (JPEG Baseline), while pixel_array is uncompressed data (it does the decompression on the fly). So, either you have to change the transfer syntax to match your data (e.g. use Little Endian Explicit), or you have indeed to compress and encapsulate the data first. It is probably easier to write the data uncompressed by changing the TransferSyntaxUID, even if the file gets larger that way:

ceus_fixed.PixelData = result.tobytes()
ceus_fixed.fix_meta_info()
ceus_fixed.file_meta.TransferSyntaxUID = ExplicitVRLittleEndian
ceus_fixed.save_as(filepath, write_like_original=False)

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by scaramallion
Comment options

You must be logged in to vote
2 replies
@mrbean-bremen
Comment options

@scaramallion
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants