An Intoduction To Biological Image Processing in ImageJ, Part 3: Stacks and Stack Projections

Damian Dalle Nogare
6 min readJul 1, 2019

--

This is part 3 of a series. The first part can be found here.

Just as a regular image is a two-dimensional array or intensity values, an image stack is simply a three-dimensional array, with each plane of the image stack being represented by its own two-dimensional array. As we are often working with image stacks in confocal microscopy given the thin plane of focus, it is important to understand how they function and what manipulations can be performed on them.

As image stacks have three-dimensions and we are often limited to two dimensions (for example on a page or screen), we have to map the three dimensional image to a two-dimensional representation of that image stack. The easiest way to do this is by a stack projection. However, projections can alter the way the image appears or even introduce artifacts, and so it is important to understand exactly how they work.

All stack projections performs some kind of pixel-wise manipulation on all of the pixels in a stack that share a position. Take for example the following three images, each of which is 3x3 pixels. Together, they form an image stack of 3x3x3.

An example image stack consisting of three slices

The easiest way to project these images is simply to sum all the pixel values at each position of each slice.

Calculating the sum intensity projection for the pixel at (0,0)

We build up a final projected image by performing this operation on all of the pixels in the stack. However, there are many ways of projecting an image, each with their own strengths and weaknesses.

One of the most popular and simplest forms of projection is the maximum intensity projection. In this type of projection, at each pixel position, we go through the stacks, find the pixel with the maximum intensity, and that becomes the intensity of that pixel value in the projected image. All of the other pixel values are discarded.

So, at pixel position 0,0 (the top-left corner), the values are as follows

  • Stack 1: 190
  • Stack 2: 200
  • Stack 3: 195

The maximum value of all these is 200, and so our final image gets assigned a value of 200 at position (0,0). All of the remaining (lower intensity) values are discarded.

Likewise, the next down in the first column has values in the three slices of (100, 200, 50), which means the pixel at position (0,1) will also have a value of 200. This highlights a potential pitfall of the maximum intensity projection, which is that all of the pixel variance at any given position is ignored. Pixel (0,0) has intensity values very close to the projected value (190, 200, 195), and so the final value is very representative of the values in each slice. Pixel (0,1), on the other hand, has values of (100, 200, 50), but still has a projected value of 200. As far as the maximum intensity projection is concerned, these pixel positions are identical in the final image, because we are only carrying the brightest pixel to the projection.

The final projection has the following values

The maximum intensity projection of the example stack

Now that you understand the basics of image projection, the remaining projections types are simple to understand.

The average intensity projection simply averages all of the pixel values in the stacks to make the final projected image. For example, the values for the pixel at (0,0) will become (190 + 200 + 195) / 3 = 195. The pixel below this, will be assigned a value of (100 + 200 + 50) / 3 = 116. You can see how in the average intensity projection, the values of all of the pixels at a given position in the stack are taken into account.

The average intensity projection of the example stack

The minimum intensity projection is similar to the maximum intensity projection, except that the minimum pixel value is used for the projected image instead of the maximum pixel value

The minimum intensity projection of the example stack

The standard deviation projection takes the standard deviation of the pixel intensities through the stack. Positions with large differences in the pixel intensities through the stack appear brighter in this projection. For example, the pixel at (0,0) has values of 190, 200 and 195, and so the standard deviation of these is ~4, so the pixel appears almost black in the image. The pixel below, at (0, 1) has values of 100, 200 and 50, which leads to a much higher standard deviation (76)

The standard deviation intensity projection of the example stack

The median projection takes the median pixel intensity for the final projected image

The median intensity projection of the example stack

Finally, the sum slices projection simply adds together all of the pixels in each slice at each position (as we saw at the beginning of this section).

The sum slices intensity projection of the example stack

In this projection, the image is typically re-scaled to a 16-bit image, as the sum of all the pixel intensity value usually exceeds 255, which would result in a completely white 8-bit image.

Below is a comparison of the different types of projections on our small 3x3 test stack, showing that very different final images can be obtained by implementing different projection methodologies.

A comparison of different projection methods

In these images, all from the same stack, we can see that different projection types can lead to very different final images.

This can also be appreciated using a biological image stack, where different features are emphasized or de-emphasized depending on the projection applied. As we can see below, each projection method (once normalized for the intensity of the output image) can lead to quite different final images, emphasizing or de-emphasizing various features of the original image stack. It is up to you to choose the projection that you believe best represents the raw data.

An image stack of membranes in green and nuclei in red from Zebrafish shown in each projection type

Stack projections are found in the “Image -> Stacks -> Z project…” menu

The ImageJ interface for Z projection

We can use only a portion of the stack for any given projection by changing the “Start slice” and “Stop slice” values. For example, if we wanted to only project slices 2 through 4 of this stack, we would enter “2” and “4” in the start and stop slice fields, respectively.

Stack projections are an important part of the image processing pipeline, and help us to visualize our data in ways that are easy for our brains to understand. However, we must remember that these images are processed, and that this processing may introduce artifacts. Understanding what these projections do is key to avoiding being misled by these artifacts.

--

--