BioImage Convert: Command-Line Interface Reference

Written by

in

BioImage Convert: Command-Line Interface Reference The imgcnv command-line utility is a powerful tool designed for the conversion, processing, and metadata extraction of multi-dimensional biomedical images. It supports a wide array of formats, including proprietary microscope formats (such as Carl Zeiss LSM, Leica LIF, and Olympus OIB) and standard scientific formats (like OME-TIFF and DICOM).

This reference guide provides the syntax, essential commands, and practical examples for integrating imgcnv into automated image processing pipelines. Basic Command Syntax

The general syntax for the imgcnv command-line tool follows this structure:

imgcnv -i -o -t [options] Use code with caution. Core Arguments

-i : Specifies the path to the input image file or directory.

-o : Specifies the path and name of the output file.

-t : Defines the target output format (e.g., tiff, ome-tiff, jpeg, png, bwt). Common Format Identifiers

When using the -t flag, specify one of the following common format strings: Description tiff Standard Tagged Image File Format .tif, .tiff ome-tiff OME-TIFF (Open Microscopy Environment) .ome.tif png Portable Network Graphics (8-bit/16-bit) .png jpeg Joint Photographic Experts Group (8-bit lossy) .jpg klb Keller Lab Block compressed format .klb Meta-Data Extraction

Extracting metadata is often the first step in a bioimaging pipeline to understand pixel dimensions, channel counts, and spatial resolution. Print Metadata to Console

To view all header and geometry information without writing a new image file: imgcnv -i input_image.lsm -meta Use code with caution. Export Metadata to XML

To save the structured OME-XML metadata into an external file: imgcnv -i input_image.czi -meta-xml > metadata.xml Use code with caution. Image Transformation and Conversion Options

imgcnv allows modifications to the spatial and dimensional characteristics of images during the conversion process. 1. Dimensional Extraction (Slicing)

Biomedical images often contain 5 dimensions: X, Y, Z (slices), C (channels), and T (time points). You can isolate specific sub-volumes.

Extract specific channel: Extract only the second channel (index 1). imgcnv -i input.lif -o channel1.tif -t tiff -ch 1 Use code with caution. Extract Z-slice range: Extract slices 10 through 20. imgcnv -i input.oib -o z_range.tif -t tiff -z 10:20 Use code with caution. 2. Spatial Resizing and Pixel Scaling

Resize Dimensions: Resize the image to specific X and Y pixel dimensions.

imgcnv -i large_image.tif -o small_image.png -t png -resize 512,512 Use code with caution.

Force Resolution: Override or inject pixel resolution metadata (in microns).

imgcnv -i input.raw -o fixed.tif -t tiff -resolution 0.25,0.25,1.0 Use code with caution. 3. Intensity Scaling and Bit-Depth Conversion

Demote 16-bit to 8-bit: Convert a high-dynamic-range image to an 8-bit format suitable for standard displays, using auto-scaling.

imgcnv -i 16bit_input.nd2 -o 8bit_output.jpg -t jpeg -depth 8 -display-auto Use code with caution. Advanced Pipeline Examples

Example 1: Convert a 3D Stack to a 2D Maximum Intensity Projection

To project a 3D Z-stack into a single 2D image by keeping the brightest pixels along the Z-axis:

imgcnv -i brain_stack.lsm -o projection.tif -t tiff -project max Use code with caution. Example 2: Batch Processing via Shell Loop

To convert a directory full of proprietary .czi files into standard compressed .tif files using a bash loop:

for file in.czi; do imgcnv -i “\(file" -o "\){file%.czi}.tif” -t tiff done Use code with caution. Error Handling and Troubleshooting

Format Not Supported: If imgcnv fails to recognise an input file, verify the format using imgcnv -formats to list all compiled image readers and writers.

Memory Issues: Multi-gigabyte tiles or time-series can cause memory exhaustion. Use the -tile option if supported by your build to process images in smaller blocks.

To help tailor this guide or troubleshoot a specific workflow, let me know:

What input image format (e.g., CZI, LIF, LSM) you are currently working with?

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *