M o n t a g e

Three - Dimensional Reconstruction from Serial Sections

User's Manual Version 4.4

25 February 1988

Rob Smith

Copyright (C) 1988
Robert G. Smith
Room 123, Anat-Chem Bldg.
Univ. of PA Medical School
Phila., PA  19104-6058  
USA
All Rights Reserved

Montage and Mpict Reconstruction Manual

Table of Contents

Copyright (C) 1988 Robert G. Smith


Montage Tracing Manual

method of aligning traces for Montage

rationale

The process of serial 3D reconstruction works by aligning successive sections and making a stack of sections which can then be portrayed (either optically or by computer display) in three dimensions. This process depends critically on the alignment of data between sections. This manual explains the process of alignment and gives several different methods for achieving good alignment.

In order to understand the problem of alignment, it is useful to consider a typical example. If you wanted to reconstruct a helical "spring" that had been sectioned perpendicularly to the axis of the helix, you would see only an ellipse on each section. If you simply traced each ellipse and aligned the ellipse with the ellipse on the next section, you would reconstruct an elliptical cylinder, not the original helix. This problem occurs with any obliquely cut object such as a fiber or elongated cell in a serial reconstruction.

fiducial marks

In order to prevent this type of "reconstruction distortion", you must use "fiducial marks" which are used to align the data drawn from each section. Fiducial marks are normally objects on the same section as your data which aren't being reconstructed themselves and serve only to preserve the alignment between two sections. Alternately, fiducials can be absolute artificial landmarks which have been imposed on the material begin reconstructed, for example, the holes left by pins pushed through biological tissue.

You should have at least 3, preferably 5 fiducial marks which you draw along with your data on each section. They may be small objects which are only useable for several sections, so you may need more fiducials than 3 if some of them can't be used to align the next section. If you had only one fiducial besides your data on each section, you would accumulate a small rotational error from each section, because it's inevitably easy to misalign the angle of rotation when aligning only one small trace from section to section. Remember, you can't use your data traces to align with. So you need at least 2, and you should have at least 3 to 5 fiducials per section.

If your fiducials are related to each other in some way, for instance they're two fibers which both travel in the same oblique direction, or 3 fibers twisted around each other in a helix, their average "motion" will "bias" the reconstruction, and you will still have a problem with translational or rotational errors. So the whole 3D reconstruction process depends on using a random assortment of fiducials (or else absolute reference marks). This is the reason that you must use 3 or more fiducials; you have a better chance of using unrelated objects if you use many.

CLICK HERE to return to Table of Contents


aligning with transparent sheets

There are several ways to enter data into Montage. The standard way is to trace from your raw data (photograph, drawing, or image of slide) onto transparent (acetate or mylar) sheets. The transparent sheet allows you to keep traces from successive photographs in your series aligned, and also serves as a permanent record of how the alignments were made. See below "Tracing from photographs".

aligning with a mirror

The Montage program can be used to reconstruct without using transparent sheets, if desired. If you want to digitize your data from photographs or microscope sections directly, you need to align each section with the image of the previous section. One method for doing this is to mount the rear of the digitizing tablet and the bottom of the video screen together at a right angle, with a sheet of stiff acrylic plastic (or glass) mounted on a hinge between them. The plastic sheet acts as a mirror to allow the screen image to be seen while aligning the present section's photograph with the video graphics image from the previous section. The screen display is turned upside down using the Montage "k" command. This technique sometimes saves time because the separate tracing step is not needed. The disadvantage is that the fiducial marks must be digitized and alignments must be performed each time data from a section is entered or reviewed for checking.

aligning with a drawing tube

Montage can also be used to draw thick sections viewed on a microscope equipped with a drawing tube pointed at the video screen or bitpad. This way, you can digitize using the image of the cursor on the screen or digitizing tablet. If you point the drawing tube at the digitizing tablet, you should draw the fiducials onto a sheet laid on the tablet, and align with their image in the microscope. Montage allows you to adjust the mag on the x or y axes separately (using the "z" command), so you can get good correspondence between the screen and your material.

aligning with a projector

Another way to align with montage is to focus the image of a slide projector or projection microscope on the bitpad, using one transparent sheet to draw fiducial marks. Then put the next section in the projector and align the section with the fiducials on the transparent sheet, then draw that section's fiducials and trace that new section using the bitpad cursor. You can move either the section or the transparent sheet for alignment; if the slide can move, it may be easier to move it rather than the sheet, which can be left taped to the tablet. This procedure is similar to the standard transparent sheet alignment method, except that the transparent sheet is needed only to align the successive images, not to transfer the traces being digitized. Use tape to hold the transparent sheets in place after you've aligned them with the fiducial marks.

You can make an alignment dot on the bitpad surface (or on a transparent sheet taped to the surface) which will help aligning the projector image with your traces. You make a "base link" (see the "Montage" manual, Sect. 5) on each section which corresponds with the location of the alignment dot.

CLICK HERE to return to Table of Contents


Tracing from photographs onto transparent sheets

supplies

You will need a stack of transparent (acetate or mylar) sheets punched to fit a three-ring binder, several colored pens that write on the sheets, and a roll of masking tape. You need a method to align the sheets with each other; an artist's jig is best. The artist's jig is a piece of plastic about the dimensions of a ruler that has two pegs which fit into the outermost two holes in the sheets. The transparent sheets can be laid one on top of another onto the two jig pegs and this aligns them. The jig can be made from acrylic plastic, and the fingers made from nylon or a similar material.

If you don't have an artist's jig, you can make an alignment jig by using tape to mark the location of two corners of your first transparent sheet. Place two pieces of tape at a right angle to make a "corner" which fits the corner of the plastic sheet; then make a second corner mark. Then you can place all the other transparent sheets on the tape marks so that their corners are aligned with the corners of the first sheet.

drawing traces onto transparent sheets

To reconstruct from a series of photographs, tape the the first photograph to a table, and tape the artist's jig just to the rear (the side away from you) of the photograph. Place a transparent sheet on the artist's jig so it lies over the photograph and draw the features you want to reconstruct onto the sheet. You should also draw in several (three to five) extra features that you're not reconstructing to use as "fiducial marks" which help in aligning successive sections.

After you've drawn the features from the first photograph onto the transparent sheet, replace the first photograph below the sheet with the second section's photograph. Align the second photo with the first transparent sheet by carefully moving the photo around while observing how the fiducial marks drawn from the first photo align with the corresponding features from the second photo. Use all the fiducial marks (at least 3) to get a "best fit". Then tape the second photo in place to save the alignment. Replace the first transparent sheet on the artist's jig with the second transparent sheet, and draw the reconstructed features and fiducials as you did from the first photograph. Continue this process until you are finished the series.

CLICK HERE to return to Table of Contents


making montages with transparent sheets

When you trace pictures on the bitpad, there is a problem because the bitpad active area can only fit one 20 x 25 cm print. You make montages whenever you want to trace objects which lie on more than one photograph. A montage is a large picture composed of smaller pictures. The drawings from each photograph in the section must therefore be traced on a different transparent sheet. To allow the drawings from each separate "montage area" (photograph on same section) to be merged into one picture properly, you use a special method of aligning the transparent sheets when you trace from the photographs.

When you need to trace over the edge of one photograph's area, align the sheet for the next photograph area with the first by overlapping them with their holes from opposite corners placed onto one peg of the artist's jig, keeping the edges parallel, so that the second sheet is only on one peg. (Or you can just keep the sheets edge-to-edge, with the corners touching.) This keeps all of the sheets in the same relative rotation. The pictures from which you're tracing must have at least 10% overlap, and should represent neat rows of material from the sections you're photographing.

Trace some fiducial marks which overlap onto the first sheet, and then place the second, overlapping photograph so it aligns with the overlapping fiducials. When you've traced the overlapping fiducials onto both transparent sheets, you are free to move the second transparent sheet back onto both pegs on the alignment jig and move the overlapping photograph back. You can now continue tracing data onto the second sheet.

Some final words from experience

There are several ways to use Montage without going through the transparent sheet step, so 3-D reconstruction is available for many kinds of material. The standard transparent sheet tracing technique is often preferable because it gives a permanent record of how a cell was aligned and traced which can be checked by a second person. When studies must be occasionally re-checked after several months or a year, this factor is sometimes more important than the extra amount of time it takes to separately align and trace from photographs onto transparent sheets.

CLICK HERE to return to Table of Contents


Montage User's Manual

Method of aligning traces for Montage

aligning with transparent sheets

There are several ways to enter data into Montage. If you have made traces onto transparent sheets as described in the Montage "Tracing" manual (Sect. 4), the digitizing step is relatively easy because the traces on the sheets are already aligned.

aligning with a mirror

The Montage program can be used to reconstruct without using transparent sheets, if desired. If you want to digitize your data from photographs or microscope sections directly, you need to align every section when you digitize it. One way to do this is to mount the rear of the bitpad and the bottom of the video screen together at a right angle, with a sheet of stiff acrylic plastic (or glass) mounted on a hinge between them. The plastic sheet acts as a mirror to allow the screen image to be seen while aligning the present section's photograph with the video graphics image from the previous section. The screen is turned upside down for this using the "k" command. This technique sometimes saves time because the separate tracing step is not needed. The disadvantage is that the fiducial marks must be digitized and alignments must be performed each time data from a section is entered or checked. See the "Tracing" manual (Sect. 4) for the standard tracing method.

aligning with a drawing tube

Montage can also be used to draw thick sections using a microscope equipped with a drawing tube pointed at the video screen or bitpad. This way, you can digitize using the image of the cursor on the screen or bitpad. Montage allows you to adjust the mag on the x or y axes separately (using the "z" command), so you can get good correspondence between the screen and your material.

aligning with a projector

Another way to align with montage is to focus the image of a slide projector or projection microscope on the bitpad, using one transparent sheet to draw fiducial marks. Then put the next section in the projector and align the section with the fiducials on the transparent sheet, then trace that new section using the bitpad cursor. You can move either the section or the transparent sheet for alignment; if the slide can move, it may be easier to move it rather than the sheet, which can be left taped to the tablet. This procedure is similar to the standard transparent sheet alignment method, except that the transparent sheet is needed only to align the successive images, not to transfer the traces being digitized. Use tape to hold the transparent sheets in place after you've aligned them with the fiducial marks.

You can make an alignment dot on the bitpad surface (or on a transparent sheet taped to the surface) which will help aligning the projector image with your traces. You make a "base link" (see below) on each section which corresponds with the location of the alignment dot.

CLICK HERE to return to Table of Contents


tracing from transparent sheets

Let's say you're tracing a cell from a series of transparent sheets which you have traced from 20 x 25 cm prints. In order to keep the traces on successive sections of your transparent sheets correctly aligned, you need a method of keeping the sheets exactly superimposed. There are two easy ways to do this.

The first (and best) way is to use an artist's jig which is a piece of plastic about the dimensions of a ruler which has two prongs positioned to fit into the outer two holes of the transparent sheets. You tape the artist's jig to the digitizing tablet on the side away from you. Then you can lay one or more sheets onto the jig to keep them exactly aligned. The artist's jig can be made from pieces of acrylic plastic, nylon, or a similar material. Make sure that you tape the corners of the sheet opposite the holes to the tablet to prevent the sheet from moving when you are digitizing. Masking tape works nicely for this purpose. The artist's jig saves time by allowing you to position the sheets quickly.

