LabCanvas

How to open .czi, .nd2, .lif and other microscope files in ImageJ (Bio-Formats)

Open Zeiss .czi, Nikon .nd2 and Leica .lif files in ImageJ with Bio-Formats (built into Fiji), keep the pixel size, and fix "Unsupported format".

ImageJ 1.54f Image › Properties on a synthetic 16-bit nuclei image saved as TIFF: pixel width and height 0.325 micron read from the file, and the title bar giving 166.40 × 166.40 microns
ImageJ 1.54f Image › Properties on a synthetic 16-bit nuclei image saved as TIFF: pixel width and height 0.325 micron read from the file, and the title bar giving 166.40 × 166.40 microns.
Contents

To open a .czi (Zeiss), .nd2 (Nikon), .lif (Leica) or other microscope file in ImageJ, use Bio-Formats: in Fiji it is built in, so drag the file onto the Fiji window or choose File › Import › Bio-Formats, set View stack with: Hyperstack and click OK. Channels, slices, time points and the pixel size come in from the file's metadata. Plain ImageJ 1.x needs Bio-Formats added first (one .jar in the plugins folder); without it, it stops with "Unsupported format or file not found".

To pass the image on with its scale intact, save it as TIFF or OME-TIFF, never as JPEG or PNG.

What Bio-Formats is

Bio-Formats is an open-source library from the Open Microscopy Environment (OME) that reads well over a hundred life-science file formats and turns their metadata into one common model, OME (Linkert et al. 2010). In ImageJ it appears as a set of plugins: the Bio-Formats Importer, the Bio-Formats Exporter, a windowless importer that reuses your last settings, and a few helpers.

FileMade byOpens in FijiOpens in plain ImageJ 1.x
.cziZeiss ZENYes (Bio-Formats)Only after installing Bio-Formats
.nd2Nikon NIS-ElementsYes (Bio-Formats)Only after installing Bio-Formats
.lif, .lofLeica LAS XYes (Bio-Formats)Only after installing Bio-Formats
.oib, .oir, .vsiOlympus / EvidentYes (Bio-Formats)Only after installing Bio-Formats
.lsmZeiss (older confocals)YesOnly after installing Bio-Formats
.imsBitplane ImarisYes (Bio-Formats)Only after installing Bio-Formats
.tif, OME-TIFFAnyYesYes (OME metadata needs Bio-Formats)

How to open .czi, .nd2 and .lif files in Fiji

  1. Open the file. Drag it onto the Fiji main window, or use File › Open…: Fiji hands files it cannot read itself to Bio-Formats. To see every option, use File › Import › Bio-Formats instead.
  2. Fill in the Bio-Formats Import Options (the settings below). Fiji remembers them for next time.
  3. Choose the series, if asked. A .lif project, a multi-position .nd2 or a .czi with several scenes holds many images; a second dialog lists them so you can tick the ones to open.
  4. Check the scale with Image › Properties…: pixel width and height in µm, and the right numbers of channels (c), slices (z) and frames (t).

The Bio-Formats Import Options that matter

OptionWhat it doesUsual choice
View stack withThe viewer: Hyperstack (default), Standard ImageJ (old macros only), Data Browser, Image5D, View5D, or Metadata onlyHyperstack
Stack orderThe order of the planes, XYCZT by defaultLeave as is
Color modeDefault (as stored), Composite (channels merged), Colorized, Grayscale, CustomComposite for a merge, Grayscale to measure
AutoscaleSets the display range from the dataOn; it changes only the display, not the pixel values
Split channels / Split focal planes / Split timepointsEach channel, plane or time point as its own windowOff, unless you want separate images
Open all seriesOpens every image in the file without askingOff for a big .lif; pick series instead
Concatenate series when compatibleJoins series of the same size into one stackFor tiles or positions you want together
Use virtual stackReads planes from disk as you view themOn for files larger than your memory
Specify range for each seriesOpens only some channels, slices or framesFor huge time-lapses
Crop on importOpens only a regionFor large tiled scans
Display metadata / Display OME-XML metadataShows the acquisition settings in a tableWhen you need the objective, exposure or laser lines
Group files with similar namesOpens a numbered series of files as one datasetFor one-file-per-plane exports

The same importer can run from a macro; the Macro Recorder (Plugins › Macros › Record…) writes the exact line for your settings, for example run("Bio-Formats Importer", "open=/path/to/file.czi autoscale color_mode=Default view=Hyperstack stack_order=XYCZT");.

How to install Bio-Formats in plain ImageJ 1.x

