Author: Pierre-Ivan Raynal (https://microscopies.med.univ-tours.fr/)
Contributions by Philippe Mallet-Ladeira and Jordan Chess
This Python module is an adaptation and extension of the DM3_Reader ImageJ plug-in by Greg Jefferis.
It allows to extract image data, metadata (specimen, operator, HV, MAG, etc.) and thumbnail from GATAN DigitalMicrograph 3 and 4 files. In particular, it can dump all metadata (“Tags”), pass thumbnail and image data as PIL Images or Numpy arrays, as well as save the included thumbnail in a PNG file. (It was initially meant to be called by a script indexing electron microscope images in a database.)
- Numpy
- Pillow (fork of Python Imaging Library)
- Matplotlib
- SciPy
- IPython IDE
Use in your own script would typically require lines such as:
import dm3_lib as dm3 import matplotlib.pyplot as plt # parse DM3 file dm3f = dm3.DM3("sample.dm3") # print some useful image information print dm3f.info print "pixel size = %s %s"%dm3f.pxsize # display image plt.ion() plt.matshow(dm3f.imagedata, vmin=dm3f.cuts[0], vmax=dm3f.cuts[1]) plt.colorbar(shrink=.8)
A more detailed example is located in the site-packages/dm3_lib/demo
directory
under the name demo.py
.
Not all data types are implemented yet.