The second way to align is to make alignment marks on the digitizing tablet which correspond to the corners of the transparent sheets. You simply lay a transparent sheet with its corners on the marks and tape it in place.

The active area of the bitpad ends at the indented line about 5 cm from the edge of the bitpad. You must keep any traces you digitize inside this area. If your traces are too large to fit inside the bitpad active area, don't worry, because there's a way of positioning your work that'll enable you to enter traces as large as you want.

CLICK HERE to return to Table of Contents


Montage beginning commands

Starting Montage

First, start Linux going with the boot procedure (see section 3). Make sure the disk has enough space for the data file you will create: type the command "df" to see the number of free blocks left (see section 3). Each section of data in the file normally requires 2K (2048 bytes or 4 blocks) of space on the disk, although you can change this if you like. Type "montage" ( means the "enter" or "return" key) to run the montage program. Montage prompts you for the name of your file. Enter your file name; if it's a new file, mont`ge will tell you so, and will put it in your directory for you.

You can also give the name of an already existing file to Montage. Montage attempts to find it in the directory. If montage can't find your file, it makes a new file. If you don't remember exactly what your existing file name is, type "^C" (control-c) at this point to exit montage, and use "ls -lt" to find your file. To understand more about files and file names, see "Components" (Section 2) and the Linux Guide (section 3 of the manual).

If you have specified a new file, then montage creates it for you, zeroing it one section at a time. Montage first says:

      Section size = 1024
      Do you wish to change ? (Y/N)
Simply type at this prompt to leave the section size at 1024 words (2048 bytes) per section. Next, Montage says:

     Zeroing Data file
     Start at which section? ( for 1)
Type to start your file at section 1. Next, Montage says:

     Stop at which section? ( for 100 sections)
You should type in the number of sections that you think you will use. Don't enter a large number of sections unless you're sure: 1) there's room for the resulting file and 2) you really need them now. For now, you should keep the file small; you can easily add extra sections to an existing data file later. As each section is zeroed, montage prints dots "...." on the screen, 50 dots to a line. To change the size of the file later, you first compress it and then uncompress it using the "fstor" command (Sect. 7).

help menu

The commands explained to you below are all listed on the montage help menu at the end of this section. To enter a command, you type the command code given on the menu into the keyboard. The menu is also available to you when you're running the program. You type "h" (help) to display the help menu.

CLICK HERE to return to Table of Contents


write mode and sections

You normally store all the points from one transparent sheet together in your data file in a "section". Each section corresponds to the tissue section from which the photographs you're tracing were taken. The data file is organized as a sequential series of these sections; each has the space for about one thousand points. If you have a "montage" of several overlapping areas on one section, then the points from all these areas are stored in one section. You can see the amount of space left in the section on the bottom of the screen.

In order to save the points you enter on each section, you must give the "write mode" ("w") command before you make any links or points. You get the message "write" in red at the top of the screen when "write mode" is on. If "write mode" is not turned on, then your data will be lost when you go to the next section, or when you exit from the montage program.

CLICK HERE to return to Table of Contents


tracing with digitizing tablet

There are three ways to use the bitpad, "Absolute mode" ("A"), and "cursor mode" ("B"), and "Position mode" ("@"). Absolute mode moves the cursor on the screen whenever you move the bitpad mouse. Cursor mode moves the cursor on the screen only when you keep the yellow "1" button on the mouse pressed while you move the mouse. Position mode keeps the cursor in the middle of the screen, but moves the data in the background.

Absolute mode is the easiest to learn to use. You simply move the mouse and see the cursor move on the screen. If you press the yellow button ("1"), the cursor on the screen stops moving, allowing you to align the mouse with a different coordinate on the bitpad.

Cursor mode is useful for montages where your trace data is larger than the bitpad active area. You simply press the yellow button ("1") on the mouse whenever you want the cursor on the screen to follow your hand movements of the mouse. Whenever you let up on the 1 button, the cursor on the screen doesn't move. This allows you to move the mouse without affecting the location of the cursor on the screen. This is necessary for making montages because there has to be a way to change the relative correspondence between the screen and the bitpad coordinate systems.

Think of the graphics screen as a single window in your car on a distant planet. You can control where you point your window, and thereby what objects and stars you see in the outside world. The outside world is very large, much too large to see with one window, so you need a way to move the window. If you move the cursor off to the side of the window, the window gets "pulled" by the cursor to a new position. In absolute mode, the bitpad is like a joystick which directs the cursor (and thereby the window). In cursor mode, the bitpad is like a wheel connected to the ground outside: you can steer your car on the ground by alternately pushing the wheel (pressing the button) and lifting up your hand to get a new grip on the wheel (lifting your finger off the button). In position mode, you have more direct control of your window view.

CLICK HERE to return to Table of Contents


explanation of links

The video screen displays your data as dots or lines on the screen. These correspond to the drawings you have digitized on the bitpad. You can think of the cursor as your pen for transferring the drawing from the bitpad onto the video screen and into the computer's memory. You move the cursor by moving the mouse. This correspondence between the cursor and mouse movements is defined by points called "links", which are the basic unit of data in your file. You create an "alignment link" to define a reference point where you can move your "pen", the cursor. Once at the link, the cursor's location on the video screen corresponds to a location on the bitpad, which you can refer back to later.

use of links

Links are used for alignment, for trace points, and for flag locations. You use alignment links to move the cursor around quickly, and to set the cursor location to be equivalent to a bitpad location. However, you can set the position on the bitpad to correspond to other locations in the picture by making different alignment links and using one them as your starting point. This feature allows you to display your trace data on the screen in different positions, and is very useful when you're making montages.

the current link

The "current link" is always the link you have either just created or moved the cursor to using a command such as "nearest link". Thus, the current link defines the alignment of the picture that you see. The current link is displayed on the screen as "CL". Most of the link commands such as "erase link", "next link", "last link", "move link" or "make point" (these are explained below) work on the current link only. New links are always made immediately following the current link in the current section buffer.

cursor alignment (the "x" command and base links)

One way to keep your cursor aligned with your sections is to use the "x" command. In this method, you draw a dot on the bitpad which serves as a reference point to align the bitpad mouse with. You move the mouse to the dot on the bitpad and then press "x". Whenever you press "x", the screen cursor moves to location (0,0) on the screen and the location of the bitpad mouse is aligned with (remembered as) this same location. This method is particularly helpful in absolute mode ("A") because you don't need any alignment links.

Another way to keep the alignment between the mouse location and the cursor on the screen is to make "alignment links", normally one per section. These serve as reference points for your traces. The alignment links are made at the same location in each section, and serve to align the cursor from one section to the next. A dot in the center of the bitpad serves as the reference point to align the mouse with the links. To make an alignment link, make the screen cursor go to (0,0) or some other location and without moving the mouse, use the "make base link" command ("0") to make a link which can be aligned with the bitpad center dot. The base link gets displayed as a "B" in the picture. You may use the keypad to enter numbers if you want. Normally the first base link on a section is entered at the location (0,0) using the "x" command.

trace links (contain points for tracing cell outlines)

To digitize a tracing of a cell, get the mouse aligned with the cursor on the screen using the following procedure. Move the cursor on the screen near the alignment link and enter the "nearest link" ("^r") command. This causes the cursor to be exactly centered on the alignment link. If you're in absolute mode, the alignment between bitpad and screen is preserved automatically as long as you don't press the yellow button or use any of the "link move" commands (described below). If you're in cursor mode, you need to re-align for every new link you make: Keeping the cursor on the screen at the alignment link, move the mouse to the dot on the bitpad with your finger off the mouse button; then move the cursor on the screen to the proper place by pressing the yellow 1 button and moving the mouse crosshairs over your transparent sheet to the trace you want to enter.

Make a "trace link" ("2") at this point; it becomes the "current link" or "CL" on the picture. You can then make points ("1") at appropriate intervals around the outline you're entering. Don't make the last point at the position of the first point, because trace points are made in "close" mode; the first point is duplicated automatically to make the last point. This means that the first and last points of the trace link are always connected. The points in a new link aren't displayed right after you make them but you can see them when you make the next link or press "8". You can see the connections between the points using the "set line display mode" ("u"). This displays your points as connected lines, not points. Normally, you make points in a clockwise direction only. Later on, if you want to analyze your trace links for area, counter-clockwise links give negative area.

If you need to trace lines on a section which aren't closed contours, turn the "close" mode off by pressing 'c'. This mode can be used to digitize tree structures by creating new links at each branch point.

You normally make a new trace link for each profile (or "slice") you want to trace. Set the branch or cell number ("s"; see below) to a different value for each trace link. This allows your trace links to be displayed separately using the filter if needed (see Section 5: Mpict).

CLICK HERE to return to Table of Contents


Colors on the screen

You can set the color of any data links on your screen using the "s" command to change the color of the current status. For example, type "s", followed by "color=red". This will cause any new links to be displayed in red on the screen and in red when they are plotted on paper later. The color of points can also be changed later. The following colors are available:

Number     Low inten        Number       High intensity

0          black            8            gray
1          blue             9            ltblue
2          green            10           ltgreen
3          cyan             11           ltcyan
4          red              12           ltred
5          magenta          13           ltmag
6          brown            14           yellow
7          white            15           brtwht
The color numbers are used by the graphics card to display the correct color. They can be referred to later during 3D picture display by their name if you want to display only links with a certain color, or if you want to change the color of certain links only.

CLICK HERE to return to Table of Contents


making new sections

For each new section, you simply follow the steps outlined above. First, move the cursor to the alignment link with the "nearest link" command. This positions the cursor so that the alignment link you make on the new section will be at the same location as on the current section. Next, advance to the new section using the "next section" ("ctrl-@") command. Make an alignment link on the new section, and you're ready to make your trace links.

exit from montage

When you're finished entering your trace data, exit "montage" with the "quit program" command ("q"). This saves your last section data in the disk file. Before it exits, the program prompts you,"Sure you want to exit?" You then have a chance to re-enter the program. Answer "y" if you really want to exit. This is a safety feature to prevent accidental exits.

CLICK HERE to return to Table of Contents


More Link Commands

move to link

You can move the cursor's position from one link to the next by entering the "next link" ("^a"), "last link" ("^q"), or "nearest link" ("^r") commands. The "next link" means simply the link which was created immediately after the "current link", and the "last link" means the one before. The "nearest link" command makes the cursor go to the position of the nearest link, and also moves the entire picture so that the link and cursor are centered on the screen. These three commands use the "general filter" to select which links to go to (see below).

The "nearest link" is very useful when you want to move the screen to display a different area which wasn't visible before. You simply move the cursor by alternately pressing the button and when you get near enough to a link you can press "^r" which gets the link centered in a hurry. This works in all three bitpad modes: absolute ("A"), cursor ("B"), and position ("@"). If you're in absolute mode ("A"), the screen cursor will stay in alignment as long as you don't press the yellow button and don't use any of the link move commands.

change a link

You can easily erase or move a link. Simply move the cursor near the link on the screen, enter the "nearest link" ("^r") command, and the link of interest becomes labeled "CL", which means it is the current link. To erase the current link, enter the "erase link" ("P") command. After the link is erased, the current link "CL" moves to the previous link. To move the current link, you enter "move link mode" ("l" = small L) and then move the cursor on the screen. The link follows the cursor. Enter "l" (move link) again to stop the link movement. You may also change a link's internal values; see "set status" ("t") below.

add trace points

You can erase and add points to a trace link easily. Move the cursor near the link of interest, and enter the "nearest link" ("^r") command; the link becomes the current link. Then enter the "next point" ("^d") command successively until the current point marker "CP" reaches the right point. You can then enter the "erase point" ("Q") command, or you can add new points which will be inserted after the current point. Remember that trace links are "closed"; the beginning and end points of the trace are coincident.

CLICK HERE to return to Table of Contents


current status

Besides a picture of your data points, the video screen displays the current status. This is the information which defines the position of the cursor, and will be used to make the next link that you create. Each link contains a set of numbers, called "link fields", which were copied from the current status at the time the link was created. The fields are:

xbio,ybio      x,y coordinates of the link.
section        section number.
area           area number for montages.
branch         branch number.
cell           cell number.
color          color of link on screen.
flag           flag spec number (only in flag links).
type           link type (base,cell,flag,trace,grain,line)
                              (see "types of links" below).

You can change the values in the current status with the "set current status" ("s") command. This causes any new links created to have the new status incorporated into them. See "setting current status" below.

d menu: extra commands

The "display" ("d") command gives you a second help menu with more commands. After you see the "display menu", you type another character shown in the menu to enter a command. The status of the current link may be displayed on the right side of the screen using the command "display current link" ("d"). Press "dd" again, and you get a display of more link fields on the screen. Press "dd" a third time; you get a still more complete display of link fields. A fourth time gives you the original display.

     dd   displays the current link on the right.
     de   displays more information in the current link.
     df   checks for bad data in a section and erases it.
     dk   erases an entire section quickly.

jump to section

You can display the picture for any section with the "jump to section" ("j") command. Type in a section number, and this section will be immediately displayed. You can also use the "next section" ("ctrl-@" or "ctrl-2") or "last section" ("ctrl-p") commands to move one section at a time. All these commands use the relative filter for alignment.

mag

You can change the size of the picture displayed on the video screen by entering the "change mag" ("m") command. The mag selected can be anywhere from .001 to 1000. Mag 1 gives the picture closest to real-size compared to the size of the bitpad tracing.

CLICK HERE to return to Table of Contents


Advanced Commands

button macros

You can make a sequence of commonly used commands into a "macro" which will be run every time you press a function key on the keyboard or a button on the bitpad mouse. To do this, you enter the "button macro" ("b") command, and the computer displays the current state of the macro function keys. It asks you whether you want to change them and you enter "y". You then follow by pressing the function key or mouse button you will use, followed by the sequence of montage commands which will be in the macro. You stop the macro with a double press on the escape key (). You may enter up to 80 characters into a single macro.

Montage has a limited symbolic reference capability. Inside the "s" and "t" commands (which allow you to change the current status and the current link, respectively) you can create and set variables, and use their values instead of keyboard input. For instance you could modify a series of links by defining two variables inside the ("s" or "t" commands):

          xincr = 10; yincr = 20
Then you could define a macro which changes the location of a link automatically:


          b                        (button macro, displays current macros)
          y                        (yes, I want to change.)
          F1                       (the program the F1 function key)
          t                        (change current link command )         
          xbio = xbio + xincr;     (increment xbio) 
          ybio = ybio + yincr; 
                              (The Enter key to stop "t" )
          ^p  (go to next section)
          ^r  (find nearest link)
This makes it possible to run the "t" command automatically to change the coordinates of an object on all sections. Remember, you enter the macro exactly as you would type it when you're running the command yourself without a macro.

Note that in the examples shown here the commands are on separate lines for clarity; you must not type or "Enter" except to end the "t" or "s" command. Remember that anything inside the "< >" angle brackets means the name of a key such as or or , and the "< >" should not taken literally.

Another example of a useful macro is when you're making new links with different colors and branch numbers. It is a lot of typing to run the "s" command and change the current status every time you want to change a branch number.

To make it easier, try this:

          b              (button macro command) 
          y              (yes, I want to change)
                     (macro program Function key F2)
          s              (set current status command)
          br=br+1        (new branch num = old branch num + 1)
                    (the Return or Enter key to end the s command)
               (stop the macro)      


          bysco=red  (set current status color to be red)
          bysco=blue (set color to be blue)
You can use macros for any sequence of keys that you could type yourself at normal speed. You will notice that when you exit Montage and run it again, the macros get erased and your must re-enter them. One way to eliminate this problem is to avoid exiting Montage by using the "!" command (see below) to run UNIX commands from within Montage. You can then return back to Montage with your macros intact. Another way:

reading commands from a file

If you have made some long macros, you will find that you lose the macro definitions when you exit from Montage. You can put your macros into a text file and read them automatically into Montage using the "r" command. For instance you can make a file "macros" using "vi" or "ice" which contains:

          bysbr = br+1 
          bysco = red    
          bysco = blue  
This "macros" file could be read in from the disk drive whenever you run the "r" command:

     r
     Please enter the file to be read: macros
Then your three macros for F2, F3 and F4 would be read in automatically. You can also read in one file from within another file's "r" command (recursively), so you can read several files at once, and accomplish quite complicated actions.

CLICK HERE to return to Table of Contents


Types of links

There are commands to make five types of links:

Type    Enter       Use

0) Base   0         for alignment
2) Trace  2         for tracing cells.
3) Flag   3         to mark synapses, etc.
4) Grain  4         for marking grains.
5) line   5         for marking fibers which pass through sections.
Any one of these types of links may be used for alignment of transparent sheets. The base, trace, and grain links all simply display their single characters in the screen display. The flag link displays "F" followed by the flag name. The line link gives a "L 4 5" display on the screen where the "4 5" are typical cell and branch numbers.

Line links

Line links are used for defining lines which go through many sections. The line can go from one section both forward and backward. It is useful for defining the path which a fiber moves through tissue. Line links are difficult to enter correctly, because each line link has a pointer to both the line link immediately before and after it. This gives an order to the links in a line vector, and allows the line to go through tissue any direction, forward or backward.

In order to create a new line, you must have the "current link" (CL on the screen) at a link that isn't another line link. Then each time you add another link to the line, you must be sure the "current link" is set to the line link that you wish to connect the new link to. Also, you must have "write" mode ("w") set on when you enter the link, otherwise the pointers won't be correct.

You can travel forwards and backwards on the line link vector with the use of the "last link" and "next link" commands. If the pointers aren't set right, you can figure out what the problem is with the "display current link" ("dd" and "de") commands to enable you to see the pointer fields. The "Lp" and "Np" link fields tell give the link and section number for the last and next links in the line.

Grain links

Grain links are exactly like trace links, except that their points are not displayed as a connected polygon. You can use them for displaying point information, such as individual grains on an autoradiogram.

CLICK HERE to return to Table of Contents


Flag links

Flag links are used to make a point stand out by displaying it as one or several words. You use the "g" command to define the current flag specification, and you can enter a list of numbers or words. This list is displayed on the bottom left of the screen, and this definition will appear in any flag links made. In order for the flag words to appear correctly, you must create a file called "flag.def" which contains all the definitions you are using. Montage reads the "flag.def" file each time you run it as a command, and translates each word into a number, to be used as an "index" in the symbol table. Later, you can use the same flag word definitions when you run the picture program "mict" and the definition file "flag.def" will allow the picture program to respond correctly.

The really powerful feature about flag links is that you can use a flag word to define the features of the flag for one category only, and use several categories for each flag, as you would in a relational data-base program. Later, you can select flags for display or analysis which match a logical relationship between the several flag word fields. Since flags can contain an unlimited number of flag word fields (each represented by one integer), this is a very powerful system.

You can access the separate flag word fields through the use of the "f0, f1, f2, etc." and "anyflag" fields when you use the filter. "f0, f1" refer to the contents of the first, second, etc. flag fields. "anyflag" refers to the contents of any flag field that matches the logical expression it's in. See the filter example below (page 6-24) for a typical use.

Flag link definitions

Flag links display their name or number on the screen. You can make a definition table for all your flag types which associates each flag type with a name. The definition table is put in a separate "flag.def" file which gets read each time you run the montage program. You make the definition file using an editor such as "vi" or "ice" just as you would any other text file. The syntax for the flag definition file is:

  1. One flag definition per line.
  2. Each line begins with a character string of up to 15 characters. There should be no spaces in the character string, but if you want two words separated by a space you may place the words (and the space) inside double quotes.
  3. After the character string, there must be an equals "=" sign, followed by a definition number for the flag.
  4. A sharp "#" anywhere on the line makes everything after it ignored until the next line, allowing you to place comments to yourself in the file. (see next paragraph for explanation.)
For example, a typical file might be:


----------------------------------------------
#    Flag definition file
#
#
flat = 20
round = 21
"large square" = 22
#
# end of file
----------------------------------------------
Once you have set the flag definition table, you can then enter any flag into the "current flag specification" at the bottom of the screen with the "make flag spec" ("g") command. You can enter as many names or numbers, separated by spaces, as you like; these will all appear in the current flag spec. When you create a flag link, the flag spec. names and numbers will appear in the screen display along with the marking "F". Thus, you can see the name of all your flags right on the screen where you place them.

Example:

     F input amacrine 7
You can include your flag definition file in your corfiles when you use "picture" to make 3D pictures of your data. This allows you to use the same flag definitions to describe to the filter which flags to display in your picture. To create or change the "flag.def" file when you're running Montage, you can make use of the "!" system command (see below) to run the editor ("vi" or "ice"; see Sect 7) from inside Montage. This allows you to run any Linux command line while you're running Montage; you can even run Montage inside itself to look at a different data file!

setting current status

The current status is the information which you incorporate into a link when you first create it. To change the current status, you simply enter the "set current status" ("s") command. Then you may enter as many changes as you like, separated with semicolons ";". Each status change has: 1) the link field you're changing; this can be abbreviated. 2) The new value for the field. 3) If another field change is on the same line, you must have a semicolon ";". You end your entry with a blank line.

