imagej / ImageJ

Public domain software for processing and analyzing scientific images
http://imagej.org
Other
576 stars 227 forks source link

Added check for MSR files in ij.io.Opener.getFileType() #223

Closed salehtahini closed 1 year ago

salehtahini commented 1 year ago

ImspectorPro MSR files lack proper public documentation and appear to have a header with "CProperty" or "CDataStack" in the first 30 bytes, followed by metadata. Given the random structure of the header and having metadata at offset 128, some files are interpreted as DICOM files and ImageJ tries to open them as such. The majority of our files start with 0x080000.

I added a small check for the file extension. If the file extension is MSR, getFileType will return unknown and Bio-Formats can handle the files correctly. I didn't add a check for the magic strings "CProperty" and "CDataStack" because there might be files that have a different string that is unknown so far and Bio-Formats checks for the strings. There shouldn't be any DICOM files that actually have .MSR file extension.

rasband commented 1 year ago

This check for MSR files in Opener.getFileType() is in the ImageJ 1.54g15 daily build. The commit is at https://github.com/imagej/ImageJ/commit/53b0f93d34cd8ce2ca25c6f68f63d8fd85ab5c61.