IMOD - stereology plugin

From NoskeWiki
Jump to: navigation, search

About

NOTE: This page is a daughter page of: IMOD


This page is copy of a guide I wrote for "slashsegmentation.com" at this URL:

I recommend you click the link above for the most recent information, but I have made this copy here as my own record. The page itself explains how IMOD can be used to trace tube like compartments.


IMOD's SLASH Stereology Plugin

The follow page gives practical advice on how to use the IMOD stereology plugin to quickly acquire data for publication and decide if and which datasets are most worth segmentation. In the example below we show how to estimate volume of a specimen, but notice the IMOD Stereology plugin can also be used to estimate surface area density and compartment numbers by using slightly different grids.


An Example of a Hypothesis / Biology Driver

In this project our biologists, Keun-Young (Christine) Kim, was interested in comparing relative volume differences of cells in a very small specific region of the optic tract / pre-opitc chiasm between a wildtype (WT) and disease mouse model (DISEASE_A or DA). Based on visual observation, her hypothesis was a increased percentage volume of astrocyte in the diseased animals. To prove this hypothesis, Christine took volumes from three wildtype and three diseased mice. Each volume is ~100x100x20 microns with around 11000x11000 pixels over ~300 slices, all imaged with a Gatan 3View SBFSEM system over six weeks. At ~40 GB per reconstruction, Christine estimates it would take on the order of 20 years to completely segment each volume. Instead she has (wisely) opted to start her project by testing her hypothesis with stereology. It took Christine a total of 12 hours to perform the stereology and analysis, and as you'll see at the end of this example, she is not only able to prove her hypothesis, but also made other important observations and help her decide what she might want segmented.

Note: While the example and screenshots here are real the name of the disease and exact numbers have been modified (by request of our biologist).


Steps Involved

Step 1: Install IMOD

To install IMOD go to the download's page of IMOD and follow the official IMOD installation instructions. Instead of installing the standard release however, get the latest "alpha" version of the IMOD stereology plugin by downloading the appropriate install file from this directory: "ftp://bio3d.colorado.edu/latestIMOD/alpha/" (login as guest)..... or if really keen you can copy the appropriate .csh file from the nightly build area instead. IMOD will work on any platform and installation typically will require that you have an admin password and run "sudo imod imod_4.4.1_osx_intel64.csh" in a Unix/Terminal or Cygwin window (depending on your operating system). Note that you will also have to close and restart your terminal window before IMOD works.

IMOD is actually a suite of tomography programs, including everything from reconstruction, to segmentation and data analysis, but here we are interested in using IMOD's 3Dmod and the "Stereology plugin" (by SLASH).


Step 2: Open Your First dataset in IMOD's 3dmod and Start Stereology Plugin

To open your dataset type "3dmod" into the terminal window. In the loading window that appears, browse to your big image dataset. Since your dataset is (likely) too big to fit into your memory make sure you enter "1" section and tick "fill cache" at the top right. Now click okay.

Fig 1: Opening your dataset in 3dmod

Note that your image dataset must be in MRC image file format to load. If it's in any other format you should save it to a sequence of tif images (img001.tif, 002.tif, 003.tif, ...) and then run the "tif2mrc" program by changing to the correct directory ("cd /directory/path/here/") and typing "tif2mrc -g img001.tif img002.tif img003.tif output.mrc" into your Terminal window.

Once your image is loaded you may have to hit [F11] to invert the color and you can use the following keys to navigate the image:

  • [+] / [-] - zoom in and out.
  • [PgUp] / [PageDown] - change up and down one slice.
  • [Shift+A] - autocontrast image
  • ... and use the left mouse button to "pan around"... or right button if using our suggested mouse configuration.
Fig 2: Opening the Stereology plugin

With your image open in 3dmod, open the stereology plugin by clicking: "Menubar > Special > Stereology". It will then ask you if you want to read help and if a warning message appears about a large number of contours click "no". If you haven't already, you should setup the pixel spacing and z scale by clicking "Menubar > Model > Header". This will tell the 3dmod and the stereology plugin the actual distances (in nanometers etc) between points in your grid.


Step 4: Setup Desired Stereology Grid

By default the stereology plugin will display a series of points over your grid which are spaced either 50 or 500 pixels apart (depending on your image size) in X and Y and 30 slices apart in Z. Your goal is now to change these numbers until you get around 1000 points in your entire grid.

Fig 3: Setting up your stereology grid