The "change link status" ("t") also has the same synt`x. It is used for changing a field of the current link after it has already been created.

For example, to change the branch to 25 and the cell number to 7:

 
          br 25; ce 7
would do the trick!

size of sections

Montage allows you to make data files of different sizes. You can change the section size whenever you make a new data file. Normally, you use the largest size possible, but you can use a smaller size if you're running out of room on the working disk. The data files normally have a section size of 1024.

Whenever you make a new file, Montage displays the current section size, then asks you whether you want to make a different size file. If you want to change to a different size, you answer with a "y", then enter the new number, which should be an even multiple of 512 (either 512, 1024, 1536, 2048, etc). When you run "montage" with existing files, it automatically finds the proper section size to use with that file.

The "fstor" storage program (section 6 of manual) allows you to compress your datafile. When this is done, each section is reduced to the exact size which holds the points in each section; this is a variable number. When you "uncompress" the file, each section gets expanded to the current section size (which you can set to less than 1024 but is normally 1024). Fstor always asks you if you want to change the section size before it uncompresses the file. You can also change the section size in "fstor" with the "change section size" command.

Another way to compress your data files for archival storage by the use of the pack(1) and unpack(1) commands. These use a special bit-compression scheme.

CLICK HERE to return to Table of Contents


zero x,y position

Normally, montage starts out with the cursor set at location 0,0 and you can make your first base link there to keep an absolute reference point from which to make all your other base links (if you don't have multiple areas). However, in absolute mode ("A"), your first link will be at the absolute coordinate of the bitpad cursor, which will not usually be 0,0. If you want your base links to start out at 0,0 (this is nice but not necessary), then use the "x" command which causes the current bitpad position to be 0,0 and shows that location on the screen (as if you went to a link there).

The absolute mode allows you to enter absolute locations of points without any need for drawing marks on the bitpad. Once you go to a link, however, the absolute coordinates are moved so they don't refer to an absolute bitpad location any more. To set the correct alignment again, you can move the bitpad mouse to your alignment dot on the bitpad surface and press "x" or go to the correct base link.

If you want to make a lot of base links at (0,0) the easiest way is to make a blank file called zero.dat which contains, say 20 sections with base links at (0,0). Then use the "fstor" program (Sect 6) to compress this file and save it. When you need a file of say, 80 sections, take the zero.sto file and run

     cat z20.sto z20.sto >x40.sto
     cat x40.sto x40.sto >file.sto
     fstor -n file.sto xxx.sto -r xxx.sto file.dat
to make the file. It will have 80 blank sections, each with a copy of the original link. "fstor -n file1 file2" means renumber the sections in the file.

The Linux system command "!"

You can run any Linux command when you're running Montage by entering a "!" in front of the line. Montage responds to your "!" by resetting the screen back to text mode so you can see your command operating normally. After your one-line command stops running, Montage says: Type to continue ... After you type a , your previous Montage display reappears.

CLICK HERE to return to Table of Contents


Filter

The montage program has a very powerful filter system which allows you to select links with any combination of field values (branch, area, color, cell number, etc). The purpose of the filter is to give you a way to describe different parts of your drawings so you can separate them later. If you'll ever need to display parts of your drawings separately, or in a different color on the plotter, you need the filter. Think of the filter as a seive through which to pass your datafile.

There are two filters you can use. The first, the general filter, controls which links the cursor will move to with the commands "nearest link", "next link" or "last link". This allows you to select which links you use for alignment when making montages (see "making montages with transparent sheets below").

The second filter is the display filter. This filter controls which links are displayed each time a new screen display is generated. Thus, you can greatly simplify a large screen display by filtering out unwanted links during display. In addition, you can select which sections to display on the screen with the display filter. The programs "mpict", "fstor" and "glink" all use the same filter.

You use the filter by creating "filter specs" which describe the form of link that you want to find. Each filter spec describes the exact form of link by specifying for each field (number) in the link what range of values is acceptable. You assign an appropriate filter spec to each filter; then the filter automatically finds the links you want whenever you enter a command which uses the filter.

link fields

The filter can look for any combination of the following fields:

type           the link type (base,cell,ftype,trace,grain)
xbio,ybio      the x,y coordinates of the link.
section        the section number.
area           the area number for montages.
branch         the branch number.
cell           the cell number.
color          link color.
flag           the first flag spec number (only in flag links).
f1,f2,f3, etc. other flag spec numbers in flag links.
anyflag        any flag spec in a flag link.
To make it easier for you to create and use the filter specs, there is a table with space for eight filter specs to be defined for use in the filters. A simple numbering scheme, in which each filter spec line is given a number, allows you to refer to this spec by its number when you use it for either filter. Thus, any filter spec may be used for either filter. In practice, you define new filter specs as you need them, and add them to the filter spec table.

The filter language syntax for one line is:

          1) Link field, which can be abbreviated.
          2) Equals "=" sign.
          3) Lower bound for field.
          4) Comma "," (optional, use with upper bound.)
          5) Upper bound for field (optional).
          6) If more filter specs. are on the same line, you 
               separate them with a space or semicolon ";".
Example of filter syntax:
          typ = flag;  flag = 4,7;  branch = 5
This example would filter for a flag type link whose flag value was either 4, 5, 6 or 7, and whose branch was 5.

You may put as many filter specs on a single line as will fit; normally this maximum is ten. To pass through the filter, a link must statisfy all the filter specs on one line (normally separated by semicolons); this is a "logical and" function. The lower and upper bounds (inclusive) allow you to specify a range of values for any field. If you need more ambiguity in a filter spec, you may use the "logical or" function by using "or" between specs. You may also use left and right parentheses to define more complicated logical functions than exclusively "and" or "or" (see example below).

To make it easier for you to write filter specs, the filter accepts multiple filter specs on a line separated by either semicolons, commas, or spaces (you can leave out the semicolons).

You may also use the notation current - 1 (or + 1) to describe any field in a link referred to the current status. This can be abbreviated to "cur - 1".

Example of filter spec table:

     filter spec table:


     1)   typ = base;                   (link type must be 0)
     2)   typ = trace,grain;            (link type 2,3,4)
     3)
     4)
     5)   typ = 2; (cel = 1) or (cel = 3);  (trace link on cell 1 or 3)
     6)   f1=dark; anyflag=bipolar;       (any dark bipolar) 
     7)   typ = ftype,grain;               (link type 3 and 4)
     8)   sec = cur - 1; typ = trace;     (any trace link on previous section)

     reference numbers:

     g 2       (link type 2,3,4)
     r 1       (link type 0)
     d 7       (Flag,grain links on current section, and
                    any trace links on previous section)

To change the filter, use the "filter" ("f") command, then type "g", "r", "d" to change any of the filters to a different filter spec; or to change filter specs, type "f". Then enter the number of the filter spec. you want to change, and enter the filter spec.

use of filter by other programs

The "fstor", "glink" and "mpict" programs all use the same filter language, with the same syntax as described above. Corfiles for "mpict" can have up to 100 filter spec lines, each with its own pen number and hide status.

CLICK HERE to return to Table of Contents


Surgery with filter

Another feature of the filter is the ability to do surgery by selecting only links above or below a plane located in three-space. Planes are defined by the syntax:

     above xloc yloc zloc a b c
     below xloc yloc zloc a b c
The (xloc,yloc,zloc) define a point in original x,y bio coordinates which the plane passes through. The (a b c) define the solid angle at which the plane passes through the point for the equation:
   a(x-xloc) + b(y-yloc) + c(z-zloc) = 0
It is sometimes difficult to find the proper locations for the planes because they can't be seen, only their effect on the display can be seen. For starters, define the (xloc,yloc,zloc) point to be the center of the cell, so that no matter which angle you choose for the plane, you will be able to see where it cuts through the material. The values for a,b, and c be determined empirically or intuitively by noting that a,b,c affect the x,y or z slope of the plane, respectively. The values for a,b,c should not all be zero at once, since this selects for all points. Setting one of a,b or c to zero makes the plane have no slope in that direction. Increasing one of a,b or c makes that coordinate affect the slope more. Once you get the slope right, you can move the intersection point very easily.

One hint to make this easier. If you set the value for c to -1, then the a value is equal to the x slope (the tangent of the y rotation), and the b value is equal to the y slope (an x rotation). In this case,

     z-z0 =  tan(yrot)(x-x0) + tan(xrot)(y-y0)
for example
     above 0 0 0 2 3 -1
selects for points above a plane with a slope of 2 in the x direction (a y rotation), and 3 in the y direction (an x rotation). A similar equation holds for setting either a or b to equal -1.

display filter: additional sections use to align sections

Normally, the display filter can accept links for display from the current section only. However, it has a special feature not found in the other filter functions which allows display of other sections in addition to the current section. The Display filter function will use additional filter spec lines each of which may display links from one other section. The display filter continues to use all succeeding filter spec lines until a blank line or the end of the filter table. Only the first section displayed will have trace links displayed as lines. The other sections are displayed as dots only. For instance, if filter specs 6, 7 and 8 are set, you can use all three specs for display by setting the display filter to 6. Filter specs 7 and 8 will then also display on the screen, but will have only dots, no lines.

This feature allows you to align previous sections with your current section. To do this, set the second filter line to "sect=cur-1". This allows you to see the links from the previous section as dots; you can align links on your current section with them using the "l" (move link) command.

CLICK HERE to return to Table of Contents


First page of the main menu:

^2 = Next section  (rfilt)     ^p = Last section  (rfilt)    Nov 87
^a = Next link     (gfilt)     ^w = Last link     (gfilt)
^b = Current link              ^r = Nearest link  (gfilt)
^c = Go to cursor              ^s = Nearest link, don't move (gfilt)
^d = Next point                ^t = Last point
^h = Next frame                ^x = Last frame

0 = Make base link            P = Erase link
1 = Make point                Q = Erase point
2 = Make trace link
3 = Make flag link
4 = Make grain link           @ = position mode
5 = Make line link            A = absolute mode (default)
7 = Close slice               B = cursor mode
8 = Redisplay for abs mode

Second page of the main menu:

b  = make Button macro
c  = Close trace link (off/on)
d  = link display menu: link params (on/off)
f  = change Filter
g  = make flag spec
h  = Help table
i  = display symbol defs.
j  = Jump to section
k  = make screen upside down
l  = move Link mode

m  = change Magnification
n  = short screen display
q  = exit program
r  = read commands from file
s  = Set current status
t  = Change link status
u  = Set line display mode
w  = write mode (on/off)
x  = stage to zero pos
y  = link display (on/off)
X,q = exit program
z  = change screen size
!  = run Linux system command!

The display menu:

        Display Menu

d = display current link on screen
e = display more information about current link
f = fix section
k = kill section, clear to all zeroes
any other key = return to display

CLICK HERE to return to Table of Contents


Making montages with transparent sheets

When you trace pictures on the bitpad, there is a problem because the bitpad active area can only fit one 8" x 10" print. You make montages whenever you want to trace features which lie on more than one photograph. A montage is a large picture composed of smaller pictures. The drawings from each photograph must therefore be traced separately on the bitpad. To allow the drawings from each separate "montage area" (photograph on same section) to be merged into one picture properly, you use a special method of aligning the transparent sheets when you trace from the photographs.

When you need to trace over the edge of one area, align the sheet for the next area with the first by overlapping them with their holes from opposite corners placed onto one peg of the artist's jig, keeping the edges parallel. (Or you can just keep the sheets edge- to-edge, with the corners touching.) This keeps all of the sheets in the same relative rotation. The pictures from which you're tracing must have at least 10% overlap, and should represent neat rows of material from the sections you're photographing.

using alignment links to create the montage

When you're tracing from montages of transparent sheets, you first make the alignments for different "montage areas" by making extra alignment links (normally base links) which are created with the screen cursor moved from the first alignment link by an amount equivalent to the offset between your transparent sheets. Thus, each montage area should have its own alignment link which corresponds to the location of the same bitpad dot, but which represents a different area of the picture. Each area alignment link has a unique number in its "area" link field. When you're tracing from transparent sheets, you can select for that area by using the "general filter" for any of the "move to link commands" ("^a","^q","^r","^t"). Whenever you move to a link, the current status (defines the data to be entered into the fields of a new link) area field is set from the current link, so any new links are put inside the new area.

reference points

To create the extra alignment links, you need two reference points defined by the transparent sheet you're working from. The distance between the reference points represents the distance between adjacent montage areas. The reference points may be the artist jig peg holes, or you may use a corner of the sheet to define them.

Place the transparent sheet so that the first montage area is within the active area of the bitpad. Make a dot underneath the corner on a piece of tape on the bitpad, move the sheet by the amount required to place the next montage area in the active area of the bitpad, and make a second dot on the bitpad. Make two additional dots for another corner in the same manner, to keep the sheet in correct rotation alignment. Use these reference points to position the transparent sheets for the different montage areas. Of course, if you're using the peg holes for the reference points, you don't need to make any dots on the bitpad.

making montage areas

Montage areas are defined by alignment links; the "area" number in each link defines which area. To make a new area alignment link, you first set the "area" number in the current status ("s"). Go to the first alignment link with the "nearest link" ("^r") command, move the mouse (with the button down in absolute mode; in cursor mode) to the first reference point, move the mouse (with the button up in absolute mode; down in cursor mode) the proper distance to the second reference point, and make the new alignment (base "0") link. This alignment link defines a new montage area by changing the alignment between the bitpad coordinate system and the picture on the screen.

If you're setting up a series of sections for montages, you can save time by correctly making all the alignment links in the first section. Then copy them to all successive sections using the "next section" ("^p") command followed by the "base link" ("0") command. If you copy area links in this manner, you should set the "relative filter" ("fg 2") to a null filter spec (see next paragraph) so the area number in the current status doesn't get changed. Alternately, you can copy all the links in a section using the "cat" UNIX command to copy the section multiple times.

tracing transparent sheets using areas

Once all the alignment links are in place, you can easily switch from one area to another by going to the alignment link which defines that area. Whenever you go to a link, the current status gets set from the nearest link defined by the relative filter. This automatically sets the correct area number in the current status, so that you make all trace links which use that alignment link have the same area number. You can easily change the relative filter to define which links are used to set the current status. This is necessary when you're first making the alignment links: you don't want any previous alignment links on a new section to change your area number when you're copying area alignment links from an old section (see above).

tracing montage overlaps

Sometimes, you find that trace points overlap between two montage areas. In this case, you need to add new trace points to an already existing trace link from a different montage area. To do this, first position the new transparent sheet on the bitpad reference point (see "reference points" above). Next, go to the alignment link for the new sheet and move the mouse to the center bitpad dot, as you normally would to align the mouse with the cursor; then move the cursor near to the old trace link in the other montage area. Use the "nearest link, don't move" ("^s") command to establish the old trace link as the current link; this doesn't change the cursor position. With the "next point" ("^d") command, move the "CP" marker to the point just before (clockwise) the new ones you're going to add. Then add points to the trace link with the "make point" ("1") command.

coping with slow displays

When you're tracing cells with many points, you will find that the picture display is very slow. This is due to the small but real time it takes the computer to calculate and display the position of each point. You can alleviate this somewhat by keeping the bitpad button pressed (in cursor mode); then no new picture display occurs. You can also use the "short screen display" ("n") command to eliminate most of the numbers on the current status display. You can use the display filter to select only nearby links for display; set the display filter to
   xbio = cur -200, cur+200; ybio = cur -200, cur+200".

CLICK HERE to return to Table of Contents


Montage switches

To run montage with different graphics boards, you enter a command switch on the command line right after the "montage". The switches are:
          -b    Linux standard driver, as in plot(1G): "setenv GTERM epc"  
          -e    Enhanced Graphics Adapter (EGA)
          -g    Video Graphics Adapter (VGA)  default
          -h    Hercules board
          -c    change calibration for bitpad with 200 points/inch 
          -x    X Windows driver

CLICK HERE to return to Table of Contents


Some final words from experience

There are several ways to use Montage without going through the transparent sheet step, so 3-D reconstruction is available for many kinds of material. The standard transparent sheet tracing technique is often preferable because it gives a permanent record of how a cell was aligned and traced which can be checked by a second person. When studies must be occasionally re-checked after several months or a year, this factor is sometimes more important than the extra amount of time it takes to separately align and trace from photographs onto transparent sheets.

Montage is an evolving system, and is very easy to modify. We have tried to keep Montage as simple as possible so it's easy for those of us who don't have much experience with computers. At the same time, we have added advanced features that make Montage useful for many different types of 3-D reconstruction. If there is a problem with the manual, or Montage program or any of the other programs in the Montage system, please let us know so we can fix it.

If you think of a new feature you feel would be really useful to others, let us know. We may be able to change Montage to suit your needs. If you've purchased the source code, we encourage you to make the change yourself or get a programmer to do it for you. We would appreciate a copy of your changes so we can evaluate and add them for use by others.

CLICK HERE to return to Table of Contents


Mpict User's Manual

Mpict is a three-dimensional display program. It displays all the sections of a data file on the video screen. You can give commands to rotate and translate the picture, to create the picture you want. There are also commands to load and store corfiles. These files contain copies of all the display parameters that mpict uses.

mpict interactive

To run mpict on the video terminal, type "picture". This runs mpict interactively so you can change any of the the starting values of the display parameters. You first define the data file by typing "datfil = filename". The section increment is initially set to 1, which means that every section is displayed. You may change this or any other value by typing the parameter name, followed optionally by an equals sign, then the parameter value. You can abbreviate parameter names as long as they aren't ambiguous; for instance, "datfile" can be abbreviated to "da". You can also include multiple parameter definitions on a line by separating them with semicolons (";"). You can edit the line you've typed by using the "^h" (backspace) or "^u" (delete line) commands. You enter the line with a carriage return ( or "Enter" key).

picture display

The picture displays when you give the "run" command. You can stop the picture during the display by typing one "^C" (control-C). To stop the program, type two "^C's" or type the command "quit" or "q", followed by a blank line.

You may not actually see anything on the screen the first time you display a picture with the "run" command because the "xcent, ycent, zcent" center location can't be set until after the picture is drawn. Just run it a second time and the picture should be centered on the screen so it just fits in. The x,y,zcent and mag parameters are set automatically (when auto=1) so you don't have to worry about getting it centered.

CLICK HERE to return to Table of Contents


save and load corfiles

When you've got your picture to look exactly right, set the "corfile" with the line "corfile = myfile.cor". Then give the command "save". This saves the parameter values for your picture into "myfile.cor". If this file already exists, the new picture parameters overwrite the old file. The picture parameter file is called a "corfile" because it contains the coordinates for display of the picture. The corfile is a copy of the parameter display which you see on the screen.

If you want to make several pictures display at once, you can use the command "save !" which appends additional parameter values for another picture onto the end of the corfile, and doesn't erase the existing ones.

You can also use the commands "save filename" or "save ! filename" to create corfiles. If the corfile is not explicitly given or has not been defined by the "corfile = name" command, then the default file name "data.cor" is used for both the "save" and "save !" commands.

To load the parameters from a corfile you have already made, give the command "load filename". This erases all previously set display parameters and sets them to the values from the loaded corfile. The corfile can be used to run mpict without your attendance; see below. A corfile always has the parameter "auto" set off (0) so you can override the automatic mag feature by changing mag after you load an existing corfile (or turn off auto).

After you save a corfile, you can edit it with "vi" or "joe" and add extra "run", "include" and "erase" lines. To make your corfile easier to understand, you can put comments in wherever you want by putting a "#" at the beginning of the line. This causes "mpict" to ignore that line.

CLICK HERE to return to Table of Contents


flags

Flag links in your picture can be displayed in a variety of sizes, shapes, and in eight colors. To define a flag for display, give the command:
     filter [num] [pen num] shape [size num] flag num
where:
       "filter num"      is the filter number, from 0 to 99; 
       "pen num"         is the pen number for the plotter;
       "shape [char]"    is the symbol type printed at the flag;
       "size num"        is the symbol size;
       "flag num"        is the link flag number.
There are 100 filters available for displaying links. Each category of flag described in a filter line will be displayed with the pen color and symbol shape defined in the filter line. The pen color and symbol size do not need to be put on the line; if they're left out, the default pen color defined by the pen parameter in the corfile controls the color and the size is set to 4. If the symbol is "char", a following single character defines the shape to be a standard alphabetical character. To erase a flag display, type "flag number" and leave the rest of the line blank.

Flag sizes range from a tiny dot (1) to one-half the size of the full picture (15). Pen colors 1 to 4 are the pen numbers on the HP plotter, and colors 5 to 8 are a second round of colors used after pens 1 to 4. Shapes are:

   char    single char following symbol name: "char x"
   triangle
   square
   circle
   cross (plus symbol)
   asterisk
For example, the filter line:
     filter 1 pen 2 circle size 8 flag 24 
defines flag 24 to be displayed as a circle of size 8 (fairly large) drawn with pen 2.

The filter line:

     filter char R size 4 flag=10 f2=12
defines flag (10,12) to be drawn as an "R" of size 4 (small) drawn with the default pen. This filter line defines filter 0 by default because no filter number appears.

The filter line:

   filter tri anyflag=23
draws a triangle for a flag having a 23 in any of its flag fields.

You can include your "flag.def" file that you defined for the "montage" program into your corfile to allow you to make use of the flag definitions. For example, if your flag.def file had:

     bipolar = 25
     amacrine = 26
You could make use of these definitions by including the flag.def file into your corfile and defining a flag filter like:
   blue = 4
   include flag.def
   filter pen blue square size 3 anyflag=bipolar f2=7
This draws a small square using the blue (4th) pen for any flag with a 25 in any of its flag fields and a 7 in field 2.

CLICK HERE to return to Table of Contents


Display parameters (set = 1 to turn on; set = 0 to turn off)

xrot,yrot,zrot      Sets rotation of picture: xrot first, zrot last. 

xcent,ycent,zcent   Sets the center of rotation for the cell (set by auto)
                    Three-dimensional point in bitpad coordinates.

mag        Sets the overall magnification of the picture (set by auto)

auto       Normally set to 1.  This makes mag, xcent, ycent, and zcent 
           be changed the next time you run the picture.  This
           automatically keeps your picture the largest size possible
           and centers it for you.  If you turn "auto" off (0), you
           can change the mag to match the mag of other pictures.
           Always turned off in corfiles (automatically).

xtran,ytran    Sets location of picture on screen (normally 0.5,0.5).

incr      section increment (initially set to 1)

finc      flag section increment; 0 means finc = "incr" above (set to 1)

pen       Default plotter pen number (default 1).

zdist     Distance between sections (default 5)

line      Sets number of microns for calibration line.

calib     Sets proportion of (x,y) to z values for points, and length of 
           calibration line (number of microns per cm on bitpad).

xline,yline   Sets location of calibration line (default .95 .1);

fill       If set=1 produces slices filled with color.  Can be
           overridden by the value of fill in a filter spec.

hide       Sets default hidden line status.  Draws a picture on the 
           plotter with hidden line removal; set "hide 1".
           This causes the flags to be displayed           
           before the cell data, so the flags will not be hidden.
           The hidden-line memory is reinitialized after 
           each "run" command.  

clear      Clears the screen of text before the picture gets displayed.
           If you are running the program from a graphics terminal with 
           the same screen for both graphics and text, set "clear=1".  
           If not set, the previous picture stays.

notext     Causes screen to wait after picture is drawn before 
           returning to text mode for paramater display.

silent     The "silent = 1" command prevents printout of the parameters
           when running mpict from a corfile.  You can set this in
           the corfile, or you can run mpict with the extra switch "-s"
           which accomplishes the same thing (e.g. "mpict -s ....")

CLICK HERE to return to Table of Contents


filter

Use this command to display only selected links.

The syntax is:

filter [n] [pen[=]n][;] [hide[=]n][;] [fill=n][;] [symbol] [size[=]n] filterspec 
Everything inside square brackets "[]" above is optional; that is, the equals signs "=" and ";" semicolons may be left out. The pen and hide commands are also optional; if they are left out, the default pen and hide settings take over.

For printouts of flags, "Symbol" means any one of: triangle, square, circle, cross, asterisk, or char (see the flags description above). "size" ranges from 1 to 9, giving symbols the size of a small dot to one half the whole picture. "fill" can be set on (=1) or off (=0) and will produce trace links or flags filled with color.

The filterspec is everything on the line after the options. It has syntax exactly like the filter in "montage" and "fstor" (see "filter" in section 4: Montage manual.)

You may run the filter very simply like: filter cell 5

Or you may make up to one hundred filters each with a unique number (0-99). These will appear in the corfile just as they do on the screen.

To turn off a filter, type "filter (num)" with the rest of the line blank.

You may include your flag definition file in a corfile so flags can be described by character strings instead of numbers.

label

Use this command to draw lines and write of text in your picture. The syntax is:
              label [num] label commands (rest of line)
The "label commands" are:
            charwidth x         set character width to "x".

            erase               erase screen

            move  x y           move pen to (x,y)

            draw  x y           draw to (x,y)

            line  x1 y1 x2 y2   draw line segment from (x1,y1) to (x2,y2)

            text x y "text"     write "text" starting at (x,y). '"' is the
                                delimiter char, which can be any character;
                                there must be matching char at end.

            pen num             change pen to "num".

            size x              change picture size to a square "x" on a side

            include "name"      include command file "name" at this point.

            flag shape size     draw flag like the filter  
The picture labels are drawn on a square picture which extends from 0 to 1.0 in both X and Y. This, however, may be changed with the "size" command.

You can abbreviate the above label commands to single chars; only the first character in each command is used. Multiple commands per line are allowed, separated by spaces. For example:

          c .02 p 3 t .2 .8 /Cell 8: bipolar/
          p 1 t .2 .75 "  Corfile zzz"
says character width = .02, pen number 3, text starting at .2 .8., followed by more text drawn with pen 1.
          flag tri 9          says make a flag which is a triangle of size 9
The above label commands are exactly the same as those for the "labels" command. The only difference is that you can enter the label commands into a corfile and the label will be drawn on your picture immediately after the picture is done. See page 6-15 for more details on drawing labels.

reverse

Causes the sections in a data file to be displayed in reverse; this has the effect that the cell is drawn as its mirror image.

erase

This command resets all corfile values, including the flags, filters, and labels. The "erase" command is automatically inserted into the beginning of a saved corfile. You may, however, delete this line with the editor or add further "erases" if you wish. You can also give the commands:
erase flags    Erases only the flag defs in corfile 
erase filter   Erases only the filter lines in corfile
erase label    Erases only the label lines in corfile

derase         This command turns on/off the "erase" which 
               is normally put at the start of a
               saved corfile. Default is on (derase = 1).

include name   This command causes corfile "name" to be           
               loaded immediately into the display paramater 
               tables.  Previous values not set in the corfile are 
               not changed in the tables, unless the "erase" command 
               is in the included file.
Several of the above picture commands make use of the "standard graphics screen". This is defined to be a square with its lower left corner at the point (0,0) and its upper right corner at (1.0, 1.0). The (xtran,ytran) and (xline,yline) params as well as all of the (x,y) label commands use this standard screen, so their values should normally range from 0 to 1.

system commands from within mpict

You can run any UNIX system command by typing a "!" at the beginning of the line followed by any one line UNIX command. This is useful for looking at your directory while running "mpict" or "picture".

CLICK HERE to return to Table of Contents


mpict non-interactive

You may also run mpict in a non-interactive mode directly from a corfile you've already made. All the parameters in the corfile get read in, just as if you typed them in from the keyboard. You can type "mpict mpict -s < cell.cor | hide11 | hpflt -c | hplot; echo "pict done^G^G"& This would run "mpict" in the background from the corfile "cell.cor", and send the picture generated through the hide11 filter to remove hidden lines, then to "hpflt" and "hplot" to plot the picture. After this is done, the words "pict done" get printed, and the two ^G's ring the bell. The "-s" means don't print anything on the screen; this is equivalent to setting the "silent" parameter. Whenever you're hiding pictures, remember that hide9 runs 16 times faster than hide11, and hide10 runs four times faster. Use hide9 for rough layouts and for the video screen, then use hide10 pen trials. Only use hide11 for final copies because it is much slower.

After you get familiar with the corfile commands, you may use "vi" to edit corfiles, adding "run", "erase" and "include" commands to draw large pictures composed of many individual corfiles. You can make your corfiles easier to understand by using comment lines. You enter comments by placing a "#" at the beginning of a line; this causes mpict to ignore that line.

You can run mpict with several different switch options on the command line:

mpict -f   make ".m" output files from multiple ".cor" input files

mpict -m   use the secondary monochrome screen to display text 

mpict -s   don't write any text onto the screen; useful for batch processing 

CLICK HERE to return to Table of Contents


some useful picture commands

There are several commands you can use to run mpict automatically from corfiles. They are executable text files ("command files"), so you can print them out or copy them for your own use if you like. The "$argv" in some of the files means that the command will work on one or many files equally well. See next section for details on the "vid", "hide" and "hpflt" programs. These commands are in the "/usr/bin" directory:
   picture          This is the normal way to interactively
                    draw pictures, but can also be run
                    from a corfile or the standard input.
                    Pictures on screen are not drawn with
                    hidden lines removed. 

                    "mpict | vid -i"

   picthide         This is like "picture" except that it
                    will remove hidden lines if the "hide"
                    parameter is set. Not normally used.

                    "mpict | hide9 -i | vid -i"

   drawpic          This draws from a list of files to the plotter,
                    or it can draw from the standard input.
                    For the IBM Color Plotter, drawpic contains the
                    "ibmflt" line.  The "-c" option for hpflt (ibmflt)
                    sorts pens by color.  You may use any switch options
                    for hpflt (ibmflt) on the command line;
                    the third example below and pages 6-6, 6-7.

                      "hpflt -c $argv | hplot"    for HP 7221A plotter
   
                      "ibmflt -c $argv | iplot"   for IBM Color plotter
Examples of drawpic usage:
          drawpic < file1.plt
          drawpic file1.m file2.m file3.h file4.plt
          drawpic -w -m 2.5 -x 4500 -y 4500 file1.h -m 1.5 -x 7500 file2.h
                         
   dopic9, dopic11: These draw pictures from one or many 
                    corfiles at once, using hide9 or hide11.
                    Remember, hide9 runs 16 times faster than
                    hide11, and hide10 4 times faster.

                      "mpict -s $argv | hide9 -i"

   makehid9, makehid11:  These take one or many corfiles and
                    produce corresponding ".h" files
                    for later display or plotting.

                         #
                         foreach i ($argv)
                           mpict -s <$i | hide11 -i >$i:r.h
                         end

CLICK HERE to return to Table of Contents


Linux Advanced Commands

Shell commands

You can combine any valid command lines in Linux to make more elaborate commands which can be put into command files using the vi editor, and then make them executable using the command "chmod +x file". These commands can then be run at low priority by the "nice" prefix command.

For instance, the command "draw9" (in "/usr/bin/draw9") contains:

     #
     nice +20 dopic9 $argv | drawpic
The "#" in the first line of the file makes this command run under the "C-shell" program (see the CSH chapter in the Linux Introductory manual). This command line is be equivalent to:
     nice +20 mpict -s (command args) | hide9 -i | hpflt -c | hplot
When the command runs, the "$argv" in the "draw9" command gets replaced by any switches or file names you type on the line after "draw" (see the Linux csh manual for more details). The "nice" command only runs the first command in the line at low priority. The "draw9" command runs:
      "mpict -s file | hide9 -i"
at low priority because these commands are inside "dopic9". This command is also found in the directory "/usr/bin" for your use. You can use it like:
          draw9 file1           or          draw9 < file1
Or more elaborately:
          draw9 file1 file2 ... filen
Still more elaborately:
          draw `cat filelist`
Where "file1 ... filen" are corfiles to be plotted, or "filelist" is a file which contains a list of corfiles to be plotted. The "`"s (reverse quotes) around "cat filelist" in the last example cause the C-shell to run the command "cat filelist" first; the result of this (its standard output) is given as a list to "draw". You can draw pictures on the screen or with:
          dopic9 corfiles | vid

