In addition to IMOD, this tutorial utilizes the Fiji image processing package (http://fiji.sc/wiki/index.php/Fiji), which contains a number of useful routines. Fiji can be installed directly into your NCMIR home directory, and installation is quick and simple.

This tutorial assumes you will be using the 64-bit Linux version of Fiji and that you already have IMOD installed.

(A) Installing Fiji

1. Download the appropriate version of Fiji from the following link: http://fiji.sc/wiki/index.php/Downloads. Save the file to your home directory (/home/user).

2. Untar the downloaded file using the following command:

$ tar xvjf fiji-linux64-20110307.tar.bz2

3. This will create a directory in your home folder entitled Fiji.app. The main executable for Fiji, fiji-linux64, is located within this directory.

4. For ease of use in the future, you will want to create an alias to this executable. Add the following to your .bashrc file:

alias fiji="~/Fiji.app/fiji-linux64"

(B) Preparing your Raw Data

We will be utilizing a batch processing procedure in which Fiji operates on individual TIFF files one at a time. Assuming you are starting with an MRC stack, you will first need to convert this stack to individual TIFF images.

1. Create subdirectories to store the raw and processed TIFF series. For example, if the working directory of your MRC file is /home/user/dir, you will want to create the subdirectories RAW and PROC within the working directory. While you are located in the working directory:

$ mkdir RAW
$ mkdir PROC

2. If your dataset is large (>1000x1000), I recommend binning by a factor of two in X and Y to achieve better results. If this is the case, perform the binning using newstack:

$ newstack -bin 2 basename.mrc basename_2Dbin2.mrc

The rest of this tutorial will assume you are working with the binned dataset.

3. Open the MRC stack in IMOD:

$ 3dmod basename_2Dbin2.mrc

4. Determine the appropriate black and white contrast values for the whole stack.

  • In the 3dmod window, check the Float and Subarea boxes and click the Auto box to autocontrast the current slice. Next, uncheck the Float box and play through the slices of the stack from top to bottom using the PAGE-UP and PAGE-DOWN keys. You want the nuclei to remain brightly contrasted throughout the stack, like in the image below. Tewak th black and white values until you achieve this, and make a note of these two values.

5. Perform the conversion from an MRC stack to a series of individual TIFF files using the following command:

$ mrc2tif -C BLACK,WHITE basename_2Dbin2.mrc ./RAW/basename_2Dbin2

Where BLACK and WHITE are the integer values that provide the best contrast as determined in Step 2.

(C) Perform Thresholding on A Single TIFF Image

1. Start Fiji and open the first image in the TIFF series:

$ fiji ./RAW/basename_2Dbin2.000.tif

2. Apply a low-pass Gaussian filter with a radius of 2.0 (Process -> Filters -> Gaussian Blur). This helps reduce noise, which is critical for thresholding.

  • You will need to tweak the value of the Gaussian radius to fit the needs of your own individual data. A radius of 2.0 worked well for my data.

3. Invert the contrast of the image so that the DAPI staining appears black against a white background (Edit -> Invert). This is necessary for the binary operations we are about to apply.

4. Perform the actual thresholding of the nuclei (Image -> Adjust -> Auto Threshold).

  • Check the 'White objects on black background' box.
  • Fiji has 16 different thresholding algorithms. Descriptions of each algorithm can be found here: http://fiji.sc/wiki/index.php/Auto_Threshold. You can display the results of performing each of the 16 algorithms on your data in a montaged window by selecting 'Try all' from the Method pull-down menu. You can use this to determine which algorithm is best for your needs.
  • For my data, I found that the Huang algorithm most reliably thresholded the nuclei, and the rest of the tutorial will be written using the Huang algorithm.
  • Select 'Huang' from the Method pull-down menu and click the OK button.
  • Your image should now be 8-bit and binary (ie: has only black and white values). If it is not 8-bit, be sure to convert it to 8-bit: Image -> Type -> 8-bit.

5. Use the binary operator 'Fill Holes' to fill obvious holes in nuclei that weren't positively detected during thresholding (Process -> Binary -> Fill Holes).

6. The Huang thresholding algorithm tends to overestimate the size of nuclei. Perform one round of erosion to remove a ring of pixels around each detected object (Process -> Binary -> Erode).

7. Thresholding has the undesirable effect of frequently combining many nuclei into one single globular object. The Watershed algorithm can be used to separate detected objects into individual nuclei. The accuracy of this method is highly dependent on a number of parameters, including the quality and magnification of the raw data. It's not perfect, but it does a reasonable job as a first approximation. Select the Watershed operation from the menu (Process -> Binary -> Watershed).

?

8. Tweak the parameters of Steps 1-7 until you are happy with the output. DO NOT save the image.

(D) Perform Thresholding on Every TIFF Image Using Batch Processing

Our next goal is to perform each of the above operations on every image. Fiji and ImageJ provide a macro scripting interface to accomplish this.

1.

input = "/home/user/dir/RAW";
output = "/home/user/dir/PROC/";

setBatchMode(true);
list = getFileList(input);
for (i = 0; i < list.length; i++)
        DAPI_nuclei_threshold(input, output, list[i]);
setBatchMode(false);

function DAPI_nuclei_threshold(input, output, filename) {
        open (input + filename);
        run("Gaussian Blur...", "sigma=2");
        run("Auto Threshold", "method=Huang white");
        run("Invert");
        run("Fill Holes");
        run("Erode");
        run("Watershed");
        saveAs("Tiff", output + filename);
        close();
}