ihmwg / IHMCIF

šŸ“– mmCIF support for hybrid/integrative models
https://pdb-dev.wwpdb.org
Creative Commons Zero v1.0 Universal
21 stars 3 forks source link

nup84 2D EM map in PGM format can't be read by Python Image Library #33

Closed tomgoddard closed 7 years ago

tomgoddard commented 7 years ago

The 2D EM map in the nup84.cif example is in ASCII PGM format which is not supported by the Python Image Library (Pillow 4.0.0, latest available). Binary PGM is supported. This is such an obscure format it is not worth adding support in ChimeraX to read it. Better to convert to a commonly used format like MRC or CCP4 or PNG or TIFF to make the example represent best practice.

benmwebb commented 7 years ago

Unfortunately the code in IMP to handle 2D EM maps only works with ASCII PGM format, so we can't change the file in the repository. It has to reflect what was actually done in the modeling.

Fortunately the file format is very simple and the parser is correspondingly simple. You can certainly steal Dina's code to parse it.

tomgoddard commented 7 years ago

I think the best solution is to not replace the PGM map but simply add another copy to the repository in a format that we encourage people to use and reference that copy from the IHM file. I know the format is trivial to read but the Python image library does not read it, and no one in 10 years of Chimera use by virtually the whole single particle EM field has requested using ascii pgm ā€” so it is hard for me to justify spending a day making a patch to the Python image library that will be incorporated in some future release. Iā€™d suggest converting the PGM to MRC format which is the most commonly used EM image format, but also TIF or PNG would be fine.

On May 5, 2017, at 2:52 PM, Ben Webb notifications@github.com wrote:

Unfortunately the code in IMP to handle 2D EM maps only works with ASCII PGM format, so we can't change the file in the repository. It has to reflect what was actually done in the modeling.

Fortunately the file format is very simple and the parser is correspondingly simple. You can certainly steal Dina's code https://github.com/salilab/imp/blob/develop/modules/em2d/include/internal/Image2D.h#L141 to parse it.