CLICK HERE to return to Table of Contents


Composing illustrations: posit

Once you've drawn several pictures to your satisfaction, with rotations and details like flags and pen colors set correctly, you can compose illustrations by combining several pictures into one on the plotter. This is useful where you need to take existing pictures and adjust their relative positions on a page. You can position the individual pictures from corfiles and then hide them all at once to create distance perspective where one picture overlaps another.

The posit program allows you to merge several pictures and send the resulting picture to be hidden, displayed or drawn on the plotter. This process simplifies complicated illustrations because all the individual pictures can be generated and hidden separately, and this need only be done once. Composing the illustration is thereby easier because only the locations of the individual pictures has to be defined.

Example 1:

          posit -f -x 1000 -y 7000 file1.h -x 4000 -5000 file2
This creates file1.p and file2.p with (x,y) offsets from existing ".h" files which had already been hidden.

Example 2:

          posit  -f -x 1000 -y 2500 file1.m -x 1500 -y 2000 file2.m
          hide11 -f -h file1.p file2.p  
This creates file1.h and file2.h with (x,y) offsets from corresponding ".m" (mpict) files and then hides the second picture behind the first using the "-h" option for hide on the ".p" output files. Pen colors are preserved.

If you have several picture files to make, hide and position, you can run them most easily by using the -f options with mpict, hide and posit. For example, by running

     mpict -f ab*.cor 