Fiji users can skip this: Bio-Formats is already there and the Fiji Updater (Help › Update…) keeps it current. For plain ImageJ 1.x:

  1. Download bioformats_package.jar from the Bio-Formats download page on the OME website (openmicroscopy.org).
  2. Put it in the plugins folder inside your ImageJ folder (on a Mac, ImageJ.app's plugins folder; File › Show Folder › Plugins opens it).
  3. Restart ImageJ. A Plugins › Bio-Formats submenu appears, with Bio-Formats Importer and Bio-Formats Exporter, and File › Open now passes unknown formats to Bio-Formats.

The Bio-Formats documentation warns about one common mistake: two copies of bioformats_package.jar in the plugins folder. Delete the old one before you add a new one.

"Unsupported format or file not found": what it means

Plain ImageJ 1.x reads TIFF, JPEG, PNG, GIF, BMP, DICOM, FITS, PGM, AVI and a few more on its own. Give it anything else without Bio-Formats and it stops with an error. The wording depends on how the file was opened; the two messages in ImageJ 1.54f are "Unsupported format or file not found" and "Format not supported or reader plugin not found".

ImageJ error dialog: Unsupported format or file not found, for a file named Experiment_01.nd2
Plain ImageJ 1.54f with no Bio-Formats, opening a stand-in file with the .nd2 extension: Unsupported format or file not found 1. The folder part of the path is shortened here.

Work through it in this order:

  1. Is the path right? The same message appears when the file does not exist (a network drive that dropped, a file still syncing from the cloud).
  2. Is Bio-Formats installed? In plain ImageJ, look for Plugins › Bio-Formats. If it is missing, install it as above, or use Fiji.
  3. Is it up to date? New acquisition software versions sometimes write files an old Bio-Formats cannot read. In Fiji, run Help › Update…; in plain ImageJ, replace the jar.
  4. Still failing? Export the image as OME-TIFF from the acquisition software and open that.

How to keep the scale: check it, then save as TIFF or OME-TIFF

A microscope file carries its pixel size, and most measurements depend on it. Check it once the image is open.

Image › Properties… shows the pixel width and height with their unit, and the numbers of channels, slices and frames. Image › Show Info… lists the same and more: the size in µm, the resolution, the bit depth and the range of values.

ImageJ Image Properties dialog showing a pixel width of 0.325 micron for a TIFF
Plain ImageJ 1.54f on the synthetic nuclei sample saved as a TIFF: Image › Properties shows 0.325 µm per pixel, read from the file 1, and the title bar gives the field size, 166.40 × 166.40 microns 2.
ImageJ Show Info window listing width and height in microns, resolution, pixel size and bit depth
Image › Show Info on the same TIFF: 166.4 µm wide and high 1, 3.0769 pixels per micron, so 0.325 µm pixels 2, and still 16-bit 3.

Now the same image saved as JPEG and opened again. The pixels look the same, but the scale and the bit depth are gone:

ImageJ Image Properties dialog for the same image saved as JPEG: pixel width 1, unit pixel
The same nuclei image after File › Save As › Jpeg and reopening it in ImageJ 1.54f: 1 pixel = 1 pixel 1, and 512 × 512 pixels, 8-bit in the title bar 2. The 16-bit values and the 0.325 µm scale are lost, and JPEG compression has changed the pixel values.

So, to pass an image from a .czi or .nd2 to a colleague, a figure or another program:

  • File › Save As › Tiff… in ImageJ or Fiji writes an ImageJ TIFF: raw values, the hyperstack layout, the pixel size, slice spacing and frame interval in the file's description. ImageJ and Fiji read it back unchanged.
  • OME-TIFF is the open standard that other programs read too (OMERO, napari, QuPath, CellProfiler, Python). In Fiji, use Plugins › Bio-Formats › Bio-Formats Exporter and give the file a name ending in .ome.tif. Bio-Formats also has a command-line converter, bfconvert, for whole folders.
  • Not JPEG or PNG for anything you will measure: they hold 8-bit pictures without a calibration.

Pitfalls

  • The scale did not come through. If Image › Properties shows 1 pixel = 1 pixel after import, the file had no calibration or the reader could not find it. Set it from the objective and camera (the pixel size calculator does the sums) or from a stage micrometer; see how to set the scale in ImageJ.
  • Slices and frames swapped. A time-lapse that opens as a Z-stack makes every per-frame tool wrong. Fix it in Image › Properties by swapping the numbers of slices and frames, or with Image › Hyperstacks › Stack to Hyperstack… for a plain stack.
  • Autoscale is not data. Autoscale and Color mode change the display only. Measure on the raw values, and never measure on a copy flattened to RGB.
  • The wrong series. A .lif or a slide scan can hold dozens of series, including thumbnails, labels or overview images at lower resolution. Check the size and pixel size of the series you opened.
  • Running out of memory. A big file can be larger than ImageJ's memory limit. Tick Use virtual stack, open a range of planes, or raise the limit in Edit › Options › Memory & Threads….
  • A screenshot is not an image. Copying from the vendor viewer or exporting "as displayed" gives an 8-bit RGB picture with contrast already applied. Export the raw data.

Reporting it

A methods sentence to copy, with the parts in brackets filled in:

Images were acquired as [.czi] files and opened in [Fiji (ImageJ 1.54f)] with the Bio-Formats importer [version], which read the pixel size ([0.325] µm) from the file metadata. Images were analysed on the raw [16-bit] data and exported as OME-TIFF for [figure preparation / analysis].

Cite Bio-Formats (Linkert et al. 2010) and Fiji (Schindelin et al. 2012). Keep the original vendor files: they hold the full acquisition metadata (objective, exposure, laser lines), and journals and repositories increasingly ask for them.

An easier way: measure the exported TIFF in LabCanvas

Once the file is a TIFF or OME-TIFF, you can measure it in LabCanvas Image Analysis, in the browser with nothing to install. It does not read vendor formats: .czi, .nd2, .lif, .lsm, .oib, .vsi and .ims need exporting first, as above.

  1. Export from Fiji (File › Save As › Tiff…, or the Bio-Formats Exporter for .ome.tif) or from the acquisition software as OME-TIFF.
  2. Open Image Analysis and drop the file on the window. Channels, slices, frames, pixel size, slice spacing, frame interval and channel names come in from the file.
  3. Read the image check: it reports the bit depth, clipped pixels and the scale, so you know whether the calibration survived the export.
  4. Measure in the Measure tab; lengths and areas come out in µm or nm with no Set Scale step.
Length and area in calibrated units in LabCanvas Image Analysis
Length and area in calibrated units: Three nanorods measured with the line tool, 418.3, 652.8 and 454.1 nm long, and a fourth outlined with the wand: area 14,356.3 nm², perimeter 975.8 nm 2.5 nm per pixel, from the file.
Image check in LabCanvas Image Analysis
Image check: All fine: nothing clipped brightest value 3,688, even illumination the background varies by 1.06×, sharpest at slice 8 of 15.
Z-stack projection in LabCanvas Image Analysis
Z-stack projection: Maximum intensity projection of slices 1–15 of the bead Z-stack: the beads from every depth sharp in one 256 × 256 image.

Why it is a good choice for the exported file:

  • Nothing to install, on any computer or tablet, and TIFF, BigTIFF and OME-TIFF (8-, 16- and 32-bit, stacks and hyperstacks) open with their calibration, as do ImageJ ROI files (.roi, RoiSet.zip).
  • An image check on opening that flags a lost scale, clipping and JPEG compression before you measure.
  • ImageJ's names and measurements, with a methods sentence under every table and Send to Graphs for the statistics.
  • Free with a LabCanvas account; downloading files is part of LabCanvas Pro.

For the vendor files themselves, Fiji with Bio-Formats remains the tool: it reads them directly, handles multi-series projects and pyramids, and opens files larger than memory as virtual stacks. Open Image Analysis, or read the complete guide for every format it reads.

ImageJ and Fiji are independent open-source projects; LabCanvas is not affiliated with them.

References

  • Linkert M, Rueden CT, Allan C, Burel JM, Moore W, Patterson A, et al. (2010). Metadata matters: access to image data in the real world. Journal of Cell Biology 189, 777–782. doi:10.1083/jcb.201004104
  • Schindelin J, Arganda-Carreras I, Frise E, et al. (2012). Fiji: an open-source platform for biological-image analysis. Nature Methods 9, 676–682. doi:10.1038/nmeth.2019

Frequently asked questions

How do I open a .czi file in ImageJ?

Use Fiji, which includes Bio-Formats: drag the .czi onto the Fiji window or use File › Import › Bio-Formats, choose View stack with: Hyperstack, and click OK. In plain ImageJ 1.x, first put bioformats_package.jar from the Bio-Formats download page in the plugins folder and restart; then use Plugins › Bio-Formats › Bio-Formats Importer.

How do I open .nd2 files in ImageJ?

The same way as .czi: Bio-Formats reads Nikon NIS-Elements .nd2 files. In Fiji, File › Import › Bio-Formats (or File › Open); multipoint or multi-well acquisitions may appear as several series, so tick Open all series or pick the ones you need in the series list.

Why does ImageJ say "Unsupported format or file not found"?

Plain ImageJ 1.x has no reader for that file type, usually because Bio-Formats is not installed, or the path is wrong. Install Bio-Formats (or use Fiji, which includes it), or export the image as TIFF or OME-TIFF from the acquisition software. If Bio-Formats is installed and the file still fails, update it: newer versions of a format often need a newer reader.

Is Bio-Formats included in ImageJ?

It is included in Fiji, and kept up to date by the Fiji Updater. Plain ImageJ 1.x does not include it; you add it by dropping bioformats_package.jar into the plugins folder.

Does Bio-Formats keep the scale (pixel size) of my image?

Yes, when the file stores it: the pixel size, slice spacing, frame interval and channel names are read from the metadata and set on the image. Check them in Image › Properties. Saving the result as TIFF or OME-TIFF keeps them; saving as JPEG or PNG does not.

Can LabCanvas open .czi or .nd2 files?

No. LabCanvas Image Analysis reads TIFF, BigTIFF and OME-TIFF (with their pixel size, channels, slices and frames), PNG, JPEG, WebP, GIF and BMP. Export the file as OME-TIFF from the acquisition software or from Fiji, and it opens with its scale.

Bio-Formats ImageJhow to open czi files in ImageJhow to open nd2 files in ImageJImageJ Bio-Formats pluginlif files ImageJOME-TIFFFijipixel sizemicroscope file formatsUnsupported format or file not found

Try it in LabCanvas

Every app is free to start in your browser. Create an account and begin.

Start Image Analysis free in your browser