Python DM3 Reader

Ce module Python est une adaptation du plug-in DM3_Reader (développé par Greg Jefferis) pour ImageJ. Il permet d’extraire les données et méta-données des fichiers DM3 (et DM4) produits par le logiciel DigitalMicrograph de GATAN.

This Python module is a transposition and adaptation of the DM3_Reader ImageJ plug-in by Greg Jefferis.

This module was initially meant to be called by a script indexing electron microscope images into a database. It now allows to extract various metadata (specimen, operator, HV, MAG, etc.) from GATAN DigitalMicrograph DM3 or DM4 files. It may also extract and dump all metadata (« Tags ») and pass thumbnail and image data as PIL Images or Numpy arrays, as well as save the thumbnail view in a PNG file.

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 "pixel size = %s %s"%dm3f.pxsize
# display image
plt.matshow(dm3f.imagedata, vmin=dm3f.cuts[0], vmax=dm3f.cuts[1])


  • Dependencies : Python Imaging Library, NumPy
  • Tentative support for Python 3

There is a public Git repository at GitHub: pyDM3reader where one may find the latest stable and development versions.

(initially published on the ImageJ Wiki)