you can make lots of pictures from many cor files all at once. Each corfile must have a different name, but if the names have some of their characters in common, you can use the "?" and "*" wildcards to refer to them selectively. The "datfiles" referred to inside the corfiles may be any valid data file, and in particular may be the same data file. This is a good way of generating several views of one cell from one command line, without needing to type lots of file names.

An alternate way is to use the command "makehid11 file1... filen" and then to use posit afterwards (see page 6-20).

transparency

You can create quite subtle overlay and transparency effects with judicious use of the hide11 and posit commands. You can merge two pictures, each with its hidden lines removed, by drawing one on top of the other with a different pen, to give the impression of transparency. By running the output of posit through hide11, you can cause the first pictures in an illustration to be in front of those added later. Normally, however you get better results if you run hide on pictures not previously hidden, so you should posit all you pictures before you run them though hide11. For example:
   posit -f -x 1000 -y 3000 file1.m -x 2000 -y 4500 file2.m
   hide -f file*.p
   drawpic file*.h
Another way to achieve the same transparency effect is to make a ".cor" file which draws several pictures using filters from one file, separated by "runs". For example you could use the ice or vi editor to make the following corfile "file1.cor":
     xrot 0
     yrot 10
     zrot 0 
     . 
     .
     hide 1
     .
     .
     datfile file1.dat
     corfile file1.cor
     filter 1 pen 5 cell=4
     run
     filter 1 pen 3 cell=8
     run 
     filter 1 pen 6 cell=12
     run