Ideally you want your points spaced fairly evenly in X, Y and Z - and if you want to set this up automatically I recommend using the "Wizard". To start the wizard click: "Options > Start new grid (Wizard)". Here you'll be asked if you want to measure volume density (Vv), surface area density (Sv), length density (Lv) or number density (Nv). The image below shows some of the types of grids the plugin can generate.

Fig 4: Different type of grids generated by the plugin

In this case we want volume, and in the next window we would select "crosshairs" and then 1000 points. When you click "Finish" it will then try to setup a relatively uniform grid with about 1000 points. Another important concept in stereology you will usually want to "oversample" - meaning that your grid points are generally smaller than the type of objects you are trying to measure and you'll (typically) see more than one grid point in each surface / organelle.

Note that stereology is traditionally done by taking many randomly taking numerous images (say >100 tif images) over a large volume of specimen and maybe only counting a few points per image. If each image in your stack is separate from the last make sure you check the relevant option. You can do this by simply ticking the "project grid on every slice" option.

Before finalizing the grid you'll want to check it. Use the [,] and [.] key to jump between each grid. Notice in this case we've spaced Christine's grid 70 sections apart and there are 4 total grids. We have also ticked the "change default limits" option and inset the X and Y limits to make sure none of our points touch the gray area. Notice these limits could also be used to position a grid specifically over one cell (to get estimates specific for that cell), but normally you'll want your stereology to be done over as large a volume as possible while avoiding any areas of missing or bad data.

Fig 5: Setting grid limits

Before finalizing your grid it's helpful to know the grid spacing in metric units. To do this click "Options > Set/view grid spacing in units". If you haven't already setup pixel size (under Model > Header) you will be told to do so. Once happy with your grid settings you can click "Finalize Grid" and you'll see a summary of information about your grid which you should write down so that you can use the same settings on other datasets.

Fig 6: Finalizing your grid


Step 5: Choose Categories

Now your grid is setup you'll next need to specify what "categories" you are interested in. Each category represents a type of organelle/surface/object a point might fall in.

Although *possible* to change categories later on, it's a little tricky, so it's best if you get all the categories right the very first time. If you goal is to be thorough and compare everything I'd suggest writing a list of all the categories you might have onto paper, then zoom in (using [+] and [-] and go through a few points using the arrow keys (the [right], [left], [up] and [down] arrow) to make sure your list in exhaustive. In some cases you might just be interested only in one or two categories, so you'd just list these and use "NO_CATEGORY" for anything else - and if needed you can selective recheck these points later. Fewer categories typically means faster counting (less thinking about each point), but more categories can lead to more insights into your specimen. In the example below, Christine has identified 8 different categories she can easily differentiate in her image. The last of these "Blood Vessel" is something she could have easily forgotten to add if she hadn't browed a few points before locking ht her categories. Each category will map to a number shortcut, and it makes sense to place the most common categories first. In this case the myelin and axons are very common, so Christine has put these as category 1 and 2 and the least common categories are at the end. To change the color of a particular category click the colored button on the left. No matter how many categories you have, we always recommend you leave category 0 as "NO_CATEGORY". Category 0 will maps to the number [0] on the keyboard and is useful to classify any points which fall outside the useable area or might be inside organelles that you cannot identify, had not anticipated and/or simply don't want to include in your final analysis.

Fig 7: Setting up categories

Before finalizing the categories you'll probably want to save these categories as the new default. To do this click the little down arrow below your categories and "save categories as new default" as per the image. This will help make sure you prevent any confusion and use the same list of categories (numbers, colors and names) on each dataset. To "lock in" these categories click "Finalize Categories". Note there is a option here "allow multiple categories per point" you will leave unchecked. If christine had made just one option for mitochondria, she might need to check this option to help specify that a mitochondria might belong in either an astrocyte or an axon.... but it's much easier to count points if you don't have to check this option. Click "Finalize" and you are now ready to start classifying points.

You'll notice that the Stereology plugin will add a certain number of objects to your model.... the first of these (which is probably object two) stores the parameters of the grid and list which points you have "checked", and after that is an object for each category. You should never alter these objects (deleting points, adding contours etc) unless using the Stereology plugin.


Now is a good time to save your model file. Go: Menubar > File > Save as. It helps to save the model with a name that matches the image file, and don't forget to add a .mod extension. Christine has saved this dataset as "opt_WT1_stereology.mod".


TIP: If you're comfortable with IMOD and all your images are exactly the same size you might consider using this file as an empty template - simply copy the file multiples times (eg: "opt_WT2_stereology.mod") and this will allow you to quickly start each new stereology set.


Step 6: Classify all Your Points

