LsmCut v1.0
Lsm files are used by Zeiss microscopes to store acquired data. Lsm files are specialized TIFF files. Each of them may be simple and contains one single 2D image with one color (wavelength), or it can be extremely complicated and contains all images of a multi-color 4D movie.
LsmCut is a software which opens 3D Lsm files [stacks of 2D (X-Y) images] and provides user-friendly ways to do some basic data processing, e.g. X-Z and Y-Z vertical sectioning, creating maximum projection of the stack, channel mixing, and contrast adjustment.
The interface of LsmCut is straightforward. On the left of the window are the X-Y, X-Z and Y-Z views. There are a vertical line (X) and a horizontal line (Y) on the X-Y view that indicate the position of the Y-Z and X-Z slices. User can use the mouse (or CTRL-arrow keys) to move the lines. Likewise, User can also use the mouse (or PgUp/PgDn) to change the focal plane (Z) shown in the X-Y view. The precise positions in numbers are shown below the Y-Z view.

The right of the window is the control panel. It contains several buttons, icons and a list box. The list box at the bottom displays some properties of the opened Lsm file, like the resolutions.

There are six buttons on the control panel. The first two on the top allow the user to quit the program and to open an Lsm file.

In addition to the "Load Lsm" buttons, user can open a file by dragging it in to the window and drop. Only one file can be opened, however, multiple copies of LsmCut can run simultaneously.

The other four buttons are in the middle. They are used to save the views as .Bmp files. The lines on the X-Y view can be optionally saved.

The above image shows the channel mixer. The red, green, and blue colors are automatically set when a file is opened, based on the wavelengths of the channels. They can be changed to empty, or can be assigned to any available channel. The following images are from the same Lsm file with different channel settings. The first two images use two channels while the other two use only one channel. Image with 1 channel can be shown as gray-scale or in color, depending on whether the “Gray scale” icon is on (see below).




Phalloidin staining of F-actin and RFP-Myo1a-tail in Caco2-BBe cells.
The middle of the control panel is a collection of seven icons that function like switches. The first one is the "Gray scale" icon that determines whether a one-color image should be shown using its own color or gray scale.

Below are two icons that control the X-Z and Y-Z views. "Z direction" flips the views and "Z stretch" stretches the views so that the X-, Y-, and Z- axes all have the same pixel-per-micro resolution.
The "Vertical line" and "Horizontal line" icons simply show/hide the vertical and horizontal lines on the X-Y view.
When "Max projection" is off, the X-Y view shows a single focal plane indicated by the "z=" label below the Y-Z view. When it is on, the X-Y view is a maximum projection of the stack. By default it is the projection of the whole stack. But the range can be changed using PgUp/PgDn and Shift-PgUp/PgDn keys. The range is indicated by the same "z=" label.




Phalloidin staining of F-actin in Caco2-BBe cells.
1) Single focal plane: Stress fibers on the basal side; 2) Single focal plane: Apical microvillus actin bundles; 3) Maximum projection: both actin structures are clearly visible. 4) Average of the stack: almost nothing can be recognized.
Maximum projection should be used with caution because it causes loss of information and introduces artifacts. However, maximum projection gives global view of the stack and can be extremely useful under certain circumstances.


ZO-1 immuno-staining in Caco2-BBe cells.
1) When the Z-resolution is too high, ZO-1 staining looks like dots or curves on each focal plane. 2) Maximum projection gives a better picture.
The last icon is the "Adjust curve" icon. When it is off the views are drawn using the raw data. When it is on, LsmCut finds the minimal and maximal intensities of the stack and scales the histogram to best-fit these values (This is done individually for each channel.). For example, if the minimum and maximum are 20 and 60, pixels with intensity = 20 will be drawn as black (0), pixels with intensity = 60 will be drawn as 100%, and pixels with intensity = 40 will be drawn as 50%. "Adjust curve" is useful when you have a dim image or an image with uniform background. It gives the best contrast so it does not always make the image brighter.
Note: Whenever "Adjust curve" is used, quantitative comparison of intensities is INVALID and should not be done.

By default "Adjust curve" does not cut off any information. To further enhance the contrast, the user can choose to cut off 0.001%, 0.01%, 0.1% or 1% data on each of the minimal and maximal sides. For example, if the cut off is 1%, LsmCut finds the intensity that is greater than or equal to than 1% of the total data and use it as "black". Note that cut off larger than 0.01% is not recommended as it usually introduces artifacts and strong background.
Here is an example showing the difference. If you have a good-quality image, the difference will not be as dramatic as this one - and which is good.

There are several programs that can handle Lsm files. MetaMorph can open Lsm files (v7.5.2 does, the Lsm reader in v7.5.0 is broken) but it is extremely expensive - even the off-line version is unaffordable to most researchers. Moreover, MetaMorph is a general-purpose program and doing vertical sectioning is not easy. ImageJ is another interesting option. It is a freeware and has been widely used by the scientific community. There is an ImageJ Lsm Reader plugin so it reads Lsm files perfectly well. The problem is that I could not find a plugin that does vertical sectioning. The only thing close is a Volume Viewer.
Because of the lack of three-party software, I used Zeiss's Zen online system for image processing, although it does the job poorly. Later I found Zeiss's freeware Lsm Image Browser. It is a powerful program and is the only one that does vertical sectioning right. The problem is that its user interface is really really bad. I could not even find a way to save the sections (It might be there but I just could not find it.).
Some time later I found a description of the Lsm file format. I thought I could do it so I went ahead and did it. It took only several hours for me to create the beta version that worked.
I would love to but I did not have time to go through the documentation of ImageJ's plugin system. Plus I did not have much experience in Java programming. I do plan to do so but not in the near future.
LsmCut is only meant to provide easy ways to manipulate 3D stacks. Any thing beyond this, e.g. time-lapse images, is not supported. If you want a general-purpose software, I highly recommend ImageJ. It is free and it is supported and maintained by a large number of programmers. If you are also interested, try Zeiss's Lsm Image Browser. It supports MDB and other files in addition to Lsm files. Even it is named as a browser; it also does image processing (and surprisingly, with very rich functions). Its user interface is terrible though.
Tuesday, May 26, 2009
Monday, May 11, 2009
Something experimental
I am doing in vitro actin gliding assay and I find that data analysis is a lot of work. As a programmer, the first thing that comes to my mind is 'can the computer do it for me'? Apparently there is no existing software that does it, so, I roll the sleeves up and try it......
The original movie. The quality of movie is terrible because it is converted to GIF, a format that supports only 256 colors.
Find the filaments. It is not that hard to find filaments in one particular frame; identifying the same filament in two frames is another story.
Remove the background. This is easy.
Vectorization. Very difficult.
Bottom line: If you just want to collect enough filaments and analyze, it is doable. If you want to analyze all the filaments, it is almost impossible.
The code that I have written so far is experimental. For a usable software, it may take a long long time. Lsmcut, however, will have a minor update in two weeks.
Another example:
Tuesday, January 20, 2009
Please post your comments/suggestions here
I don't want to make LsmCut heavyweight, but if you have any idea to improve it, please difinitely let me know.