This "file1.cor" corfile draws three cells with different pens, all on the same picture. When the picture is run through the hide filter, the cells all have their internal hidden lines removed but will be "transparent" to each other. You can position them with "xtran" and "ytran" in the corfile. To create this picture, use the following commands:
   mpict -s file1.cor | hide11 >file1.h
or
   makehid11 file1.cor             makes same ".h" file

   drawpic file1.h                 draws the picture on plotter
   vid     file1.h                 draws the picture on the screen

CLICK HERE to return to Table of Contents


Summary of file types

In the UNIX system, file names can be anything you want, but the "C-Shell" has an easy way to deal with names that have ".something" at the end of the file name ($var:r cuts off ".something"; see the csh manual for details). This makes it useful to have the ".something" stand for a file type, and in this manual we have standardized the following file types:
program
which creates
file       Picture       vi          mpict -s    hide        posit
------------------------------------------------------------------------------

file type   .cor         .cor        .m          .h          .p
          
------------------------------------------------------------------------------

purpose     To store     To modify     to make    to remove   to position
            parameters   labels,       picture    hid lines   a picture
                         filters

------------------------------------------------------------------------------

CLICK HERE to return to Table of Contents


Making higher level commands

If want to compose an illustration which requires a set of pictures individually placed, with labels to go with them, you might run commands like:
          makehid ab*.cor
          posit -f -x 2000 -y 3300 ab1.cor  
          posit -f -x 4500 -y 3800 ab2.cor  
          posit -f -x 6700 -y 2000 ab3.cor  
          drawpic ab*.p
          labels << eof | drawpic -x 6000
          t .2 .3 "Washington"
          t .4 .35 "Lincoln"
          t .65 .2 "Trudeau"
          eof
In this example, the "<< eof" after labels is a csh command which says take all the text up to the word "eof" in the shell file as the standard input to "labels". See the csh manual for more details. You can achieve the same result with the command:
          labels < labelfile | drawpic
where labelfile contains the same sequence of labels as above. Which is easier for you?

You might want to repeat this sequence of commands several times to get the positions of the pictures and labels right. Instead of retyping the whole command sequence, you can simply put it into a text file using "vi" or "ice" and have the shell run this file for you. This allows you to copy the file and easily make changes without removing your original copy if you want to go back to it.

          vi presidents                make the file
          chmod +x presidents          make it executable 
          presidents                   run it
          cp presidents pres2          copy it
          vi pres2                     make new version
          pres2                        run new version
You can replace the drawpic in the above example with a variable like plot so that you can first run the command with "vid" to plot on the screen and then run it on the plotter with "drawpic". Vid and drawpic are designed to use the same switch arguments, to make this possible. You can set numeric variables with the "@" command (see the csh manual). You set string (char) variables in the csh language with the "set" command:
     set plot = "abc"
     $plot ab*.p                   use "$" to invoke variable
     labels < labelfile | $plot -x 6000
You can set a variable from the command line which invokes the command using the standard csh notation:
     set plot = $argv[1]
     $plot ab*.p                   var is first arg after command
     labels < labelfile | $plot -x 6000
Then run the command with different values for the variable:
     president vid
     president drawpic
There are numerous possibilities for this type of command-making. The csh has many of the control statements which exist in the "C" language, including the "for" and "if" statements. Use your imagination, and read the "csh" manual.

CLICK HERE to return to Table of Contents


Utility Programs

fstor

"fstor" allows you to store data files into compressed form and retrieve them from compressed form into data files, optionally using the filter to select which data to copy. You can compress files to make them fit on a floppy disk by using the "store" command. You can get them back into the original data file with the "retrieve" command. You can also copy files with the filter. Normally, you use fstor for making backup copies of your data files. You can also break a large file into smaller files using fstor to copy only selected ranges of sections.

When you run fstor, get the help table with "h":

     c    copy file using filter

     f    change filter (see section 4: montage manual)

     h    help table

     l    change section length (see section 4: montage manual)

     n    renumber sections in file; useful after merging files

     r    retrieve file from storage using filter

     s    store file in compressed form using filter

     v    verify file (take out garbage, make all trace 
          links clockwise, fix section numbers)        

     z    change from format (old UNIX system) to 
          current .dat file format

     X    exit from program
The "fstor" filter command uses the same filter as described in the montage manual (section 5 of this manual). However, a special feature of the fstor filter table is that the filter continues from one filter spec to the next as long as the next filter spec has been defined. A link will be selected if it fits any of the filter specs on different lines. This gives you more space to define filters.

You can also run fstor with command line switches. When you are familiar with Linux, this is the faster way. The Linux version of fstor has the following switches (see Section 3 for a description of command line switches):


     -C    copy from stdin to stdout
     -D    reverse copy from stdin to stdout
     -N    renumber from stdin to stdout
     -R    retrieve from storage from stdin to stdout
     -S    store from stdin to stdout

     -a num    calib for "above", "below" in filter (um per cm)
     -b    use following number as start section
     -q    use following number as stop section
     -l num   change section length to num 
     -c    copy from immediately following filename to next
     -d    reverse copy file from following filename to next
     -n    renumber from immediately following filename to next
     -r    retrieve from immediately following filename to next
     -s    store from immediately following filename to next
     -t num    section thickness in um for "above","below" in filter
     -v    verify from immediately following filename to next
Examples:
   fstor -l 512 -r file1.sto file1.dat       Retrieve a data file

   fstor -s file2.dat file2.sto              make a .sto file 

   fstor -b 10 -q 120 -R file1x.dat   look at part of a file
For archival storage, you may want to further compress your files using the gzip(1) and gunzip(1) commands supplied with Linux. These commands use a data-compression technique which makes use of the fact that some 8-bit bytes are more common in a file than others. This works well for text files and some binary data files (".dat" or ".sto" files) because they don't contain an equal distribution of all bit patterns.
   gzip alpha.dat                        gzip is Linux's compression prog.
   gunzip alpha.dat.gz 

CLICK HERE to return to Table of Contents


glink

Glink prints out links in a data file. It can display the number and type of links and the number of points, or it can print the area, grain density and perimeter of links. You can select which links to display using the filter. See next page for more "glink" examples.

The glink help table:

     a    find area, perim (print section totals and grand total)
     c    change Calibration (microns per centimeter)
     d    display links (print section totals of number 
           of links and points, and grand total)
     f    change Filter (see section 4: montage manual)
     l    change section length (see section 5: montage manual)
     s    section thickness (microns)
     t    display indiv trace and areas and perims when 
               used with "a" mode above
     q    exit program
The Linux version of glink can be run from the standard input to the standard output with the use of the following switches (see the Section 3 for a description of command line switches):
     -A    area and perimeter
     -D    display number and type of links
     -F    flag links only
     -Z    display all link fields (for debugging)
     -a    area of following filename, output to following filename
     -d    number and type of links from following filename
     -b    use following number as start section 
     -c num    calib for "above","below" in filter
     -f    make ".g" files from data files
     -g    read flag defs from "flag.def"
     -q    use following number as stop section
     -s    section thickness (microns)
     -t    display indiv trace areas and perims with totals 
For example:
               glink -D file.dat
This command causes glink to display the number of links in "file.dat" on the screen. If you want to put the output into a file, you could use:
               glink -D file.dat >file.g 
You can run glink on several data files at once, using the "-f" command-line switch. For instance:
               glink -f -A file1.dat file2.dat file3.sto
This analyzes the data files for area and perimeter and makes "file1.g", "file2.g", "file3.g" from the data files.

Using glink intelligently

Glink analyzes your data and prints large reports. However glink's reports may not be formatted exactly as you would like them. UNIX makes it easy to get the report you want by filtering (selectively printing) and sorting, using standard tools. You can filter and sort the output from Glink with grep(1) and sort(1) to organize your data for printouts. For more powerful list processing you can use awk(1) to reformat, move columns around, and make totals of columns. See the Linux User's Guide for more on awk(1).

For instance, you could enter the following command line:

   glink -F file.dat | grep amacrine | sort +3 >file.srt
to get a total of all "amacrine" flags in a data file, sorted by their flag numbers (column 3 of glink output).

You can use column and var (supplied with Montage) to get the standard deviation of selected data. column prints out a selected column from the standard input or a text file, and var prints the mean, variance, and standard deviation of a list of numbers. For instance:

   glink -t -A -b 4 -q 9 datafile | grep ' a ' | column 3 | var 
gives the standard deviation of all trace links on sections 4 through 9 of "datafile". The "grep ' a '" filters out only the individual trace areas printed by the glink "-t" switch. You could make it easier to use this sequence of commands by inventing your own command called gvar:
   glink -t -A -b $1 -q $2 $3 | grep ' a ' | column 3 | var
Then you could invent another command to automatically graph this data in a histogram, which you could name histo:
   gvar $1 $1 $2 | bins -w 20 | graph -M 40 | drawpic
This command "histo" allows you to gather data from any selected set of sections, make a histogram with "bins" (see below), and plot the data using "graph" (see below) and "drawpic".

The column command (used above) is merely a shell file (executable text file: chmod(1)) invoking awk(1):

   awk "{print \$$1}" $2
Everything inside the "{ }" brackets is the awk command. The \$$1 passes the column number to awk from the shell command, in this case "column". The $2 means pass the second argument from column to awk as a file name. This means you can use the column command on a file name without a pipe to its standard input:
    column 4 file5.g
To find the approximate radius of traced polygons, you might use the formula:
	
   radius =   (perim / (2*pi) + sqrt( area / pi)) / 2  
It's easy to do this kind of processing with the following commands. First make the glink file which contains the areas and perims of individual polygons.

Use the editor to make the command "garea":

   glink -t -A -b $1 -q $2 $3 > $3.g
Next process the separate "a" and "p" lines together and compute the formula:

The command "grad":

    awk ' $1 == "p" { printf ("%g ", $3) }
          $1 == "a" { printf ("%g\n",$3) }' |\
    awk ' { print ($1/(2*3.1416) + sqrt($2/3.1416)) / 2; }
You could then run the commands:
      garea 1 2 file.sto
      grad < file.sto.g
and you get a list of radii of individual traces.

As you can see, "awk" is very powerful and easy to use. See "The awk Programming Language" chapter in the Linux Support Tools Guide, or The AWK Programming Language by Aho, Kernighan and Weinberger (available in paperback) for information and examples on how to use awk(1).

CLICK HERE to return to Table of Contents


hide

The hide program erases lines in a three-dimensional drawing which should not be seen because they're hidden. You can pipe the picture data from the picture program through one of the hide programs. There are three hide programs, called "hide9", "hide10", and "hide11". They are exactly the same except that the resolution of the picture is different. "hide9" gives a resolution of 512 x 512; "hide10" gives 1024 x 1024, and "hide11" gives 2048 x 2048. "hide9" runs 16 times faster than "hide11", and "hide10" runs four times faster. Use "hide9" for rough copies and the video screen, and use "hide10" for testing pens on the plotter. Use "hide11" for final illustrations only because it runs much slower.

Command line switches for hide are:

          -i        run hide in non-interruptable mode

          -f        make all input files into corresponding
                    ".h" output files

          -h        make picture hidden even when hide not set

          -j        make picture non-hidden even when hide set