The type of stereology used in this example is called "point counting stereology". It's called this, because typically you "count" the number of points in each category and write them onto paper. Here we are getting the same outcome, but instead of needing to "count" you will instead just classify each point. Before you start classifying you should zoom in far enough (use the [+] key) that it's easy to clearly distinguish what type of category the selected point falls into. This very first point (pictured below) is inside an axon. To mark it as such, you can click the push button "Axon", but what works much faster is if you quickly learn the number keys and use these. Each time you press a number that point gets marked as checked and you'll automatically be taken to the next point.

Fig 8: Classifying your point with the number keys

An important rule in stereology is "on the line is considered in" - just like in tennis! In the example below the point is on the mitochondrial membrane, and thus considered "in", so Christine will press [5] to put it into the appropriate category.

Fig 9: It's important to inspect and check points carefully

In cases where a point is unclear, don't forget your dataset is (in this case at least) three dimensional, so the [PgUp] and [PgDown] keys can be used to scroll to adjacent slices and help identify any unclear / blurry organelles. Hopefully it will only be a very small/negligible fraction of points you cannot clearly identify, and so it won't matter if you take an educated guess or use "NO_CATEGORY". If you accidentally mis-categorize something you can use the right arrow key to go back, or even left click a point to jump to that point and simply change the category.

Extra Features:

  • Checking/estimating progress: Counting points should go pretty quickly, but if you want to check your progress and see how many points are in each category you can click "Options > Check progress". This popup will show you how many minutes you've spend "classifying" (pressing buttons) and estimate how long it will take to finish. Depending on your image and number of categories you might count your first dataset at about 1 point per 3 seconds (~1000 points / hour), but get a bit faster the more you count. Don't try going too fast!
  • Changing colors and appearance: If you are unhappy with the color or appearance of categories you can use the up/down arrow on the main IMOD window to select that object and then go "Edit > Object > Color". For even better control, go "Edit > Object > Type" and you can change the "sphere size" or also set a "symbol size". In Christine's setup notice she has change her objects so that certain objects are represented with square and triangle symbols. To change the color and/or appearance of the stereology grid itself, click "Options > Display Options".
  • Point painter and contour masks: In cases where you have large 2D areas of all the same category, or of no interest you may consider trying the point painter. To use this feature, click the "Pt Painter" button, use the mousewheel to change the size of your paint area and hold the appropriate number key to paint all points inside the area the right color. Another advanced option is the "contour mask". If you have used one of the non-stereology model objects (say object 1) to draw closed contours (i.e. polygons) around certain features like cells, you can select "Options > Apply (contour) mask to points" and then you can automatically set all points inside or outside these contours to have particular values.

As you near the end of your points, you can use [Enter] to jump to any points you may have missed. Once you've classified all points make sure you save you model file! We also recommend you: (a) click "Options > Check progress" to take a note of how long it took you to count points and (b) click "Options > Validate point values" as this will let you know if you've somehow made any mistakes, such as checking a point without giving it a category. If there are no errors reported you are now ready to calculate your results.

Fig 10: After classifying all point you'll want to see the results

Step 7: Paste Results to Spreadsheet Program, Close 3dmod and Repeat for Other Datasets

With all your points classified, you can generate results by clicking "Options > Calculate results". Before results are shown you have a number of options to chose from. The first option allows you to omit certain categories from the final percentage breakdown/analysis. Note that in the example below Christine has unchecked "NO_CATEGORY" to make sure it doesn't affect the percentages. She's also checked "show standard deviation" because she'd like to show standard deviation bars in her spreadsheet graphs. All other values here have been left as default and by default the results are output to "window + clipboard".

Fig 11: Calculating stereology results and pasting them into Excel

Once she clicks "Okay" Christine sees a nice little breakdown of all her categories (excluding the two points inside "NO_CATEGORY") as a bar graph and below this she can see a "text-area" with a table. This table is already copied to the clipboard, so without needing to use [Ctrl]+[c] you can paste this straight into a spreadsheet program. In this example we use Excel, select the very first cell (A1) and click [Ctrl]+[v] to paste the values.

At this stage you should save the spreadsheet, save the model file (in 3dmod) and then close 3dmod. As you close it will ask if you want to update your current grid size as default, and you will say yes. You have just finished your first dataset, but in stereology you will ideally to have a few different datasets / animals for each condition, thus now is the time to repeat the same process (steps 2-7) for each of your datasets.

If you find you have to revisit a dataset just follow the same steps as for figure 2, but enter the model file which matches the image into the spot provided. Alternatively, with the image open you should be able to hit "File > Open" and once you open the stereology plugin it will ask if you want to load the stereology objects and continue counting where you left off. Although unlikely, there's always a small possibility of losing or accidentally deleting data, so it's always helpful to make backups and/or to save each set of new numbers to a spreadsheet program as you go.


