Converting dm3 Files

Converting dm3 Files into Other Formats

Digital Micrograph files (dm3 files) use a proprietary format from Gatan that contains a huge amount of useful metadata from the microscope and the CCD camera (information such as magnification, exposure length, a recording timestamp, pixel size, etc.). Unfortunately, this format is not easy to display using commonly available image display software. However, it is possible to convert dm3 files into formats that can be more easily displayed in several different ways.

Digital Micrograph

Digital Micrograph (DM) can be used to convert dm3 files into JPEG, TIFF, BMP and MRC format files. This must be done using a licensed copy of DM running on a Windows PC, and can be accomplished using both the version of DM on the JEOL JEM 3200FS and also the version on the EMC's Windows PC located in the Nanoscale Characterization Facility (NCF). DM can convert dm3 files in two fundamentally different ways:

  1. individual files: while displaying an image using DM, highlight the dm3 file and click on "Save as" in the "File" dropdown menu. This will open a window that allows the user to chose the name of the new file and the format for the new file. You should note that dm3 images are not able to be saved as signed 32-bit integers.
  2. entire folders of files: select "Batch convert" in the "File" dropdown menu. This will open a window that allows the user to chose a folder and the file format. After choosing the file format, click "OK" and every dm3 file in the selected folder (and all sub-folders, if that checkbox is checked) will be converted to the selected format. The TIFF format used for batch conversion makes 8-bit integer images and retains a scale bar (but the length is printed using a font that is so small it is nearly invisible).

proc2d

proc2d is a general image manipulation program that is part of the EMAN1 package. It is a command-line driven program available on Karst and can convert dm3 files into PNG and MRC format files:

$ pro2d image.dm3 myFile.png
$ pro2d image14.dm3 another_image.mrc

The PNG files created this way are 24-bit (8-bit per channel) RGB images. The MRC images are stored as 32-bit floating point numbers and this is the best way to convert dm3 files into another format for further image processing since nothing numerical is done to the images except to convert from signed 16-bit integers to floating point numbers. On the other hand, do not be surprised when the proc2d program appears to invert the top and bottom of an image during these conversions.

bconvert Section

bconvert is a conversion tool from the Bsoft suite of programs. It is a command-line driven program available on Karst and is similar to proc2d except that it essentially only performs image format conversions. bconvert will convert any of the image formats that Bsoft understands (including dm3 files) into either PIF ("Portable Image Format," the native file format for auto3dem) or MRC files. Both these file formats are useful for further image processing, but remember that some image display programs (e.g., imageJ) will be understand MRC but not PIF file formats. Unlike proc2d, bconvert will convert multiple files using a single command-line innvocation:

$ bconvert myImage.dm3
$ bconvert *dm3
$ bconvert image1.dm3 image2.tif image3.jpp image4.jpeg

All these commands will output PIF image files where the name of the output file(s) are identical to the input files except that the file name extension has been replaced by "pif" (e.g., myImage.dm3 becomes myImage.pif). To convert into MRC format instead of PIF, use the following commands:

$ bconvert -output mrc myImage.dm3
$ bconvert -output mrc *dm3
$ bconvert -output mrc image1.dm3 image2.tif image3.jpg image4.jpeg

This last command will produce image1.mrc, image2.mrc, image3.mrc and image4.mrc.

Scripts on Karst

All users on Karst should have access to programs and file manipulation tools that are designed to work with the data collected using the microscope. Among these are several scripts that can be used to convert dm3 images into MRC, PNG or TIFF format. These scripts make use of other programs such as proc2d command from EMAN1 and imageJ from the NIH and their most useful feature is that they allow the user to convert lots of dm3 files using a single command entered on the command line:

$ dm2mrc.sh
$ dm2png.sh <shrink_factor>
$ dm2tiff.sh <scale_bar_length>

These commands will convert all the dm3 files in the current directory into either MRC, PNG or TIFF files. The command line argument "shrink_factor" allows for the output PNG images to be reduced in size by the value set with "shrink_factore" (e.g., the command "dm2png.sh 4" will convert 4098 x 4098 dm3 files into 1024 x1024 PNG files) while the "scale_bar_length" argument controls the length of the scale bar that will be placed in the TIFF images (e.g., the command "dm2tiff.sh 100" will convert dm3 files into TIFF files that have a scale bar of length 100 of whatever units will be most appropriate for a given image, usually nm or µm).

Since some files with the dm3 extension are not standard image files (e.g., EELS spectra recorded using DigitalMicrograph), using these commands (scripts) will occasionally create "empty" files when the conversion is not possible.

This list of conversion programs and scripts is not meant to be exhaustive, and other software packages installed on Karst may have programs that can convert dm3 files into formats that are more useful for image processing.

NOTE: Many image format conversion programs numerically alter the original image data and can result in the loss of information. For example, the dm3 files saved by the 3200FS are stored as signed 32-bit integers (even though the CCD camera only produces 16-bit data), and starting from the same dm3 image, DM will save TIFF images that are unsigned 8-bit, unsigned 16-bit or signed 32-bit integers. DM can also save the same signed 32-bit dm3 images as compressed 24-bit JPEG images (an RGB image with 8 bits/channel) or an MRC image stored as 8-bit integers (MRC mode 0). All of these conversions made by DM alter the images numerically either by losing bit-depth (conversion to 8- or 24-bit images) or by adding a constant to each pixel in the image (16-bit TIFF images). Such numerical alterations are undesirable when further image processing is planned, and as mentioned above, it is best to convert dm3 files into MRC files using proc2d.