COCCOBIOM - USER NOTES A set of macros for NIH-Image developed by Jeremy Young (Natural History Museum, London), with much assistance from Michal Kucera (Geology Dept., Prague, Goteborg Univs.) and Hsiao-Wen Chung (Bioengineering, Pennsylvania Univ.). Purpose measuring Emiliania huxleyi coccoliths from cross-polarised light images. Queries to jy@nhm.ic.ac.uk. Some macros require Image version 1.54. * After macro name indicates that operation is influenced by cursor position. ** Indicates operation will be repeated on every tile of mosaic if cursor is in top left corner (red square). Revision 1.01, May 1994 ÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙ Familiarisation with the macros This is a moderately complex set of macros and getting familiar with them is complicated by three factors: (1) Many of the macros are context sensitive - i.e. what they do depends on the context, specifically whether they are working on a mosaic image or not and where the cursor is. One consequence of this is that generally it is better to run the macros from the keyboard rather than from the menu. These macros have * after their name. Macros with ** after their name will run on all specimens in the mosaic image if the cursor is in the top left corner (indicated by a red square). (2) Many of the macros use measurements produced by earlier macros so they will not do anything till after the measurements have been made. (3) Before using them you do need some familiarity with NIH-Image - for coccolith workers who have not used the program before I suggest you run NIH-Image; open a copy of the demo-coccoliths image, and experiment with the commands and tools for a bit before trying out coccobiom macros. ¥ The macros are of three types, separated by dotted lines in the menu. ¥ Several macros use the Info window for comments so it is useful if the windows are arranged so that this window remains visible. ¥ After loading the macros (Run the macro "Initialise [I]" first, to set constants, etc. ¥ When results are displayed graphically the LUT needs to be set up with 5 Reserved Entries (Options Menu, LUT Options...). ÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙ MOSAIC MACROS (top group in menu) These macros are used for archiving specimens / creating the composite "Mosaic" images. To experiment with them 1. Close all images 2. Open an image with suitable specimens, e.g. "demo Microscope Image" 3. Run macro "Make Blank Mosaic Window [4]" - press OK for first dialog box (a reminder that images should be scaled). - Second dialog box is the Save file window - give the mosaic a suitable name and save. - The red corner is a pseudo-button, if the cursor is here context sensitive macros will act on all tiles. 4. In image window put cursor over specimen and run macro "TAKE MOSAIC PHOTO [3]" 5. Repeat this several times to build up a mosaic image. 6. SAVE the mosaic image (most macros can only be undone by reverting to the saved image (file menu, cmnd-R). 7. Experiment with the other mosaic macros ¥ Changing the number of tiles and/or tile-size would be quite possible, but involve making changes to the macro file. TAKE MOSAIC PHOTO * [3] This takes a "photo" of the specimen and saves it to the mosaic ¥ If the image is already a Mosaic then an exact tile will be copied, so this macro can also be used to produce rearranged Mosaics from previously collected ones. Make blank mosaic window [4] This makes a blank mosaic window - as explained above. Set Number of next tile * [N] This sets the reference number for the next tile, i.e. determines where "TAKE MOSAIC PHOTO * [3]" will paste the next image.This is not needed in normal operation, but it is useful when compiling mosaics over a period of time/with interruptions. ¥ red dot shows centre of next tile ¥ Info window gives its co-ordinates ¥ click mouse to continue operation Retrieve tile from duplicate * [D] ¥ To use this (1) close all image windows except mosaic then duplicate it (file menu, cmnd-D); (2) paint over parts of image (paintbrush tool), (3) restore individual tiles using the macro. Centre mosaic specimen * [C] This corrects the position of off-centre specimens. ¥ To use place cursor over centre of specimen, run macro. Specimen is cut & pasted to move the specimen-centre to the centre of the tile. Show tile centres** [Q] This puts green pixel in the centre of the tile, or of every tile if cursor is in top left corner when macro is run. ¥ Use to show which specimens are not centred well - then Revert to Saved image (File menu, cmnd-r) and recentre specimens using "Centre mosaic specimen * [C]" ÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙ BIOMETRIC MACROS (middle group in menu) These macros are used for measuring specimens. They could be modified to work on many different coccoliths, but to get the feel of them start with E.huxleyi, the species they are written for. To experiment with these 1. Open "demo mosaic image" 2. Close all other images 3. Duplicate it (File Menu, cmnd-D) 4. Reset measurements (Analyze Menu, cmnd-3) 5. Run the macro "Initialise [I]" 6. Place cursor in top left corner (red) and run macro "AUTO-MEASURE** [5]" 7. Examine saved results (Analyze Menu, ShowResults, cmnd-2). Notes on the macros AUTO-MEASURE** [5] This macro attempts to measure everything with no user input. Operation may need to be tuned using "Set Parameters [P]". Poor results can be corrected using other biometric macros. After measuring the following are displayed ¥ Red & Green pixels around the central-area edge - points found on the central-area edge (red pixels indicate local minima (peaks on the surface plot). ¥ Black Line across central-area - this joins the two furthest separated minima, used to fix coccolith centre. ¥ Red Line across central-area - long axis [saved as 'max' in the results]. ¥ Green Line across central-area - short axis [saved as 'min' in the results] ¥ Blue Line extending from central-area - recorded value of rim width [saved as 'RimW' in the results] ¥ Yellow & Green pixels around rim - local estimates of rim width used in calculating rim width ¥ Red pixels around rim - local estimates of rim width NOT used in calculating rim width ¥ Dark blue pixels beyond coccolith - ends of lines used in estimating rim width SEMI-MANUAL MEASURE * [6] This is a compromise approach between the fully automated and completely manual approaches. It measures central-area, length, width, centre position, orientation. It requires a line running along the long axis of the specimen with its centre inside the central-area. To use: 1. Go to a clean coccolith (use "Retrieve Tile from Duplicate" if necessary) 2. Select the Select Lines Tool (Tools palette, 4th down on right hand side). 3. Use tool to draw a line through the coccolith, release mouse and note handles on the line selection. Adjust line to run nicely along the long axis (and extending out beyond the coccolith), with central handle inside the central-area. 4. Run macro. (5. To add rim width use macro "Set Rim Width [9]") Correct long axis * [7] Manually set long axis length. Use the Select Lines Tool to draw a line from one end of central-area ellipse to the other, then run macro. The macro also recalculates the long axis orientation and centre position. ¥ This is not an intelligent macro and the line selection must be the right length. Correct short axis * [8] Manually set short axis length. Use the Select Lines Tool to draw a line from one side of central-area ellipse to the other, then run macro. ¥ This is not an intelligent macro and the line selection must be the right length. Set Rim Width * [9] Calculate rim width, from one point on rim, and display as elliptical ring of yellow dots. To use, position cursor on rim edge (any part of rim where the edge is clear), then run macro. ¥ This is a relatively smart macro, it uses the values for the central-area ellipse (which must have been measured already) and assumes the rim ellipse is "parallel" to it. Draw Axes** [A] This draws the measured central-area axial lengths directly on the specimen, plus rim width. ¥ This macro will work on all specimens of the mosaic, if cursor is placed in top left corner (red box). DrawCaEllipse * [E] Takes the data on central-area axis lengths and orientations and plots an elliptical ring of pale blue dots. These will toggle on/off if you stay over the same specimen (but this is still a bit erratic). Toggle pixel vals [T] This displays/hides the pixels found around the central-area edge of the last measured specimen - red pixels indicate local minima. ¥ Only works on the last measured specimen (because the locations of these points are overwritten each time a new specimen is measured). Surface plot specimen * [S] Produces a surface plot of a single specimen -i.e. current ROI, or if no ROI current tile, or if not a mosaic 96x90 box centred on cursor location ¥ Because the background is dark in cross-polarised light the image is inverted before plotting. ¥ Operation pauses after surface plotting, click the mouse to resume. ¥ The surface plot is normally disposed of but can be preserved by holding down cmnd-. while clicking the mouse button. ¥ Image 1.55 can produce colour/greyscale surface plots (choose this option by running surface plot from the menus - Analyze, Surface Plot.. ), BUT these produce an error message when the macro attempts to dispose of them. Set parameters [P] This allows you to reasonably easily alter the values of a series of key parameters used in AUTO-MEASURE, and so tune operation for different species or samples. ¥ The new values will need to be reset each time the program is run unless you alter the defaults in the macro file (all defined in "procinit" at the beginning of the file). ¥ The Info window is used to present info on the parameters and give suggestions, so make sure it does not overlap the image window before you run the macro. The parameters are: A. Central-area finding parameters 1. pt - local depth of ca edge. To understand this parameter use Profile Plot tool to draw a profile from the centre of a coccolith outwards, this should give a V-shaped profile. The pit finding routine works along this profile, finds a local minimum and then continues checking until it is pt greylevels above the minimum. This routine means that specimens which are nearly overlapping can be measured. But pt does need to be set carefully. 2. Radius - the length in microns of profile checked. The shorter this is the less likelihood of complications from neighbouring specimens, but it must be long enough to always include the central-area edge, plus a bit more. B. Edge finding parameters 3. Edge threshold - the outer edge/rim of the coccolith is only weakly imaged, the routine used searches along a profile from the outside of the coccolith toward the central-area edge, until the grey value exceeds the value edgethreshold * (max-min) - where max and min are the highest and lowest grey values on the line. This value needs to be adjusted for different samples. 4. Max rim:ca ratio - this sets the distance from the coccolith centre searched, as a multiplier of the centre-ca distance. The shorter this is the less the likelihood of complications from neighbouring specimens, but it must be long enough to always include the whole rim, plus a bit more. 5. Cut - after the series of rim width measurements has been made they are averaged. Any values which fall outside this average by more than the factor 'cut' are eliminated and the average is recalculated. The eliminated pixels are shown in red after AUTO-MEASURE has run. If the selection of values to include seems poor then this parameter may need changing. Initialise [I] This sets defines constants, sets default values etc. During routine use it will not normally need to be used, but when experimenting, and especially when rewriting parts of the macro file it is often needed. In the event of error messages try running it. ¥ Initialise overwrites the values from SetParameters (i.e. restores the default values). Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù Ù RESULTS The following numerical results are stored, in the standard NIH-Image arrays. Array Name Label Value stored rX X x-position of coccolith centre (pixels) rY Y y-position of coccolith centre (pixels) rLength Length Coccolith length (=central-area length + 2*rim width) rAngle Angle Orientation of long axis (in degrees, clockwise from horizontal) rMin Min Central-area width (µm) rMax Max Central-area length (µm) rUser1 RimW Rim width (µm) ¥ View results using Show Results (Analyze Menu, cmnd-2) ¥ To store results make results window active and use Save (File Menu, cmnd-S). They can then be manipulated plotted etc. in spreadsheets or other Math programs. ¥ PROBLEM - results are saved as a Text file and cannot be reloaded into Image. ÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙÙ UTILITY MACROS (bottom group in menu) These are not specially related to the archiving or mosaic making, but are useful in the work. Experiment with use on any image. ¥ The keyboard shortcuts [f1-f11] are for an extended keyboard, but they could easily be remapped in the macro file. Kill ROI [f2] Deactivates any active Region of Interest Magn + ScaleBar [f3]' Sets the spatial scale, based on microscope lenses used. ¥ The constants in this macro will need to be adjusted according to the hardware used, if you actually get around to using the macros for grabbing new images. (for experimentation it can be ignored). These values need to be written into the macro file. There are more notes on this in the file "Coccobiom program notes". Shrink ROI [f5] Shrinks any active Region of Interest Select ROI * [f6] Makes a 100x100 pixel Region of Interest (ROI) centred on the cursor. Grow ROI [f7] Enlarges any active Region of Interest Reset Greymap[f9] Sets the standard Greyscale Look Up Table (LUT) Open Grey + 4 ramp LUT[f10] Loads an LUT of mine which is useful for checking details in the dark end of greyscale images. ¥ Use "Reset Greymap" to restore image to normality. Add green line to LUT [f11]' Use to create an LUT with a green reserved entry but no others - so that saturated pixels are NOT red but tile numbers are green. This is useful when using the mosaic images for non-biometric work. It is necessary to turn off reserved entries first (Options Menu, LUT Options..., Reserved Entries - 0).