Step 8: Generate Tables and Graph for Publication

The example below shows how Christine has put all her results into a single spreadsheet, with three wildtype (WT) animals shown in green and three animals with disease (DA) in red.

Fig 12: Compiling tables of results in Excel

As a visual person, Christine wants to generate a column graph to show these values plus their errors. She creates a separate table below where she can reference the values she wants (using "=A3" in cell A1 and so on) for a chart.

With the values shown selected, Christine hits the Chart button and sets up a clustered column graph. Within Excel, the error bars are created separately by right clicking on each series, and then selecting "Format data series" then click "Error bars", and selecting the custom range for positive and negative values (see below). These particular values output from the stereology plugin "STDEV" should be taken with a big grain of salt - they represent the standard deviation you would expect assuming "normal distribution on a binomial" and assume a completely random / unbiassed sampling.

Fig 13:Generating table and standard error bars

Since Christine specified so many categories she can make many observations, and within the spreadsheet program can fairly easily group together certain numbers to generate simpler graphs. In the graph below for example, she's compiled all the categories representing axon volume (categories 1-3) and all the categories representing astrocyte volume (categories 4-6) to specifically compare the volume of axon versus astrocyte.... and also look at the percentage volume of mitochondria in astrocyte with the nucleus omitted (as is usually done when looking at the breakdown of non-nuclear organelles).

Fig 14: Using formula to generate new graphs

It's important, however, to note that these results don't really represent the whole mouse - they represent the area/volume which was imaged. Think of it as equivalent to knocking on every 100 th door in your local suburb to do a survey on a person's ethnicity - this is a good indicator of your suburb, but might not represent your whole city and probably not your country. Hence, if you want a broader estimate, we recommend taking many small and (independent) images and counting just a small number of points (10-100) on each. Here we've shown an example were we are interested in the breakdown for each specific volume as we're specifically interested in the breakdown for this specific area - the pre-optic chiasm.

The graphs above are helpful for us to see the differences between datasets, but for final publication, Christine should show the average for each condition and standard error of the mean (SEM). Below Christine, has consolidated the results together into an average and SEM for both conditions. The Excel formulae for standard error of the mean has been shown in the image below.

Fig 15: Using Excel formlaue to show SEM

NOTE: You can download this entire spreadsheet (stereology_results_to_use_as_spreadsheet_template.xls) here - and it's also attached at the bottom of this page. This Excel file includes lots of extra comments, and can be helpful to use as a starting point to generate your own charts and so on. As a disclaimer, the IMOD SLASH stereology plugin can generate grids and count points for you, but it's up to you to make sure you use it correctly.


Step 9: Analyze Results, Write into Publication and Decide on Next Step

With the data and charts now generated, you can analyze the final results. In fact - chances are you've already been closely watching and making observation which each new set of figures pasted into your spreadsheet. In Christine's case she's very happy that her original hypothesis, that the volume of astrocyte is increased in the diseased mouse - and also made the observation that the non-nuclear mitochondrial volume of astrocytes is significantly increased. Christine can now write up her results directly into a paper and might choose to include one or two charts to help summarize her stereology findings.

Another important thing to come out of this study, is that Christine can tell you that dataset opt_WT2 and opt_DA3 are the most "representative" (closest to average) of her three animals, and so if she wanted to segment an entire dataset, these are the ones she should chose. Based on her findings, Christine decides astrocyte mitochondria is very interesting and so she's interested in segmenting a few whole astrocytes from these two datasets to see if there's a difference in length or morphology of mitochondria in WT versus DA3 astrocytes. For any whole cells Christine might analyze, she also know that she can compare the volume breakdown she gets against the volume breakdown shown in her results.


Further Reading:

  • Practical Stereology - if you are interested in learning more about stererology I suggest you read this book. Did a quick google and there seems to be a pdf here. The full reference is:
    • Russ, J.C., and R.T. DeHoff. 2000. Practical stereology. Kluwer Academic/Plenum, New York. 381.
  • Unbiased Stereology - another great book to get you started with stereology. The full reference is:
    • Howard, C.V., and M.G. Reed. 2005. Unbiased stereology. BIOS Scientific Publishers, New York. 246.
  • Wikipedia - Stereology
  • Stereology.info - a great website with information about stereology for the biological sciences.


Links

  • IMOD - a list of other wiki pages I've written about IMOD
  • slash stereology plugin - same article as this one (although may be hidden).


Acknowledgements: The SLASH team