Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions docs/source/workflows/2d_EM.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
******
Small 2D Workflow (EM Microscopy)
******

Overview:

This workflow generates a thumbnail and a key images for each input image in a directory. Specific EM file formats
use enhanced resampling and filtering techniques to reduce noise while adjusting the dynamic range of the images. This
workflow originally was designed to handle DM3 files from TEM or STEM microscopes but has been extended to handle
other 2D image file formats, including MRC, TIFF files and color figures.

Outputs:
1. A thumbnail image for each input image.
- An JPEG image with a maximum size of 300 pixels in both dimension.
- The aspect ratio is preserved and may be shortened to fit within the maximum size without padding.
- The image may be 8-bit RGB(A) or 8-bit gray-scale.
2. A key image for each input image.
- Similar to the thumbnail image but with a maximum size of 1024 pixels in both dimension.

.. list-table:: Supported Extensions for File Formats
:header-rows: 1

* - Format Type
- Description
- Extensions
* - DM3
- image format used by Digital Micrograph
- dm3
* - DM4
- image format used by Digital Micrograph, maybe limited to 64-bit integers
- dm4
* - MRC
- image format used by the IMOD tool suite
- mrc
* - TIFF
- Standard Tag Image File Format ( TIFF 6.0 ), OME TIFF not supported
- TIFF stacks not supported, only the first page is processed.
- tif, tiff
* - PNG
- Portable Network Graphics
- png
* - JPEG
- Joint Photographic Experts Group
- jpg, jpeg


The toolbox of `IMOD`_ is used primarily to process the EM images, along with `SimpleITK`_ for additional image
processing tasks.


.. list-table:: Summary of Input Image Types
:header-rows: 1

* - Format Type
- Pixel Type
- Description
- Processing Information
* - JPEG, PNG, TIFF
- 8-bit RGB (palette) or RGBA
- Example images include figure, TEM grid image or other illustrative images rendered into a color image.
- Images should directly resized without intensity scaling or advanced filtering.
* - TIFF, PNG, JPEG
- 8-bit gray-scale
- Images may be rendered EM images with captions or annotations.
- Images should directly resized without intensity scaling or advanced filtering.
* - TIFF
- 16-bit (signed or unsigned) gray-scale
- EM images with a high dynamic range.
- Use IMOD's `newstack`_ tool to resample, filter, and scale intensities to 8-bit.
* - DM4 or DM3 Images
- 32-bit float (after MRC conversion)
- Minimally processed EM images with a high dynamic range.
- Convert to MRC via `dm2mrc`_ command to 32-bit float MRC files, then use newstack to resample, filter, and scale
intensities to 8-bit TIFF.
* - MRC (2D only)
- 32-bit float ( no other current sample inputs )
- Expected EM images with likely high dynamic range.
- Convert to 8-bit TIFF via `newstack`_ command to resample, filter, and scale intensities to 8-bit.

.. _IMOD: https://bio3d.colorado.edu/imod/
.. _dm2mrc: https://bio3d.colorado.edu/imod/doc/man/dm2mrc.html
.. _newstack: https://bio3d.colorado.edu/doc/man/newstack.html
.. _SimpleITK: https://simpleitk.readthedocs.io/
2 changes: 2 additions & 0 deletions docs/source/workflows/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ Workflows

.. _ref-workflow-spatial-omics:
.. include:: spatialomics.rst

.. include:: 2d_EM.rst
6 changes: 3 additions & 3 deletions em_workflows/dm_conversion/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ def convert_em_to_tiff(file_path: FilePath) -> Path:
Performs the conversion of EM images to tiff format, adjusting the dynamic range and reducing the size of the image.
Three types of files are detected to need conversion:
- mrc files are converted to tiff using newstack
- 16-bit tiff files are converted to 8 bit tiff
- dm3/dm4 files are converted to mrc using dm2mrc, then to tiff using newstack
- mrc files are converted to tiff using newstack
- 16-bit tiff files are converted to 8-bit tiff
- dm3/dm4 files are converted to mrc using dm2mrc, then to tiff using newstack
EM images are broadly characterized by a low signal-to-noise ratio and a high dynamic range, often with potential
outliers. Using newstack with shrink and antialiasing kernels is required to reduce the noise to produce a
Expand Down