For instance, to make a picture on the video screen with hidden line removal, enter "mpict | hide9 -i | vid -i". This is the same as the command "picthid9".

The usual way to run the "hide" programs is to run a shell command file (See Sect 3) which contains a command line invoking the "hide" program. A typical hide command is:

   makehid11 *.cor            makes ".h" files from ".cor" files
You can use the "-f" option in the mpict and hide programs to automatically create files for you. Mpict makes ".m" files and hide makes ".h" files. This is especially helpful when you are making composite illustrations out of picture files you have already made.
   mpict -f -s *.cor          makes ".m" files from ".cor"
   hide11 -f *.m              makes ".h" files from ".m" files

CLICK HERE to return to Table of Contents


hpflt and hplot, ibmflt and iplot

You use "hpflt" (or "ibmflt") to convert the picture data coming from mpict or hide into plotting data suitable for the HP 7221A (or IBM color) plotter. "hplot" ("iplot") does the actual data transmission to the plotter. Switches for hpflt (ibmflt) are:
          -c        sort output by pen color (waits until end to draw)

          -i        non-interrupt mode

          -m        Use following number as mag, default 1.0

          -p        Use following number as plotter pen number.
                     This overrides any pens defined in the picture file. 

          -r        Rotate picture sideways 90o

          -s        Use following number as speed for plotter,
                    up to 30. Default is 4 cm/sec.

          -x        Use following number as x offset (default 7500)
                    This is the center of the picture, calibrated in
                    thousandths of an inch. One cm = 400 units.

          -y        Use following number as y offset (default 5000)
                    Calibrated as "-x" above.

          -w        Wait after using each pen, to allow paper to be changed 

          -z        Save individual pen files after exit; use with "-c" above
To use the plotter, first read "running the plotter" below. Pipe the your picture data into "hpflt" ("ibmflt"), and then into "hplot" ("iplot"). The "drawpic" command combines these two into one command that is easier to use. For instance, to make a picture defined by the corfile "cell.cor" you could type:
     mpict cell.cor | hide10 | hpflt | hplot
or   mpict cell.cor | hide10 | drawpic
 
When you run the plotting programs this way, you may find that they run too slow, causing the plotter pen to leak on the paper. You can save the results of the hidden line routine in a temporary file by typing:
                    mpict -s  cell.cor | hide10 > cell.h
               or   makehid10 cell.cor

   then later:      drawpic cell.h
This will draw the picture faster, because the slow hide10 program does not run when the picture is being plotted. Use the makehid or dopic commands described in section 5 to create plot files (".m",".p", or ".h").

The drawpic command is a convenient way to run the "hpflt -c | hplot" ("ibmflt -c | iplot") combination because these individual commands are all put into a command file for you, set up to use either standard input or a list of files. The command 8by11 draws pictures on standard 8 1/2 x 11 inch paper in the same way as drawpic but at a smaller mag. See section 5 for a description of picture command files.

If you want to include more command line switches, you can add them before the file name:

   drawpic -w -p 2 -m 1.5 -x 5600 -y 4600 file.plt
The drawpic ("hpflt -c" switch) command sorts all the pen draw commands according to the color of the current pen used. This is a more efficient use of plotter time, because each pen is only used once. This makes the plotting process go faster, although the plotting is delayed by up to a minute because of the need to sort all the plotter commands.

When you have defined more than 4 pens in a picture, you can use the "drawpic -w" switch to stop the plotter after each pen is used. This allows you to change the paper or the pen for each separately defined pen. Another way to insert more pens is to wait until the first four pens have been used, you stop the plotter by pressing the plotter "Enter" button, and then change the first four pens (1 - 4) to their corresponding colors the second set (5 - 8). After the pens are changed, press the plotter "Enter" button again to resume plotting.

The "drawpic", "vid" and "posit" commands are designed to use many of the same command line switches so they can be used nearly identically in command files.

CLICK HERE to return to Table of Contents


vid

You use "vid" to display graphics data that comes from "nc" or "plotmod".

Vid command line switches are:

   -a       make "postscript" file on stdout: "vid -a > file"
   -c       make color "postscript" file on stdout: "vid -c > file"
   -l       make "postscript" raster file on stdout.
   -e       use Enhanced Graphics Adapter
   -h       use monochrome Hercules board
   -t       use Tektronix 4014 type display terminal
   -X       use X-windows for graphics display
   -d name      define name of X-windows screen to display on  
   -k       invert screen (upside down)
   -m n     use "n" as mag, default 1.0
   -p n     use "n" as color (16 colors)
   -r       rotate picture sideways 90 deg
   -w n     use "n" as size of X-window. 
   -x n      use "n" as x offset (default 8192)
                      This defines center of picture.
   -y n      use "n" as y offset (default 8192)
                      This defines center of picture.
   -v       don't erase screen when first starting video graphics mode.

Example:       nc -t file1 | vid        (="neurc file1") 
               nc -t file2 | vid -v     (don't erase screen)
Vid normally erases the screen when you first run it, but you can tell it not to with the "-v" switch listed above. Vid normally doesn't erase its picture when it is finished displaying. To get back to text mode you use the "t" (or "textmod") command. This doesn't erase the graphics screen, so you can run vid several times with as many text commands in between as you want. For instance:
   vid file1                          (make first picture on screen)
   t
   ls -l
   cd otherdir
   vid -v file2                       (superimpose 2nd picture on first)

textmod

This command changes the video screen back to text mode. Command line switches are:
   -e     EGA driver.
   -h     Hercules driver. 
   -v     Change from text mode back to video
           (restore a previous picture)
"textmod" is normally run (aliased) to run as the command "t".

posit

Posit allows you to set the position of subpictures in an illustration consisting of several picture files. Posit has the same command switches as "vid" and "hpflt", but it doesn't display the files; it merely puts them on the standard output or into output files of extension ".p".

Posit command line switches:

          -i        non-interrupt mode

          -f        make ".p" output files from input

          -m        Use following number as mag, default 1.0

          -p        Use following number as plotter pen number.
                     This overrides any pens defined in the picture file. 

          -x        Use following number as x offset (default 5000)
                    This is the center of the picture, calibrated in
                    thousandths of an inch. One cm = 400 units

          -y        Use following number as y offset (default 5000)
                    Calibrated as "-x" above.

Example 1:
          posit -f -x 1000 -y 7000 file1.h -x 4000 y -6000 file2.h
This creates file1.p and file2.p with (x,y) offsets from existing ".h" files which had already been hidden.
Example 2:
          posit  -f -x 100 -y 250 file1.m -x 150 -y 200 file2.m
          hide11 -f -h file1.p file2.p  
This creates file1.h and file2.h with (x,y) offsets from corresponding ".m" (mpict) files and then hides the second picture behind the first using the "-h" option for hide on the ".p" output files. Pen colors are preserved.

Batch proccessing using mpict, hide, hpflt, posit, fstor, glink

These programs may all be run with their standard inputs redirected to files. You can also run them like "hpflt file" without the "<" symbol for the standard input redirection. Multiple input files are also allowed on the command line, as in "hpflt file1 file2". This allows batch processing of your files into one output file. Mpict and hide can be run with the "-f" switch to automatically create output files corresponding to input files with the ".m" and ".h" extensions added onto the input file names.

CLICK HERE to return to Table of Contents


graph

Graph is described in the Ampex Plotting Package Manual. It is similar to the standard "graph" command that comes with most UNIX systems. It takes pairs of numbers separated by spaces from the standard input as the X and Y values of a graph. Successive points are connected by straight lines. You can display the graph by piping to either "vid" for the video screen or "hpflt" for the plotter. The maximum and minimum dimensions for the graph axes are normally determined automatically from the data on the input stream. There are many useful switch options for this program, described in the manual. Graph switch options:
   -c char             char is point label
   -C char             char is point label; no connecting lines 
   -f filename      "filename" is a file containing a list
                         of points; filename "-" means standard input;
                         maximum of 8 filenames allowed.
   -g num           num is grid style; 0-> solid grid; 1-> dotted grid;
                         2-> no grid but solid maxima; 3-> no grid(default)
   -l "label"       label for x axis
   -L "label"       label for y axis
   -m val           min for y axis
   -M val           max for y axis
   -p num           num is pen/dash style when doing multiple graphs 
                      with the -f switch:
                         0-> dashes only (default);
                         1-> pen changes and dashes;
                         2-> pen changes only
   -t num           num is the tic style of x-axis:
                         0 -> many tics, few numbers (default);
                         1 -> few tics,  few numbers;
                         2 -> many tics, many numbers;
                         3 -> few tics,  many numbers
   -T num           num is the tic style of y-axis:
                         0 -> many tics, few numbers (default);
                         1 -> few tics,  few numbers;
                         2 -> many tics, many numbers;
                         3 -> few tics,  many numbers;
   -o               make x axis logarighmic (bug in axis labeling)
   -O               make y axis logarighmic (bug in axis labeling)
   -v num           point label char size, 1=small, 7=large;
   -w num           x axis char size for label, 1=small, 7=large;
   -W num           y axis char size for label, 1=small, 7=large;
You can run graph interactively by typing "graph | vid" and then entering a set of points, one x,y point pair per line (x and y separated by spaces not commas), and a CTRL-D to stop entering data and display the graph. You can also make a text file with an editor and run "graph < file | vid" which causes graph to get its input from the file instead of the keyboard.

using graph intelligently

If you want to draw several (up to 8) lines on a graph, you can use the "-f" switch to include several files as input data. Put a "-f" before each file like this:
          graph -f file1 -f file2 -f file3
and the first one will be a solid line, the second will be a dotted line, and the third will be a dashed line. If you want colors, use the "-p" switch.

If you want to have control over the scale of the plot (so that it isn't always drawn as a square which fills the page) you can use the "-m" and "-M" switches for the y-axis, and you can include some dummy extra points to extend the x-axis, one for each end.

   For instance:

     0 0                 extends left side to 0
     data points
     10 0                extends right side to 10
You can use the "grp" comand to run graph automatically on several file names:
     grp file1 file2 file3 | vid
"grp" is a C-shell command file which contains something like:
#
set pen = 1

#set axis = 
set axis = "-T 3 -t 0"
set min =
#set min = "-m -.1"
set max =
#set max = "-M 1.2"

if ($#argv == 1) then
  graph -p $pen $axis $min $max -f $1

else if ($#argv == 2) then
  graph -p $pen $axis $min $max -f $1 -f $2

 ( and so on up to 8:  "-f 1  ...  -f $8" )
endif

CLICK HERE to return to Table of Contents


bins

Bins generates a histogram from a sequence of numbers at the standard input. The histogram is output as a sequence of X,Y number pairs, suitable for input to "graph" above. Bins switch options:
     -h             make two points per bin for histogram graph
     -n             cause bins to be not centered on binwidths
     -o num         num = offset value for array             
     -w num         num = bin width
The switch option "-w" uses the following number in the command line as the bin width. For example, given a file of numbers "sample" you could type:
     bins -w 5 -h < sample | graph | vid

     to see the histogram of "sample" displayed on the 
screen, with a bin width of 5.

spline

Spline is a nice addition to the graph command. It takes a sequence of X,Y number pairs and generates a smooth curve from them, suitable for input to graph. For example, you could type:
     spline < list | graph | vid
to see "list" displayed as a smooth curve instead of with straight lines.

var

Var takes a sequence of numbers, one num