There is user documentation included with the Atlas distribution, and of
course like any good GUI program its use is self-evident...and if you believe
that, I'm sure you'll believe that the C source code is self-documenting too.
But since we aren't going to post the code to the Web just yet, we'd like to
describe the internal workings of the application in English
for those who are interested.
----- This document is divided into the following sections:
Image Windows
The "Image" window is usually the central focus in any Atlas session. All other
windows are designed to float on top of the image, either displaying information
about what the user sees in the image or giving control over the session.
Unlike most other Macintosh applications, clicking inside an image window does
not always bring it to the front; that can be done by clicking in the title
bar, which makes it the front-most window and lets the user move it around.
There can be more than one image window depending on how the program is configured and on what the user does. Even if the program is set to show only one image at a time (the default), there is usually at least one "hidden" image window sitting around in memory because of the way navigation works. It is important to realize early on in this explanation that all of the subject lists, the opening splash frames, the help windows, and interactive evaluation screens operate in exactly the same way; only the artwork is different. All these windows consist simply of a bitmapped graphic with various regions outlined as named polygonal buttons. The Atlas program's basic operation is to display one of these images, load the associated list of hot areas, and wait for the user to click on one of them.
Navigation Bar
Glossary Window
Movies Window
Videodisc Controls
The original Anatomy Browser had facilities for controlling a videodisc player for the purpose of displaying moving computer-generated 3D models of gross anatomy; this worked well but it's hard to distribute disc platters over the network and besides, not everyone has a videodisc player around. Therefore, we shifted to using QuickTime movies for primary delivery of these materials.
At this time, we do not do any application-defined interaction with the animations. The Atlas has access to a list which associates anatomical structures with appropriate movie file names, and can launch an appropriate movie when the user clicks a button or in response to a script command. Movies are then played by an entirely separate application. The Macintosh operating system (7.0 and later) supports a mechanism called "Apple Events"; in the case of the Atlas, an 'ODOC' event is sent to the Finder to tell it the name of a movie file to open. The Macintosh Finder then runs the movie just as if the user had double-clicked on it. (This can lead to problems on systems which are still running older versions of the operating system, or which do not use the Finder; in the long term we plan to eliminate both problems by supporting movies directly in a window within the application, which will also allow for better control and interaction with the animations.)
While the script files are contain only ASCII text, it helps on a Macintosh to set things up so that they can be opened conveniently. There is provision for setting a "creator type" on a document which tells what to do when you double-click on it; in the present case, the script files are given a type of 'ANAt' so that they will be opened by the Atlas program. Alternatively, they may be opened manually from within the application by using the "Open" command out of the file menu. This has the side effect of altering a global setting in the running program so that later file accesses will occur within the folder containing the script -- so a script file is often used to set things up for a particular data set, and the program doesn't have to magically keep track of the locations of its data files. (The recommended tool for editing scripts is the TeachText utility, which will open a script file easily as long as it's under 32K).
Now I suppose you'd like to see a list of all the commands and what they do.
In early prototypes of our client software, only one server connection was possible at a time and different data types were transferred using different protocols, depending mostly on the knowledge, expertise, and mood of the programmer at the time that each was implemented. Most notably, when transferring image data the client and server used a variant of the 2-channel command/data communication style used by "ftp". This worked but required the creation of a new stream for every image, and never gave satisfactory performance. Since the major complaint against these early versions was its lack of speed, a different approach was taken when implementing the production version.
First, the program can be configured to be standalone, finding its data on
locally-mounted disks only; in this case, the network drivers and associated
buffers are never opened, saving RAM for other purposes. If the network is
enabled and active, then and only then will the program attempt to create
a link to a server. These streams are usually set up at the beginning of a
session through the use of script commands which specify the IP address and
port number of the remote machine. There are actually 4 types of server
connections possible:
Glossary entries and terminology-related queries are made to an experimental STRUCTURAL INFORMATION server which is based on XLisp. Messages are sent and received in a Lisp-like syntax, bracketed with parentheses and using quotes to delimit text strings; each request and corresponding reply are detected by their structure as valid S-expressions.
At the beginning of most sessions, a brief connection to a DISPATCH server provides the client with the addresses that it will use for its other connections; this eliminates most of the need for the client to maintain knowledge of what servers are available. Finally, the LOG server can accept a transcript of the activities recorded by a client during a session, providing an easy way to obtain usage and performance data without manual intervention on the part of the user.
The Image and Structural Information server connections are designed to persist throughout an entire session, both to maximize performance and response times for network transfers and to reduce the load on the server machines.
ZapTCP Apple's MacTCP drivers have turned out to be reasonably solid after some puzzling situations were ironed out. The biggest problem we encountered was the fact that an improperly closed network stream will eventually cause the client machine to lock up, presumably when the operating system attempts to store incoming data into a buffer which is no longer valid. This happens if the Atlas program stops for some reason or is force-exited prematurely. One solution is to install the "ZapTCP" extension, a small fix issued by an Apple programmer specifically to combat this behavior. With this extension running, a stream that is still open when an application stops will just result in a message to the user, rather than a complete system failure.
Network timeouts can be specified by a script command to keep the Atlas from waiting indefinitely for incoming data. This is most useful for clients using slow or unreliable network connections, for example when accessing a server located in a distant country. There was another mystifying issue, though, having to do with timing: when an image file is retrieved immediately following the corresponding frame file, certain connections exhibit a strange symptom of timing out and reporting the image as "unavailable" even when the server has already sent the data. To fix this, we tried inserting a two-second pause between asking for a frame and an image file, which took care of the problem. A kludge, certainly, but it works and it's not too noticeable.
Handles are allocated and filled for the following kinds of information:
typedef struct frame_info { int imgtype; PicHandle imghand; // a Handle to the PICT image data long outline_color; int outline_width, outline_height; long highlight_color; Handle contourlist; // linked list of contour records char frame_name[FILENAME_SIZE+1]; } frame_info;The button list is a linked list whose C definition looks like the following:
typedef struct contour { Handle next; // indirect pointer to next contour RgnHandle rgn; // indirect pointer to a QuickDraw region int visible; char name[]; // a variable-length string } contour;In memory, it ends up looking like:
frame_info: frame name: "This frame" image ---> [PICT image data in separate block] outline color: YELLOW outline width: 1 pixel outline height: 1 pixel highlight color: RED contourlist -- | contour "ABCDEFG": visible: 1 rgn --> [coordinate data] next -- | contour "HIJKLMN": visible: 1 rgn --> [coordinate data] next -- ... | contour "XYZ": visible: 0 rgn --> [coordinate data] next --0
The button records are added to the front of the list in the order that they are read from the frame definition file; this ensures that when hit-testing is performed, matching structures are found in a well-defined way. Specifically, if a small structure outline is traced and inserted in the file LATER than a larger one whose perimeter surrounds it, then it will appear to the user to be "on top" of the earlier one.
The ability to access frames from a videodisc continues to be a viable option for anyone wishing to integrate the software with large collections of images that are available on disc. The Atlas program must be configured to use the correct port, baud rate, and command set, as outlined in the guide which accompanies the program; then an index for each videodisc must be built according to the proper format. The latter step may be time-consuming if done by hand, but once done the result may be useful to many people. Any text editor may be used to do the work. If you have entered the data for a widely-avalable videodisc such as the Slice of Life, we would appreciate receiving a copy of your map file so that it can be distributed and used by others.
The Atlas contains some interface and program gadgets to allow the user to select among multiple possible videodiscs; unfortunately no one has ever actually used anything except Dr. Sundsten's Human Brain Animations disc, and the tools for juggling discs were never brought to completion. In practice, you use a script command (in the "settings" file, most likely) to indicate which videodisc is the default, and the appropriate map is used.