Unscrambling obfuscated pixel data in Carl Zeiss Meditec (CZM) ophthalmic datasets #1618
Replies: 4 comments 3 replies
-
I've just spend 2 days doing exactly the same thing only to be sent this link by a coworker :D |
Beta Was this translation helpful? Give feedback.
-
Your work is really helpful! |
Beta Was this translation helpful? Give feedback.
-
@scaramallion: do you have a link to an example of the DICOM file in question? |
Beta Was this translation helpful? Give feedback.
-
@scaramallion this is impressive, and very useful in my current project. For educational purposes, could you briefly jot down how you approached this issue? Thanks for doing this! |
Beta Was this translation helpful? Give feedback.
-
I was recently asked to try and decipher some extremely non-conformant DICOM datasets nominally from Carl Zeiss Meditec (CZM) ophthalmic equipment for producing OCT angiography and related images, such as the Cirrus range. The datasets are non-conformant in multiple ways, but perhaps the most serious is that CZM appear to have deliberately obfuscated the pixel data to prevent others from using it.
I'm happy to say I've succeeded in reversing that obfuscation, although for a while there I really thought it wouldn't be possible. I'm posting the solution here for two reasons:
The pixel data is obfuscated in two ways:
0x5A
The sample datasets I received were horribly non-conformant, but I'm not sure if that was an artefact of how they were obtained or if that's actually how CZM equipment produces them (in which case, wow). The pixel data also has a JP2 header, which again is non-conformant to the DICOM Standard, so be aware of that and remove it if required (search for the
0xFF 0x4F
start-of-codestream J2K marker, which should be at offset 85 of the unscrambled data).So without further ado, here's how to unscramble the pixel data and write it to file as a sane JPEG 2000 file with JP2 header. Alternatively you could uncompress the unscrambled frame using Pillow or your preferred third-party J2K library.
Beta Was this translation helpful? Give feedback.
All reactions