Abstract:
An automatic chromosome analysis system is provided wherein a suitably prepared slide with chromosome spreads thereon is placed on the stage of an automated microscope. The automated microscope stage is computer operated to move the slide to enable detection of chromosome spreads on the slide. The X and Y location of each chromosome spread that is detected is stored. At the conclusion of this searching operation, the computer directs the microscope to again sequence through the chromosome spread locations in response to the stored X and Y locations. At this time an operator can view these spreads to determine which ones are worthwhile and which ones are not. He is provided with an accept-reject switch. The microscope stage thereafter again sequences through only the accepted chromosome spreads, and this time a digital photograph of each of the chromosome spreads is made and entered into the computer storage. The computer thereafter measures the chromosomes in a spread, classifies them by group or by type and also prepares a digital karyotype image. This image is converted to analog form, displayed and printed out and constitutes a primary output of the system. Chromosome measurement data is filed in an interactive data base for subsequent statistical analysis. The computer system can also prepare a patient report summarizing the result of the analysis and listing suspected abnormalities.

Description:
ORIGIN OF THE INVENTION 
     The invention described herein was made in the performance of work under a NASA contract and is subject to the provisions of Section 305 of the National Aeronautics and Space Act of 1958, Public Law 85-568 (72 Stat. 435; 42 USC 2457). 
    
    
     BACKGROUND OF THE INVENTION 
     This invention relates to automated medical analysis equipment and more particularly to improvements therein. 
     Since the introduction of a method allowing microscopic examination of individual human chromosomes, the karyotype has emerged as a tool of increasing diagnostic value. Under microscopic examination, the chromosomes, from a somatic cell in the metaphase stage of cell division, appear in scattered disarray. The karyotype is a systematic grouping of metaphase chromosomes from a single cell. This grouping was conceived to assist the geneticist in the identification of individual chromosomes. In normal humans, the 46 chromosomes can be reliably ordered into 24 types (seven groups). The diagnostic value of the karyotype is predicated upon the existence of a consistent pattern in normal patients and the correlation of certain chromosomal aberrations with specific clinical observations. There are two types of chromosomal irregularities: numerical and structural. Numerical aberrations exist when the number of chromosomes in one or more groups differs from the normal case. Structural aberrations manifest themselves in many forms, some presumably unobserved as yet. Those which presently merit nomenclature, amongst others, include variations in arm length and centromere position. 
     At present, manual karyotyping is so tedious and expensive that its general application is usually limited to those situations involving a suspected abnormality. In these circumstances, the clinical evidence is often so overpowering that the karyotype serves primarily as a corroborative tool. In a addition, manual karyotyping offers little prospect of quantitative data. It is desirable to extend karyotype analysis to the clinically asymptomatic situation. For example, screening all newborns by karyotype may detect certain inherited disorders long before clinical symptoms appear. As the potency and reliability of the karyotype improves, fetal karyotyping through amniocentesis may become a routine part of prenatal care. Screening studies on large populations offer the potential of uncovering the effects of industrial and environmental poisons, aging, and long term low dosage ionizing radiations. These factors may manifest themselves in subtle structural aberrations requiring detailed analysis of the chromosome morphology. The ability to process cells rapidly and inexpensively would also aid in the detection of mosaicism, in which two or more cytogenetically distinct lines of cells exist in the individual. 
     There are certain functional requirements for an automated chromosome analysis system which should be met before widespread acceptance thereof can be anticipated. One of these is that the system should be compatible with current practice producing results compatible with those obtained with the present manual system of analysis. Further, the system should provide significant time savings in processing cytogenetic specimens without sacrificing accuracy. Its cost should not be prohibitive and it should be accurate. 
     OBJECTS AND SUMMARY OF THE INVENTION 
     An object of this invention is to provide a system for automating chromosome karyotyping. 
     Another object of this invention is to provide an automated chromosome analysis system which is compatible with current practice. 
     Still another object of this present invention is one which operates rapidly without sacrificing accuracy, and which reduces the cost. 
     The foregoing and other objects of the invention are achieved in a system wherein a previously prepared slide, which has a number of chromosome spreads is mounted on the stage of a microscope. Under instructions of a computer, a search of the slide is undertaken to locate the various chromosome spreads on the slide. The spread locations are stored. At the end of the slide search, it is again initiated with the stage of the microscope being stopped at each chromosome spread location, to enable a human observer to inspect the chromosome spread and determine whether it is acceptable for the purpose of analysis or not. If it is not acceptable the observer pushes a button whereby its location is removed from the spread storage list and the microscope stage is moved to the next location. The microscope automatically focuses at each location. 
     After all of the chromosome spread locations have been inspected, the microscope is again actuated to move its stage so that each one of the accepted chromosome spreads are passed under the optics of the microscope for the purpose of enabling digital pictures of the various spreads to be generated and stored in memory. The computer then proceeds to locate and analyze the chromosomes in each of the chromosome spreads by measuring the chromosomes, classifying them by group or by type and preparing a digital karyotype image format. This image is then converted to pictorial form and displayed on an image display tube to enable any corrections, if needed. A joystick control is provided so that a cursor, which is produced on the display tube screen can have its position moved whereby the operator an point out to the computer objects in the image which he wants removed or chromosomes which need repositioning. Communication with the computer is made using a typewriter. The corrected karyotype image is then printed out. Provision is also made for a printout of the computer analysis of the optical image derived from a slide. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a schematic drawing of a chromosome analysis system, in accordance with this invention. 
     FIG. 2 is a schematic drawing of the apparatus used to drive the microscope stage. 
     FIG. 3 is a flow chart illustrative of the searching and detecting operation, in accordance with this invention. 
     FIG. 4 is a flow chart illustrating the analysis operation in accordance with this invention. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     FIG. 1 is a block schematic diagram of the configuration of the system in accordance with this invention. The preparation of glass slides containing stained metaphase chromosome spreads suitable for use with this invention is known. The slides can be prepared by different techniques, such as the homogeneous Giemsa staining technique or by the Trypsin-Giemsa banding technique. Slides are produced with patient identification marks. A specimen slide 10 is placed on the stage 12 of a microscope 14. The stage 12 is motorized, that is it is capable of being driven in the X, Y and Z directions by three stage motors 16. The stage motors may either be controlled via a motor control interface circuit arrangement 18, from a computer 20, or by a stage joystick 22, when it is enabled to control stage position. A stage keyboard 24 enables an operator to select the mode of operation desired, that is, either computer mode or operator mode. Control of the selection is normally with the operator; however the computer has the option to override the operator mode and/or to inhibit subsequent selection of the operator mode. The mode of operation is displayed by a stage display 26. A typewriter 27 serves to enable entry of data, instructions or queries into the computer or to receive data from the computer. 
     The configuration of the optical imaging system of the microscope allows the specimen to be viewed simultaneously through a binocular eyepiece 28 and by a television camera 30. The output of the television camera is applied to a monitor 32, to an image digitizing system, 34 and also to circuitry designated as &#34;Spread Detector and Auto Focus Unit&#34; 36. 
     The Spread Detector and Auto Focus Unit 36 comprises circuitry which serves the function of detecting the presence of a chromosome spread and also for automatically focusing the television camera equipment for performing these functions is described in an article entitled &#34;Metaphase Spread Detection and Focus Using Closed Circuit Television,&#34; by Johnson and Goforth, published in The Journal of Histochemistry and Cytochemistry in 1974, by the Histochemical Society, Inc. The Image Digitizing System 34 serves the purpose of digitizing the image being viewed by the television camera which is then entered into computer memory. The computer 20 processes each digital image, as will be described and arranges each image in a karyotype format. A gray level display system 37 displays a karyotype image the information for which is supplied by the computer. A joystick 38 associated with the gray level display system is used for positioning a cursor at a location on the face of the display system for the purpose of pointing out certain locations or objects in the display to the computer. The computer can then be instructed by the typewriter to correct the object designated by the cursor, i.e. correct or erase, etc. 
     The hard copy printout of a karyotype image is produced in response to the corrected karyotype information received from the computer. This is applied to the hard copy interface circuit 40. This constitutes a circuit for converting the corrected digital karyotype digital signals to analog form and the associated timing required for enabling the hard copy output device 42, wich is essentially a facsimile printer, to print out a karyotype picture from the analog signals. 
     FIG. 2 is a block schematic diagram illustrating the circuits used in controlling movements of the motorized stage of the microscope. The stage is driven in the X, Y and Z directions respectively by three motors 50, 52, and 54. The Z motor is driven in the +Z or -Z direction by signals from the computer in response to focus drive apparatus 56 in the Spread Detector and Autofocus Unit 36 (FIG. 1). Both X and Y motors are driven in the +X or -X directions and +Y or -Y directions in response to outputs froma +X Or gate 58, or a -X Or gate 60 and a +Y Or gate 62, or a -Y Or gate 64. The inputs to these Or gates, come either from the computer 20, through logic circuits to be described or from the joystick pulse generator 66, as determined by whether the operation is to be in the manual mode or the computer mode. 
     In the manual mode, the direction in which the joystick is moved determines whether pulses are provided on a +X, or a -X or a +Y or a -Y line. +X and -X pulses are applied, in response to joystick motion, from the joystick oscillator to And gates 68 and 71 respectively. These And gates are enabled in response to the output of a mode flip flop 74. When flip flop 74 is set by means of switche 76 to its manual mode, then And gates 68 through 72 are enabled. The other output of the flip flop indicates that the system is in its computer mode. Flip flop 74 can be set in its computer mode by means of a manual switch 76, or the computer can override the switch 76 if a situation arises where computer operation must be maintained. 
     When in the computer mode, the output of flip flop 74 enables an And gate 78 to transfer pulses received from a pulse generator 81, within the computer 20, to another And gate 80, and also to four And gates 82, 84, 86 and 88 whose outputs respectively provide pulse inputs to the Or gates 58, 60, 62 and 64. 
     And gates 82 and 84 are three input And gates. One of the inputs required to enable And gate 82 is the output of an X direction flip flop 90. The computer determines which direction the stage is to move, when the system is in the computer mode,and for one direction sets flip flop 90 with its +X output whereby And gate 82 receives one of its two required enabling inputs. The computer sets the flip flop with its -X output high for the opposite direction, whereby And gate 84 receives one of its two required enabling inputs. Similarly a Y direction flip flop 92 is provided which for one direction is set with its +Y output high thereby providing one of the two enabling inputs required by And gate 86, and for the opposite direction its -Y output is high whereby And gate 88 receives one of two required enabling inputs. 
     The second required enabling input to And gates 82 and 84 is provided by an inverter 94, which is driven by the output of a zero detector 96. The zero detector senses when an X motor drive register 98 has reached zero at which time it supplies an output to the inverter 94 whereby And gates 82 and 84 are disenabled. 
     A similar function is provided by a Y motor drive register 100. When it reaches zero, this is sensed by a zero detector 102. The zero detector output drives an inverter whereby And gates 86 and 88, which are otherwise enabled becomes disenabled. 
     The absolute X position of the microscope stage 12 is maintained by an X cumulative position register 106, which can provide this information to the computer. The X cumulative position register is a reversible counter which can receive +X and -X pulses which are applied to the X motor 50, whereby the X cumulative position register is driven to retain the exact X position of the microscope stage. The computer generates an X coordinate number representing the location to which it desires the microscope stage to move in the X direction. This number is subtracted from the number in the X cumulative position register. The difference represents the distance along the X axis, the microscope stage must move and also represents the number of pulses required to complete such a move. This number is entered into the X motor drive register 98 by the computer. The pulse generator 81 is then instructed to commence supplying pulses, and if And gate 78 is enabled, as it should be in the computer mode, then these pulses are applied through And gate 80 to the X motor drive register, causing it to count down towards zero. These pulses from the pulse generator 81 are also applied to all of the And gates 82, through 86. 
     Since the motor drive register is in its non-zero state, until it has counted down to zero, the one of the two X And gates 82, 84 which is enabled by the X direction flip flop 90 will be able to apply pulses to the X motor causing it to drive the microscope stage. When the X motor drive register reaches zero, this is detected, and the And gate which has been applying pulses to the X motor is disenabled. 
     The circuitry for driving the Y motor in the computer mode is the same as the circuitry used for driving the X motor in the computer mode. A Y cumulative position mode register 107 retains the absolute Y position of the microscope stage 12. It is driven in response to the same pulses which are applied to the +Y and -Y inputs to the Y motor 52. This cumulative position is supplied to the computer which determines the location along the Y axis to which it desires the microscope stage to move. This is subtracted from the Y cumulative position information and the difference is applied to the Y motor drive register by the computer. Pulses from the pulse generator 81 are applied to an And gate 110, which is enabled when the Y motor drive register is not in its zero position. These pulses start to drive the Y motor drive register and are also applied to the +Y and -Y And gates 62 and 64. The one of these two which is enabled is determined by the output of the Y flip flop 92. 
     Accordingly, the Y motor is driven until it reaches the position determined by the computer at which time the Y motor drive register will be at zero. This is detected by the zero detector with the consequent inverter output 104 disenabling the one of the two And gates which was enabled by the Y flip flop 92. Also, no further pulses are applied to the Y motor drive register. 
     Both the X and Y cumulative position register outputs are applied to an X and Y display 112 to be visually displayed. The display comprises apparatus which converts the digital information in the X and Y cumulative position registers into visual information. 
     FIG. 3 is a flow chart exemplifying the search mode of operation. When the computer starts a search the circuitry shown in FIG. 2 is instructed to move a predetermined amount in the X direction. In the embodiment of the invention which was constructed, each step of motion in either X or Y direction is 10 microns, however each move instruction from the computer in either the X or the Y direction is a 160 micron move. The field of view is 200 microns square, and a cell containing chromosomes is on the order of 80 microns in diameter. Accordingly, the instruction by the computer to the circuitry shown in FIG. 2 is to move the stage 160 microns in the X direction and then to institute a delay in order to focus and to permit the spread detector to determine if a spread is present in the field of view. If there is a spread the X-Y coordinates of that location are stored by the computer. 
     Next, a test is made to see if a limit of X travel which is the end of the X line has been reached. If it has not been reached, then the computer issues an instruction to move the next 160 microns in the X direction. If the end of the X line has been reached then a Y move instruction is issued. At the time of issuing the Y move instruction a test is made to see whether or not a limit of Y travel has been reached. If it has been reached, then the search mode is terminated. If it has not been reached, then an instruction to change the X direction is issued. The computer then moves in the Y direction and changes the X direction of motion by applying a signal to drive the X flip flop 90. Thereafter the microscope stage moves until it reaches the end of the new X line where the foregoing routine recurs. 
     To clarify the foregoing, in the search mode the microscope stage is moved from the beginning to the end of one line. It is then instructed to move in the Y direction to the end of the adjacent line, and then instructed to move in the X direction back to the beginning of that adjacent line. At the beginning of that adjacent line the microscope stage is moved again in the Y direction one line and then starts again in the X direction towards the end of the line to which it has been moved. The microscope slide is scanned in this manner from top to bottom over the entire area to be searched. 
     Automatic focusing is carried out each time a chromosome spread is detected. 
     The television camera 30 scans a spread seen through the microscope and displays this on a monitor 32. The spread may also be viewed through the microscope viewing lens 28. Thus, during the editing mode, the operator can use either or both means for editing. 
     After the editing mode, the system goes into its scanning mode. It sequences the microscope stage to the locations of the chromosome spreads which have been accepted, automatically focuses the image, and digitizes the spread image into a scan data set (SDS). The digitization is accomplished by the television camera 30 and the image digitizing system 36. This equipment is commercially available and, by way of example, in an embodiment of the invention which was built, this equipment, called the model 108 Computer Eye, was furnished by a company called Spatial Data Systems, Inc. The camera scanned the image at the standard television rate (525 lines, 60 frames per second, interlace 2:1) and produced a video signal which was monitored on the television display. The brightness value in the scan picture is sampled at each point of a 512 by 480 grid and converted to a 7-bit binary number. Points anywhere in the picture may be selected on the program control, or the digitization can proceed through all points in sequence. A cursor is displayed on the monitor to show the points to be digitized. 
     As soon as the computer detects the presence of a spread image in one of the scan data sets provided by the image digitizing apparatus, it enters into its analysis mode. If the spread image is not to be karyotyped, the chromosomes are located, counted and displayed to the operator for verification. However, if the cell is to be karyotyped, a sequence of programs are executed to effect the karyotype analysis of the cell. These programs locate the chromosomes in a cell, orient them, extract measurements, classify the chromosomes and compose the digital karyotype. After the chromosomes have been isolated, they are displayed on the gray level display device 37 along with sequence numbers to allow the operator to correct cases of chromosome touching and fragmentation. The karyotype is also displayed to allow the operator to verify correct classification. After the karyotype has been approved by the operator, it is formatted for output, combined with the spread image and copied into one of the output data sets. The analysis phase processes cell images one at a time from a raw spread image to digital karyotype. 
     FIG. 4 represents a flow chart illustrating the steps in the analysis phase of operation which have just been described. SDS stands for scan data set. Each chromosome is tagged with a number. Where operator intervention is required, in the case of the spread interaction or karyotype interaction, where break ups are to be fixed or chromosomes are touching, or other problems. The operator moves the interactive joystick to the location of a picture element which required correction. The operator then, by means of the typewriter 27, types an instruction to the computer in response to which the computer performs the required operation. 
     The gray level display system presents a picture of the chromosome spread which has been organized into the standard karyotype format for ease of diagnosis. Similar pairs of autosomes are collected and numbered with homologous pairs being numbered from 1 - 22 and similar pairs being collected into groups lettered A through G based on similar morphology. 
     The gray level display device is a 1029 line television monitor driven by a scan converter called a Hughes 639 scan converter. This is provided by the Hughes Aircraft Co. with instructions for its use and its operation. 
     Hard copy printout is achieved by converting the digital elements into analog signals by the circuits 40, which are applied to the hard copy output device. This comprises essentially a facsimile recorder. 
     There has accordingly been shown and described above, a novel and useful system for scanning chromosome spreads detecting those spreads; editing the detected spreads. Thereafter digitizing the spread images, analyzing, classifying and placing a spread in a karyotype format. This format is displayed on a gray scale display for final correction. Then a hard copy printout of the corrected karyotype image is provided. 
     The Appendix that follows provides a specific description of the computer programs as well as a copy of the program, in the FORTRAN language, used on a DEC PDP-11 computer for performing the operations described. The computer is made by Digital Equipment Corporation, One Iran Way, Marlborough, Mass. This is to be considered as exemplary and not as limiting. The program can be translated for use on other types of general purpose computers, made by other manufacturers by those skilled in the art. 
     The chromosome indentification technique, that is a general description of a method of chromosome identification which was implemented by the programming is described in a volume entitled Chromosome Identification edited by Torbjorn, Casperson and Lore Zech, which is a publication of Proceedings of the Twenty-Third a Noble Symposia published by the Academic Press in 1973. The chromosome analysis procedure which was implemented by the programming is generally described in Perspectives in Genetics, edited by S. W. Wright et al., and published in 1972, by Charles C. Thomas. 
     APPENDIX 
     The computer has a core memory and the software fits into 64K bytes of core memory. It also has three disk drives each of which has two 2.5 million byte disk cartridges. The core memory is partitioned so that it can simultaneously perform three tasks; slide search, chromosome spread analysis on a recorded digital picture of a chromosome spread; and pictorial output generation of an analyzed chromosome spread. All software runs under a disk operating system monitor supplied by the manufacturer, as well as maintenance and interactive statistical analysis. Automatic keryotyping runs under a specially written supervisor (CALMS). 
     CALMS 
     Purpose: Clinical ALMS supervisor - Controls slide search, scanning, analysis and hardcopy output of karyotypes or counts. 
     The CALMS supervisor controls the three &#34;partitions,&#34; search, analysis, and hardcopy. 
     The supervisor occupies core from 30000 to 37777 and includes the hardcopy driver. The search partition is permanently resident at locations 40000 to 46777. System subroutines are permanently resident at locations 47000 to 57777. 
     Scan and analysis consist of 20 phases that residue on disk in core-image format. One phase at a time is loaded into locations 60000 to 156777 and called by the supervisor. (Locations 157000 to 157775 may be used for COMMON storage.) 
     Each analysis phase has a unique identifying number, from 1-20. Scan is phase 1, binary is phase 2, etc. The data set CALMS.OVR is used to store the phases. Each phase required 63 blocks. Program OVB is used to store a phase in CALMS.OVR after it has been linked with a bottom switch of 60000. 
     The following batch stream builds scan (phase 1): 
     $JOB [2,2] 
     $r link 
     #dk5:phase/co,lp:/sh&lt;calms,stb,scan,exit,ftnlib/b:60000/e 
     $r ovb 
     *1 
     $fi 
     similar batch streams build the other phases. 
     An Analysis phase is loaded into core and then called as if it were a subroutine. The disk unit, file name and extension of the current scan data set are passed as parameters. The phase must return to the CALMS supervisor when it is finished. This can be done with a return statement in a subroutine or a call to the CALMS EXIT subroutine from a main program. 
     The following symbols are used to define the scan and hardcopy data sets. 
     Nsds = 3 # of scan data sets 
     Nhds = 2 # of hardcopy data sets 
     Sdu = 5 scan disk unit (DK5:) 
     Hdu = 3 hardcopy disk unit (DK3:) 
     The scan data sets are named S1,S2,S3. The hardcopy data sets are named H1,H2. They are stored under UIC [2,2]. Allocation of data sets is done by: 
     Nfsds: .word .-. # full scan data sets (F) 
     Sds: .blkb nsds if NFSDS contains F (F&gt;0) the first F bytes contain the data set numbers (1=S1, 2=S2, etc) ordered by time of scan. 
     Hds: .blkb nhds each byte gives the status of a particular data set: 
     0 = available 
     1 = in use by mask 
     -1 = full (ready for hardcopy output) 
     When CALMS calls the MASK phase, it gives the current hardcopy data set as a parameter, instead of the current scan data set. When MASK returns, CALMS calls HCOPY, unless it is already operating. Whenever HCOPY finishes, it checks to see if another hardcopy data set is full, and if so, it starts to process it. 
     HCOPY and SEARCH are interrupt-driven and must not call any non-reentrant DOS routines, because the routine they call might be the one that was interrupted. 
     OPEN results in a call to the .INIT routine which is not re-entrant because it gets buffer space for a DDB. Therefore, HCOPY and SEARCH cannot call OPEN. 
     CALMS initially opens all the hardcopy data sets to find their start block numbers and saves them in the HSBN table. 
     The CALMS supervisor flow chart illustrates its operation. The `idle loop` starts at S10 and the program will cycle until a spread can be scanned or analyzed, or a special request has been made (See Flow Chart 1). 
     After a spread is scanned, the program INT1 is called. If the operator only wants to do a count, the spread will not be placed in the analysis queue, and the counting and masking are done at this time. 
     If the spread is to be karyotyped, it will be added to the analysis queue, but if more spreads are to be scanned (and scan data sets are available), they will be scanned before analysis begins. When all spreads on a slide have been scanned, a new slide can be searched while spreads from the previous slide are karyotyped. 
     Flow Chart 2 details the flow of data through the various program and data sets during the karyotyping process. 
     The analysis loop begins at S75, and CALMS stays in this loop until the MASK phase is called (or a restart or abort is requested). 
     After MASK is called, CALMS starts the hard copy partition (unless it is already running), and returns to the &#34;idle loop.&#34; ##SPC1## ##SPC2## 
     SEARCH 
     Purpose: Slide search edit, and focus. SEARCH partition of CALMS 
     SEARCH controls the microscope stage and handles the interrupts from the special-function keyboard and spread/focus data ready. Initially, CALMS calls SEARCH to set up some of the interrupts. Thereafter, SEARCH is interrupt-driven. 
     The operator presses SEARCH start on the special-function keyboard to start a search. Patient ID, sex, slide ID, and source are entered from the typewriter, before the SEARCH actually starts. The SEARCH pattern is a boustrophedon. Each step is 160 microns, and 60 horizontal steps are taken, before a vertical step is taken. Thus, the slide is searched in rows. 
     SEARCH is entered via the spread/focus data ready interrupt, after each step. If the &#34;spread&#34; bit is on, the X and Y values are saved in the spread queue, SPQ. SEARCH will perform an auto-focus whenever 15 steps have elapsed since the last auto-focus, and there is something to focus on. 
     The operator can manually halt the search with the SEARCH halt key. He can then move to another area of the slide and resume the search by pressing SEARCH resume. SEARCH disables the spread/focus data ready interrupt when it receives a SEARCH hlt interrupt, and re-enables it for SEARCH resume. 
     The SEARCH is terminated when 300 spreads have been found, or when the operator presses the edit-start key. 
     Normally, both SEARCH and edit are done at 63X, and there is only one edit. (There is also an option to search at 40X and do a &#34;low-magnification&#34; edit at 40X, followed by a &#34;high magnification&#34; edit at 100X). 
     Edit moves the stage to each spread location saved in the spread queue and initiates an auto-focus sequence. The operator can reject the spread before the auto-focus sequence finishes, and edit will immediately move to the next spread in the queue. If the auto-focus sequence finishes, edit turns on the operator action light and waits for the operator to press &#34;accept,&#34; &#34;reject,&#34; &#34;next&#34; or &#34;last.&#34; 
     The operator normally centers the spreads he wishes to accept. When the accept key is pressed, edit saves the X and Y values in the same place in the queue and flags them by setting them negative. It also increments the rating for the spread by one each time the accept key is pressed. The ratings are stored in a byte table named SPR. 
     When the reject key is pressed, spread rating is zeroed and the X and Y values are made positive. The stage is then moved to the next spread. 
     The next key causes edit to move to the next spread without altering the accept-reject state. 
     The last key causes edit to move to the previous spread. 
     The edit finishes when the end of the queue is reached, or when the operator presses edit-end. The queue is then sorted according to rating. The highest rated spread is moved to the start of the queue, and the stage is moved to this spread in preparation for the first scan. At this point, the queue and other critical information is saved, by calling WPARAM for phase one. This allows a scan restart at a later time. 
     GNSTS is the entry point for the &#34;get next spread to scan&#34; subroutine. It initiates a motor move and auto-focus on the next spread in the scan queue. CSPQ contains the current location. It also enables a spiral search, if search start is pressed. The spiral search is useful in locating a spread close to known coordinates. It takes steps of 50 microns in a spiral pattern and focuses when there is something to focus on. The operator can halt it or resume it with the search halt and resume keys. 
     The focus routine can be entered via the focus key interrupt, or it can be called as a subroutine via a simulated interrupt. It operates by initiating focus motor moves and executing an RTI instruction, after setting up the spread/focus data ready interrupt. When the move is completed, it is reentered and compares the new focus value with the old one to see what the next move should be. Each lens has an initial and final step based on its magnification. The step size is decreased until the final step size is reached. The focus flow chart illustrates the algorithm. 
     (See Flow Chart 3). ##SPC3## 
     SCAN 
     Purpose: To scan a picture onto disk, display it on the gray scale, and calculate sector thresholds. 
     SCAN uses the SDS data camera to scan a picture onto a disk. The picture is scanned by columns, with alternating even and odd TV fields, to achieve the minimum scan time of 17 seconds. Each column is assembled in core and output as a line on disk and on the gray scale. The coils on the SDS monitor have been rotated so that the orientation is the same as on the gray scale monitor. 
     Sector histograms are accumulated as the picture is scanned, and sector thresholds are calculated at the end of each row of sectors. The thresholds are typed out if SW1 is up. The thresholds are written after the last picture line. 
     SCAN sets priority 6 during the pixel digitization loop to prevent interrupts from other devices which would cause it to lose &#34;sync.&#34; Hardcopy interrupts (which are at priority 7) are the only ones allowed, due to their critical nature. When the hardcopy is running, the SCAN takes several seconds longer. 
     SCAN converts pixel values of 0 to 1, and values of 127 to 126. This allows cut and join lines to be differentiated from normal data values. 
     SCAN stores the source code, patient ID and sex, slide ID, X and Y values, date and time of scan into the label of the output data set. 
     The operator may enter additional information as the SCAN ID. 
     BINARY 
     Purpose: To segment the chromosomes and generate an edge file containing the end point coordinates for each segmented chromosome. 
     BINARY will read in a scanned spread and assemble a reduced core image of binary sample points. Each sample point is obtained by averaging a 2×2 pixel area. If this average is above the sector threshold, then the sample point is recorded as a 1-bit. Otherwise, a zero bit is recorded. Thus a digitized spread of 500×480 pixels is reduced to a 250×240 grid of sample points. The resulting binary image is surrounded with zero bits to provide a physical boundary to keep the perimeter walker used in the segmentation algorithm from wandering off the edge of the picture. The binary reduction is accomplished through multiple calls to the subroutines QTHR or STHR. 
     After the binary image has been completely assembled in core, it is scanned line-by-line for chromosomes (1-bits). Each chromosome is &#34;segmented&#34; by recording its starting and ending coordinates on each scan line. Provision also exists for multiple segments to occur on any given line. (See Flow Chart 5) 
     The segmentation algorithm is implemented in the subroutine SEGMENT, which scans the binary image line-by-line for chromosomes. The search is performed by ROACH, which scans each line from left to right, stopping only when it encounters a chromosome. The starting bit location of any chromosome found is recorded and control is transferred to the subroutine TURTLE. TURTLE will walk counterclockwise around the perimeter of the chromosome, recording the segment end. point coordinates as it proceeds. Since the coordinates are recorded in the order they are encountered along the perimeter, they must be rearranged so that they correspond to starting and ending segment coordinates. This is accomplished by sorting the coordinates with the integer sort routine SORTIN. 
     After a chromosome has been completely segmented, it must be removed from the image in order to prevent ROACH from re-encountering it while scanning the next line. The subroutine ERASE will use the segment coordinates to erase (set all 1-bits to zero) the chromosome from the image. 
     At this point, chromosomes may be accepted or rejected on the basis of length, width, area and perimeter measurements. All chromosomes thus accepted are recorded in an edge file, (see Flow Chart 5), in a format suitable for input to the phase SKIRT. 
     PARAMETERS: All parameters are optional and may appear in any order except where specified. 
     Area followed by two integers representing the minimum and maximum allowable cross sectional areas. 
     Ep followed by two integers representing the minimum and maximum number of perimeter points allowable. 
     Length followed by two integers representing the minimum and maximum allowable length. 
     Skirt followed by an integer representing the width of the skirt (in pixels) to be added to all the chromosomes during the SKIRT phase. ##SPC4## ##SPC5## 
     SKIRT 
     Purpose: To increase the cross sectional area of each segmented chromosome by recomputing the segment end points and storing the results in a segment file suitable for input to the CHROME phase. 
     SKIRT will increase the area of each chromosome by extending its boundary outward a uniform distance in all directions. (Flow Chart 6.) Each chromosome is thus skirted with marginal elements to prevent loss of data when the boundaries are recomputed during the rethresholding step (ROB phase). SKIRT requires an edge file as input and generates a segment file. (See Flow Chart 7). 
     The width of the skirt is controlled by the parameter B (number of boundary samples), which is introduced in the BINARY phase. The chromosomes are enlarged by recomputing the segment end points, adding new segments where necessary and merging segments that have grown together. The segment end points are stored in the segment file as triplets (line coordinate and starting and ending sample coordinates). 
     The background gray levels and thresholds for each chromosome are computed by estimating its center of mass and interpolating over the values for the four nearest sectors. ##SPC6## ##SPC7## 
     CHROME 
     Purpose: To gather the gray values of the segmented chromosome from the scanned spread and to store them in a chrome file. 
     CHROME requires as input a scanned spread and its corresponding segment file. Using the segment end point coordinates, CHROME gathers the gray values for each chromosome and stores them in a chrome file in a format suitable for input to the ROB phase (Flow Chart 8). 
     In order to avoid re-reading scan lines, chromosomes which appear on the same line are processed concurrently. For this reason, the gray values are stored in an intermediate buffer (CBUF) until an entire chromosome has been processed or the buffer becomes full. When all the gray values for a chromosome have been gathered in CBUF, the gray values and their associated segment end point coordinates are assembled in one or more chromosome records (see Flow Chart 8) and written onto the chrome file. This task is performed by the subroutine WBUF. If the intermediate buffer becomes full, the chromosome occupying the most space in the buffer will be assembled and written out with a call to WBUF. 
     The intermediate buffer is partitioned into sections of a fixed size and formatted into a list structure to facilitate the allocation and release of buffer areas. The first word of each section contains the buffer index of the next section in the list (=0 for the last section in the list). The remaining words in each section is used to store gray level information. 
     Initially, all the sections are formatted into a single list representing all available sections. The next free section index (NFSI) points to the beginning of this list, and is updated whenever sections are removed from or added to the front of the list. 
     When sections are allocated to a chromosome, indexes pointing to the first and last sections of the chromosome list (FSI and LSI) are maintained in a chromosome directory. ##SPC8## 
     ROB 
     Purpose: To rethreshold and resegment the chromosomes and to store them in a chromosome file. 
     ROB requires as input a chrome file containing segment end point coordinates and gray level information for each chromosome. Each chromosome is reassembled in core and its histogram is generated. Based on its histogram, a new threshold is computed for the chromosome. Using this new threshold, the chromosomes are resegmented by applying algorithms very similar to those used in the BINARY phase, except that the algorithms are applied on the gray values themselves rather than on a binary reduction. 
     The segmentation process begins with a line by line scan for pixels above the computed threshold. This task is performed by the subroutine ISEG, which records the location of any objects that it finds. The task of tracking the perimeter of the object is performed by the subroutine SOT (Son of Turtle), which records the segment end point coordinates as it walks around the object on a counterclockwise direction. The coordinates are sorted to correspond to segment end points by the subroutine SORTIN. 
     The segments are examined for pixels lying within the original boundary for the chromosome established in the BINARY phase. If this search fails (i.e., if the object lies completely in the skirt), the object is rejected. This is necessary to prevent fragments of neighboring chromosomes from being included in the chromosome file. 
     The object is then assembled into one or more chromosome records and the space it occupied in core is zeroed out. The task of moving the object is performed by the subroutine REMOVE, which may optionally contrast stretch the gray values for maximal display. The object may be rejected at this point based on area measurements. The assembled chromosome records are written onto the chromosome file and the object entered into a chromosome directory. 
     The first record of the chromosome file contains the following: 
     
         ______________________________________WORD______________________________________1      Number of chromosomes (maximum of 60)2-241  Chromosome directory containing the following four  numbers for each chromosome:   FBW = First chromosome record written  YMIN = Minimum line coordinate  XMIN = Minimum sample coordinate   LBW = Last chromosome record written242-302    Thresholds used for each chromosome______________________________________ 
    
     The second record contains the following: 
     
         ______________________________________WORD______________________________________1-60      Line coordinate of an internal point for each     chromosome61-120    Sample coordinate of an internal point121-180   Perimeter measure for each chromosome______________________________________ 
    
     The remainder of the file is composed of one or more contiguous chromosomes records for each chromosome. Each such reocrd will contain the following: 
     
         ______________________________________WORD______________________________________1         Number of segments in this records2         Line coordinate for first segment3         Sample coordinate for first segment4         Number of samples (N) in segment5 to N+4  N Gray levels for this segmentN+5       Line coordinate for second segment.         ..         ..         .                       .______________________________________ 
    
     NOB 
     Purpose: To number the objects found by SEGMENT or ROB and display the picture on the gray scale. 
     NOB reads 122 words of parameters into NK, LT(60), ST(60), and FI. If FI is zero, NOB does not display the picture on the gray scale, and calls APHASE (MASKPH). 
     NK is the number of chromosomes and LT and ST are the lines and samples where the numbers are to be placed. 
     NOB reads one line at a time and adds any numbers required on that line. If LT is in order, NOB runs a little faster since it doesn&#39;t have to search the entire table for each line. 
     INT1 
     Purpose: To correct errors in object isolation. 
     INT1 is called immediately after each spread is scanned. The operator normally requests a quick count at this time. If the spread is only to be used for a count, the operator can correct for missing or extra objects and finish it. 
     If the spread is to be karyotyped, cuts, joins, and threshold changes are needed to correct for errors in object isolation. After the objects have been isolated, INT1 is called again to check for any remaining errors. 
     INT1 communicates with CALMS by calling APHASE. It writes parameters to BINARY to indicate a quick count, and to NOB to tell it to call MASK and not display the picture when finishing up a count. 
     MOB 
     Purpose: To orient and measure the chromosomes. 
     MOB orients each input object, accumulates IOD, area and length and calculates centromeric index by length, IOD and area. The unrotated chromosome file (UCR) is MOB&#39;s input (which is ROB&#39;s output) and the rotated chromosome file (RCR) is MOB&#39;s output. The format of RCR is as follows: 
     
         ______________________________________Rec. 1:  Word (1)  = # of input objects (integer)  Word (2,3) = Spread IOD (real)  Word (4,5) = Spread length (real)  Word (6,7) = Spread area (real)  Word (8)   = Next available record in RCR (integer)  Word (9)   = # of chromosomes  Words (16-465) = Chromosome directoryRec. 2:  Words (16-465) = Chromosome directoryRec. 3:  Reserved for CLASFY resultsRec 4-7:  Reserver for BANDS resultsRec 8 &amp;  following records:  Rotated chromosome images______________________________________ 
    
     The chromosome directory (Rec 1 and Rec 2) has the following format: 
     
         ______________________________________Integer   CHDIR (15, 60)     CHDIR (1,1) - CHDIR (15,30) on Rec 1     CHDIR (1,31) - CHDIR (15,60) on Rec 2______________________________________ 
    
     Each entry is as follows: 
     
         ______________________________________CHDIR    (1,I)    = 1st Rec. # of Ith rotated image,               or zero if rejectedCHDIR    (2,I)    = # of lines in imageCHDIR    (3,I)    = # of samples in imageCHDIR    (4,I)    = Length of chromosomeCHDIR    (5,I)    = IOD/8 of chromosomeCHDIR    (6,I)    = Centromeric Index by LengthCHDIR    (7,I)    = Centromeric Index by DensityCHDIR    (8,I)    = Centromeric Index by AreaCHDIR    (9,I)    = Centromere lineCHDIR    (10,I)   = Perimeter of chromosomeCHDIR    (11,I)   = AreaCHDIR    (12,I)   = P.sup.2 /AreaCHDIR    (13,I)   =Centromere Location MethodCHDIR    (14,I)   = Available for expansionCHDIR    (15,I)   = Available for expansion______________________________________ 
    
     MOB will reject objects if they are too large or too small. The maximum allowable size before rotation is 88 × 88. The maximum allowable size after rotation is 88 × 48. The maximum area is 2000 points, and minimum area is 30 points. The minimum length and width are 5 lines and 5 samples. When an object is rejected, its area, length, and width are typed. 
     Originally, MOB had an option to use a skeleton method in locating centromeres. However, this method took 25 sec. longer with little or no improvement in centromere accuracy. This option was removed in order to save core space and allow a larger maximum chromosome size. 
     CLASFY 
     Purpose: To classify the rotated chromosomes into 10 groups (conventional classifier). 
     CLASFY reads in the chromosome directory produced by MOB and classifies each object. Once classification is complete, CLASFY writes the classification tables into RCR, record 3. The format is: 
     
         ______________________________________Word (1)     =      # of samples in karyogramWord (2)     =      No object # flagWord (3-12)  =      Group ID&#39;sWords (13-102)        =      Slot ID&#39;sWords (103-108)        =      Initial slot for each rowWords (109-199)        =      Object found in each slotWords (200-204)        =      Center line table for each rowWords (205-294)        =      Center sample for each slot______________________________________ 
    
     This table is then used by KTYPE to build the output karyogram. 
     Classification is based on an internal table that gives the minimum and maximum allowable centromeric indexes for each length, for each of the ten groups of chromosomes. The table is called CT and is dimensioned (20, 51). The twenty entries for each length are minimum and maximum CI for A-1, A-2, A-3, B, C+X, D, E-16, E-17 and E-18, F and G+Y. 
     First, an initial classification is made. Then, moves are made from &#34;heavy&#34; groups to &#34;light&#34; groups. When there are several candidates for a move, the one with &#34;maximum likelihood&#34; is chosen. 
     After all possible moves have been made, the chromosomes within each group are ordered according to the slope table which describes the slope of a line that sweeps in from the right. Most groups are ordered by size. When the C+X group has 15 or 16 members, the third largest or third and fourth largest are placed in the X slots. When G+Y has five members, the chromosome with the maximum fit factor is placed in the Y slot. 
     The classification table can be supplied to CLASFY with the OS parameter, followed by the object numbers for the slots. In this case, CLASFY sets up the karyotype format but does not do any classifications. 
     KTYPE 
     Purpose: Builds KARYOGRAM and displays it on the gray scale. 
     KTYPE utilizes the chromosome directory, the classification tables and the rotated images on RCR to build the karyogram on KGM. 
     IBUF is a 20480 byte buffer that holds one record for each object on the current line. Since the record length is 1024 bytes, twenty objects can be accommodated. 
     KTYPE builds the karyogram one line at a time, inserting line segments from IBUF, object numbers, centromere marks and slot ID&#39;s at the appropriate time in the appropriate place. 
     INT2 
     Purpose: Provide operator interaction to fix karyotype errors. 
     INT2 is called after the chromosomes have been measured, classified, and displayed as a karyotype. The operator can correct rotation errors, centromere errors, and classification errors. The corrections are normally done in the above order, since a rotation error usually causes a centromere error and a centromere error usually causes a classification error. 
     INT2 uses WPARAM to write parameters to MOB and CLASFY and uses RPARAM to read them back to see what has previously occurred. If the operator corrects rotation and centromere errors and does not move any chromosomes around, INT2 will allow CLASFY to reclassify on the basis of the new measurements. After the operator starts making moves, INT2 tells CLASFY what the karyotype should look like and does not allow an automatic reclassification. 
     RESEL 
     Purpose: Save information on measured chromosomes. 
     RESEL uses the MOB output to rearrange the measurements in order of type and store them in KDATA (BDATA for banded spreads). It also writes the patient report line in PDATA. 
     
         ______________________________________Format of KDATA: RECLEN = 1024______________________________________Line 1  Directory Record 1 for Source 1 spreadsBytes1-2     NEXT      1*2      Line # of next Dir Rec for                       Source 1, or 03-4     NUSED     1*2      # of spreads in this Dir                       Rec max is 855-854   PID (850) BYTE     10 byte patient ID for                       each spread, or 0855-1024   LINE (85) 1*2      Corresponding data line #                       for each spreadLine 2  Directory Record 1 for Source 2 spreads..Line 15 Directory Record 1 for Source 15 spreads______________________________________ 
    
     When &#34;NUSED&#34; becomes 85, next available line # will be inserted into NEXT. Then the line in NEXT will be the next directory record for this source. 
     Line 16-500 Data Records and Directory Records, if necessary 
     
         __________________________________________________________________________Bytes__________________________________________________________________________1-64          LABEL 1               (First 64 bytes) source, patient,               sex, slide, X,Y65-84         LABEL 2               (First 20 bytes) scan time85-104        LABEL 3               (First 20 bytes)scan ID105-124       LABEL 4               (First 20 bytes) diagnosis125-126 NC      1*2   # of chromosomes in the karyotype127-128 LSUM    1*2   Length sum (not normalized               for 46)129-132 ISUM    REAL*4               IOD sum (not normalized for 46)133-136 ASUM    REAL*4               Area sum (not normalized for 46)137-144 UNUSED145-224 ON (80) BYTE  Object #&#39;s for types 1-24, 25-30,               31-40, or 0225-304 ONL (80)         BYTE  # lines for each object305-384 ONS (80)         BYTE  # samples385-464 LEN (80)         BYTE  Length (adjusted for bend)-un-               normalized)465-624 IOD (80)         I*2   IOD/8 - unnormalized625-784 AREA (80)         I*2   Area785-864 CIL (80)         BYTE  CIL865-944 CID (80)         BYTE  CID945-1024 CIA (80)         BYTE  CIARecords 2-4 for Banded Data1-1632 OCFOUR(51,8)         REAL*4               C for types 1-24,25,261633-3060 OPHI (51,7)         REAL*4               PHI for types 1-24, 25, 26Negative Source = Banded spread and uses DK4:BDATA[6,6]__________________________________________________________________________ 
    
     MASK 2 
     Purpose: To combine two pictures and add a border. 
     MASK2 combines the numbered spread and karyotype into a single picture formatted for the hardcopy. The output is written on disk, with an option to also write it on tape if switch 5 is up. 
     The picture on disk is written in hardcopy format, with four bits for each element, and the picture on tape is written with eight bits for each element. Gray scales, reference masks and annotation are added to the picture. 
     MASK2 is also used to combine the numbered spread and the raw spread for counts. It checks for the KG parameter followed by the disk unit and filename for the raw spread. 
     MASK2 calls subroutines MSUB, WEDGE, REF, and WLINE to do the bulk of the work in creating the output picture. 
     BAND 
     Purpose: To find the waveform and calculate Fourier coefficients for banded chromosomes. 
     The input to BAND is the rotated chromosome file, RCR. For each chromosome, BAND first decides if the chromosome is straight or bent. 
     For bent chromosomes, BAND curve fits a parabola to the boundary points and recalculates the chromosome length. The waveform is determined by sampling along the parabola, and using three points perpendicular to the slope of the parabola. 
     For straight chromosomes, the waveform is determined by sampling along each line, using a moving window of eight points. The maximum value found along the line is used. 
     A and B Fourier coefficients are then computed from the waveform values for eight harmonics. From these, C (Amplitudes) and PHI (Phase Angle) are computed and saved in records 4-7 of the rotated chromosome file, RCR. Length and centromeric index are passed to FOUR as parameters. 
     BAND recognizes the following parameters: 
     Wa: store a representation of the waveform in place of the rotated chromosome images. 
     Ax: mark the axis for each chromosome 
     Qb: quick BAND -- process only the C group. 
     FOUR 
     Purpose: To classify banded chromosomes using Fourier coefficients, length and centromeric index. 
     The inputs to FOUR are the classification table of means and variances, and the banded chromosome measurements. FOUR computes the likelihood that each chromosome belongs to each of the chromosome types, using 14 measurements -- length, centromeric index by area, C(2) to C(8), and PHI (2) to PHI (6). 
     If a chromosome&#39;s length or centromeric index differs by more than 6 S.D. for a particular chromosome type, that type is ruled out for that chromosome. Similarly, if the C sum or PHI sum exceeds 7 S.D. or the total sum exceeds 8 S.D., that type is excluded for that chromosome. 
     The chromosomes are then classified in order of likelihood, subject to group membership rules. This procedure may leave some chromosomes unclassified, since certain types may have been excluded for certain chromosomes. 
     Using the unclassified chromosomes, the most likely classification is found, say chromosome i belongs to group j. The chromosomes in group j are then examined to see if one of them can be moved to another group that is not yet full. If so, the most likely move is made. 
     The classification results are written as parameters for CLASFY. 
     PREP 
     Purpose: To print the patient report 
     PREP reads the patient report records that were written on disk by RESEL, and prints them on the line printer. If the parameter PL is used, the records for differnet patients are separated by a double space. Otherwise, each patient&#39;s report is on a separate page. 
     ABNORM 
     Purpose: To print information on abnormal chromosomes ABNORM is called only when console switch 10 is down. It reads the rotated chromosome file, RCR, and examines the profile of each chromosome to determine centromere information. It then prints a message for each chromosome, regarding its normality. 
     KFIX 
     Purpose: Syntactical classification within B,D,F, and G groups. 
     KFIX is the final phase of the hybrid classifier for banded chromosomes, and operates as follows: 
     (1) Take the 4 chromosomes in the G group. Measure the position along the length of the chromosome of the brightest band. The 2 chromosomes with the bright band closest to the center correspond to the G-21 the other two are the G-22. 
     (2) Take the 6 chromosomes in the D group. Measure the ratio of average IOD in the upper half of the chromosome so that of the lower half of the chromosome. The two smallest values correspond to the D-13, the two largest values correspond to the D-15 and the remaining two are the B-14. 
     (3) Separate the F-19 and F-20 chromosome by IOD. The two chromosomes with the smallest integrated optical density are the F-19&#39;s. 
     (4) Take the B group. Measure the average IOD between the centromere position and a distance along the long arm equal to the short arm length or to the midpoint of the chromosome, whichever is shorter. The two chromosomes with the largest value correspond the B-4. 
     MVIO 
     Purpose: To read and write contiguous files with automatic double buffering, blocking, and random or sequential access to lines of data. 
     The calling sequences for the six entry points are as follows: 
     Call open (mvb,bufsiz(dbflag,mode,lname) 
     call get (mvb,line,index[,nora]) 
     call put (mvb,line,index) 
     call close (mvb) 
     call read (mvb,line,index,loc) 
     call write (mvb,line,loc) 
     an OPEN call is required before any GET or PUT calls can be made to a dataset. The user must provide core space large enough to hold all the necessary control blocks and control information, as well as the data that is to be read or written. This allows MVIO to be re-entrant. In addition, no space is wasted on unused data sets, as would happen if MVIO contained storage for a fixed number of data sets. 
     The control information can be considered as a &#34;mini-VICAR-block&#34; or MVB. Each MVB is 56 bytes long and contains a tran block, link block, filename block and the information required by MVIO. (See Flow Chart 9) 
     The MVB is followed by one or two buffers to hold the data that is read or written. Each buffer is a multiple of the RK11 disk block size (512 bytes). An entire buffer is normally read from or written onto the disk with a single access. This greatly increases the effective transfer rate. When two buffers are provided, MVIO allows the user to overlap computation with the disk input/output. 
     GET and PUT are called to obtain the index relative to the start of the MVB for the desired record in the data set. Thus the data does not have to be moved from one buffer to another. On most &#34;get&#34; calls, the requested line will already be in one of the buffers and MVIO simply returns the index without any physical I/O required. 
     PUT is called to obtain the index of where to store the line that is to be written. MVIO initiates physical I/O when a buffer has been completely filled. A &#34;close&#34; call is required to write any data left in a buffer by earlier &#34;put&#34; calls. ##SPC9## 
     A logical record (or line) can be smaller than, larger than, or the same size as the physical block size (512 bytes). As previously noted, each buffer is a multiple of 512 bytes in length, but the buffer must also be large enough to hold a complete logical record. 
     MVIO (See Flow Chart 9) is normally used in conjunction with the label subroutines GLABEL and PLABEL, which are described in more detail elsewhere. They set up some of the fields in the MVB when the picture data is preceded by a label. 
     The fields in the calling sequences are defined as follows: 
     MVB is the location of the MVB for the data set. The user must reserve enough core for his buffers immediately following the MVB. 
     BUFSIZ is the size of each buffer (multiple of 512 bytes). 
     DBFLAG is the flag for double buffering, 0 = no double buffering (one buffer), 1 = double buffer (two buffers). 
     MODE is defined as: 
     
         ______________________________________0 = Disk Input   0,1 and 2 are functionally1 = Disk Output  equivalent2 = Disk Update4 = Tape Input   4, and 5 are functionally5 = Tape Output  equivalent______________________________________ 
    
     LNAME is a three character logical name for the data set that can be used to assign it to a file with the $AS command. (Subroutine AFILE can be used to make a default assignment). 
     LINE is the desired line number, positive for data lines, negative for label records, and zero for the &#34;next&#34; line. 
     INDEX is the offset in bytes from the start of the MVB to the requested line. In Fortran, when MVB is defined as a byte array, sample J of the requested line is at MVB (J+INDEX). In Marco, MVB+INDEX is the location of the first sample of the requested line. 
     INDEX is set to zero for an end-of-file read from tape. 
     NORA is an optional parameter to prevent read-ahead. 
     READ and WRITE can be used when RECLEN = BUFSIZ and single buffering is specified. A line is read into LOC, or written from LOC, without any overlap. 
     Updating is normally done with a GET and a PUT for the record to be updated. (The same index value will be returned on the GET and PUT.) This insures that other records in the block and other blocks in the buffer will not be changed. 
     The &#34;get&#34; can be omitted only if all records are &#34;put&#34; sequentially, starting with the first record of a block. 
     The MVB format is shown below. Word numbers are in decimal, starting at 1 and byte numbers are in ocatl, starting at 0. TB = tran block, LB = link block, and FB = filename block. 
     
         __________________________________________________________________________WORD  BYTE        CONTENTS__________________________________________________________________________1     0    TB     Active Block #2     2    +2     Active Buffer Address3     4    +4     Word Count4     6    +6     Function/Status5     10   +8     Words Not Transferred6     12   IBN    Inactive Block #7     14   IBA    Inactive Buffer Address8     16   -2     Error Return9     20   LB     Link Pointer10    22   +2     Logical Name11    24   +4     Unit #! Words To Follow12    26   +6     Device Name13    30   CRC    Current Record #14    32   -2     Indicator ! Unused15    34   FB     File Name (Word 1)16    36   +2     File Name (Word 2)17    40   +4     Extension18    42   +6     UIC19    44   WNT    Words Not Transferred20    46   SBN    Start Block #21    50   NBF    # Blocks In The File22    52   NLR    # Label Records23    54   RECLEN Record Length (Multiple or Divisor of BLKSIZ)24    56   BLKSIZ Block Size25    60   BUFSIZ Buffer Size (Multiple of BLKSIZ and RECLEN)26    62   BPB    Blocks Per Buffer27    64   DBF/MD Mode ! Double Buffering Flag28    66   WFLAG  Write Flag (Last Block # To Be Written__________________________________________________________________________             + 1) 
    
     LABEL 
     Callable Entry Point Names: GLABEL, PLABEL 
     Purpose: To obtain and store label information on disk data sets. 
     These subroutines are used in conjunction with MVIO, when processing labeled data sets. They obtain or store the label parameters, and also set up the BLKSIZ, RECLEN, NLR, and BPB fields in the MVB. GLABEL and PLABEL must be called after the OPEN call for the MVB. 
     CALL GLABEL (MVB, SPAR, INDEX) to get a label 
     CALL PLABEL (MVB,SPAR,LABEL) to put a label 
     MVB is the mini-VICAR block for the data set. 
     SPAR is a five word table of system parameters 
     Spar (1) = nl, # lines of picture data 
     Spar (2) = bpl, bytes per line 
     Spar (3) = bpe, bits per element 
     Spar (4) = nlr, # of label records 
     Spar (5) = blksiz, block size 
     GLABEL transfers the label information into SPAR. 
     PLABEL transfers the data in SPAR to the label. 
     Index is the offset from MVB to the first byte of the label, as returned by `get.` 
     Label is the location of the label to be output. 
     Example: 
     
         ______________________________________INTEGER SPAR (5)BYTE A (4200), B (4200)CALL OPEN (A,2048,1,0,`MV1`)                   Open A for inputCALL OPEN (B,2048,1,1,`MV2`)                   Open B for outputCALL GLABEL (A,SPAR,IA) Get label from ACALL PLABEL (B,SPAR,A(IA+1))                   Put label to B______________________________________ 
    
     GLABEL can also be used with an unlabeled data set. It will return NL as the # blocks in the data set 
     Bpl = 512 
     bpe = 8 
     nlr = 0 
     these routines are re-entrant, except when GLABEL is used with an unlabeled data set. 
     EXIT 
     Purpose: To replace the FORTRAN exit and error subroutines and save 1260 bytes of core. 
     EXIT can be used to save core after a FORTRAN program has been checked out. ERRA gives a single error message (A367), instead of the individual messages normally given by the FORTRAN error routine ERRA. 
     When EXIT is called, it will either return to DOS via a .EXIT or return to CALMS via an RTS R5. It makes this decision by checking the value of R5 when EXIT was called. When DOS loads a program, it clears R5, but when CALMS loads a program, R5 is equal to a location within CALMS. 
     Therefore, CALL EXIT will work for programs running under DOS or under CALMS. 
     In order to select EXIT.OBJ over the FORTRAN exit subroutine, specify EXIT before FTNLIB in the link command string. The /SU switch should be used in the FORTRAN command string to save additional core and time. 
     All FORTRAN modules of CALMS should be compiled with /SU or they may not fit in core. 
     SAVER 
     Purpose: To save and restore registers 0-4 on the stack, for subroutines called with an R5 calling sequence. 
     SAVER and RESTR provide a convenient way for MACRO subroutines to save and restore registers 0-4 on the stack. 
     To save registers 0-4: 
     JSR R4, SAVER 
     To restore registers 0-4 and return via R5: 
     JMP RESTR 
     (SAVER is called via R4, and R5 is not saved.) 
     AFILE 
     Purpose: To assign a file to a dataset. 
     CALL AFILE (MVB, DUNIT, FILPEX, GRP, USR) 
     MVB is the mini-VICAR block for the dataset. 
     DUNIT is the disk unit (1 for DK1:, 2 for DK2:, etc.) 
     FILPEX is the 6 character filename plus 3 character extension. 
     GRP is the group number from the UIC 
     USR is the user number from the UIC. 
     Example: 
     Call alfile (a,1, &#39;pic &#39;, 5,5) 
     assigns DK1:PIC[5,5] to MVB A 
     PARAM 
     Callable Entry Point Names: PARAM, PARBUF 
     Purpose: To read free-field parameters from the keyboard and convert them. 
     PARAM types an *, then reads up to 80 characters from the keyboard, terminated by a carriage return. Parameters are separated by blanks or commas, and can be one of the following: 
     1. One word integer -- negative integers are preceded by a minus sign. 
     2. Two word alphameric -- first character must be alphabetic. The character string is padded with trailing blanks if less than 4 characters. It is truncated if more than 4 characters. 
     3. Variable length alphameric -- the string is enclosed in apostrophes. If an odd number of characters, the last word is padded with a trailing blank. If an apostrophe is desired, type two consecutive apostrophes. 
     The raw character string is saved at `PARBUF` which is accessible to MACRO programs, but not FORTRAN. However, the user can optionally supply his own PARBUF. 
     The calling sequence is: 
     Call param (n,p par, maxnp [,parbuf]) 
     np is the number of parameter words that were stored in PAR 
     Maxnp is the maximum allowable number of parameter words (the size of PAR) 
     Parbuf is optional 83 byte user buffer for the raw character string. 
     Example: 
     Integer par (20) 
     call param (np, par, 20) 
     if the user types: 
     Nh, print, 42, -1, `abc` `def` 
     the result is: 
     Par (1) = nh 
     par (2) = aa 
     par (3) = pr 
     par (4) = in 
     par (5) = 42 
     par (6) = -1 
     par (7) = ab 
     par (8) = c&#39; 
     par (9) = de 
     par (10) = fa 
     np = 10 
     param is reentrant if the user supplies PARBUF. However, an earlier keyboard input request must be satisfied before a latera one can be done. 
     PARAM maintains a byte with the global name `PBUSY`. It is set to one when PARAM is entered, and cleared when PARAM exits. 
     Any program which is entered by an interrupt (such as SEARCH or HCOPY) must check that PBUSY = 0 before calling PARAM. If PBUSY is not zero, the program must signal PARAM that it is waiting to call it, but could not because PARAM was busy. It does this by storing the location for PARAM to transfer control to in `PINT` or PINT+2, and then executing an RT1. 
     PARAM will then call the waiting routine with a simulated interrupt, when it has finished with the earlier request. 
     (The PBUSY, PINT method is required under DOS; otherwise the KB driver gets confused). 
     QPRINT 
     Purpose: To print a message, with automatic buffering 
     QPRINT waits for completion of a previous print, moves the message to its own buffer, initiates a print with a TRAN request, and returns to the user. 
     CALL QPRINT (LOC[,NBYTES]) 
     LOC is the first byte to be printed (carriage control). NBYTES is the number of bytes to be printed. (maximum -- 132). 
     NBYTES can be omitted if the message is terminated with a &#34;zero&#34; byte. 
     FORTRAN automatically inserts a zero byte for literal strings and `ASCIZ`, in MACRO, also does this. 
     Example: 
     Call qprint (`single space`) 
     Call qprint (`0 double space`) 
     TYPE 
     Purpose: To type a message with automatic buffering 
     TYPE is similar to QPRINT, except that output is on the keyboard and the maximum message length is 80 bytes. 
     CALL TYPE (LOC [,NBYTES]) 
     If NBYTES is omitted or zero, a null (0) terminates the message. TYPE inserts a &lt;CR&gt; at the end of the message unless NBYTES = 0. 
     IV 
     Purpose:  To convert and move logical *1 (byte) data and word data 
     IV is a function and the other entry points are subroutines. These routines consider bytes to be positive numbers from 0-255. (FORTRAN treats bytes as signed numbers from -128 to +127.) 
     Iv (byte) = Integer value (0-255) of a byte variable 
     Call itl (int, l1) (integer to logical) 
     move the low order byte of INT to L1. 
     Call mvl(l1, l2, n) (move LOGICAL) 
     Move N bytes starting at L1 to L2 
     Call mvw (i1, i2, n) (move WORD) 
     Move N WORDS starting at I1 to I2 
     Call zia (ibuf,n) (zero INTEGER array) 
     Zero N WORDS starting at IBUF 
     Call itla (int,l1,n) (integer to LOGICAL array) 
     Store INT in N bytes starting at L1 
     Call swap (i1, i2) 
     interchange I1 and I2. 
     Note: RO is not saved by these routines! 
     TEXT 
     Purpose: To generate readable characters for labeling of pictorial output. 
     Each character is generated from a six sample by seven line array of BIT, where a one BIT represents black and a zero bit represents white. The left most of the six samples is always zero. 
     CALL TEXT(INBUF, INCHR, LINE, OUTBUF, SIZE) 
     Inbuf is the location of the input ASCII characters 
     Inchr is the # of input characters 
     Line is the line number (0-6) of the bit array 
     Outbuf is the location for the output bytes 
     Size is the number of bytes to store for each bit (1,2, . . . ) 
     Outbuf must be at least INCHR*SIZE*6 bytes long 
     HCPAK 
     Purpose: To pack and unpack data in hardcopy format (4 bits) and convert from 7 to 8 bit format. 
     Call hcpak (buf8, buf4, ne) 
     call hcupk (buf4, buf8, ne) 
     call mvw78 (buf7, buf8, nw) 
     buf8 is the LOC of 8-Bit Data 
     Buf4 is the LOC of 4-Bit Data 
     Buf7 is the LOC of 7-Bit Data 
     NE is the number of elements to pack or unpack. NW is the number of works to convert from 7-Bit format to 8-Bit format. 
     RPARAM 
     Purpose: To pass parameters to a CALMS phase and to assign the next phase to be loaded. 
     Call wparam (np, par, pnum) 
     np is the number of words of parameters to write 
     PAR is the location of the parameters 
     PNUM is the number of the phase which is to receive the parameters 
     Call rparam (np, par, npmax [,pnum]) 
     to read parameters through the CALMS supervisor. See the PARAM writeup for details. PNUM is an optional phase nunber used to read another phase&#39;s parameters. 
     Call aphase (n) 
     normally, phases are loaded in sequence, but APHASE is used to change the sequence. 
     N is the number of the phase. 
     DLINE 
     Purpose: Subroutines used to access the gray scale and cursor, when running under the CALMS supervisor. 
     CALL DECLEAR to erase the entire gray scale. 
     CALL DLINE (LOC,Y,X,NS,REPL,ERASE) to write a line of data. 
     LOC is location of data in core. 
     Y is line on gray scale (0-1023) 
     X is starting sample on gray scale (0-1023) 
     NS is number of samples 
     REPL is non-zero to replicate samples and lines. (If switch 3 is up, only samples are replicated) 
     ERASE is 
     positive to erase this line before writing 
     negative to erase only 
     zero to write only. 
     CALL DWAIT to wait for gray scale ready 
     CALL CURSOR (Y,X,LINE,SAMP) to read the cursor. 
     Y is the line on the gray scale (0-1023) 
     X is the sample on the gray scale (0-1023) 
     LINE is the picture line (1-512) 
     SAMP is the picture sample (1-512) 
     CALL SC sets up the cursor adjustments and saves them on disk as parameters for INT1. 
     CALL RCA reads in the cursor adjustments from disk. 
     CALL MCU moves the cursor up one line 
     CALL MCD moves the cursor down one line 
     CALL MCL moves the cursor left one sample 
     CALL MCR moves the cursor right one sample 
     CALL UDLR (PAR) moves the cursor one step according to whether PAR is a U,D,L, or R. 
     The cursor adjusment process is required to correct for cursor drift. Two marks are written on the gray scale, one at 32, 32 and one at 992, 992. The operator is requested to move the cursor to these reference positions and the readings are saved. Thereafter, CURSOR performs a linear interpolation on all cursor readings, using the saved values. 
     There is also a standalone version of DLINE in FTNLIB. It differs from the CALMS version in the way the cursor adjustments are saved and read back. 
     MCISUB 
     Purpose: Subroutines to control the MCI and sort the spread queue. 
     This module consists of miscellaneous subroutines used by SEARCH and CALMS. It also globally defines the MCI register addresses and interrupt vector locations. 
     Call ixyabs (y,y) initiates a motor move to X,Y 
     Call ixrel (xdel) initiates a relative X move 
     Call iyrel (ydel) initiates a relative Y move 
     Call ifrel (fdel) initiates a relative F move 
     Call cfoc (f) stores the sum of the two focus parameters 
     Call led (code,val) puts VAL in the LED whose code is given 
     Call mfst (magn, fpos) stores the magnification and filter position in MAGN and EPOS, and displays the magnification in the magnification LED. It also stores FSTEP, FLAST, XADJ, and YADJ for the lens in use. 
     Call sortq sorts the spread queue according to its rating. 
     ROACH 
     Function: roach (wi,bi,word,ewi,mask) 
     roach will scan a binary line to locate the first set bit. The scan will begin at WORD (WI) and end at WORD (EWI). If no set bit is found, the return code is zero. If a set bit is found, WI is returned as the index of the word containing the bit. BI is the bit index within the word (numbered 0, 1, 2, . . . , 15). The corresponding bit position within the MASK is also set. 
     TURTLE 
     TURTLE is invoked by SEGMENT to walk counterclockwise around the perimteter of objects in the binary picture. 
     Call turtle (common,edge,wod,mask,nw2) 
     common is composed of the following six words: 
     N = the number of segment end points found 
     Perim = the number of perimeter points found 
     Ymin,xmin, ymax,xmax, = the extreme coordinates of the object 
     EDGE is an integer array into which is placed the coordinates of the detected end points. On input, WORD points to the word containing the first detected bit of the object and MASK designates the bit positions within that word. NW2 is the number of bytes per line. 
     The TURTLE uses a four point connectivity algorithm in walking around the perimeter. At each step, the TURTLE will examine its four adjacent neighbors, numbered 0,1,2, and 3 (See Flow Chart 10) to determine its new direction. The order in which neighboring samples are examined is predetermined to ensure that the TURTLE will always proceed in a counterclockwise direction (See Flow Chart 11). 
     Since not all perimeter points are segment end points, the TURTLE uses a decision table to identify the end points. End point determination is based on the TURTLE&#39;s previous and current directions, and his conviction that since he is traversing the perimeterin a counterclockwise direction, the chromosome will always remain on his left. Line segments which contain only one sample are recorded twice so that all segments have starting and ending end point coordinates. The TURTLE&#39;s decision table is given in Flow Chart 10. The number of times perimeter points are recorded as end point coordinates appears in parentheses. ##SPC10## ##SPC11## 
     SORTIN 
     SORTIN is invoked by SEGMENT to sort the end point coordinates for a chromosome in the order that they would be encountered while scanning the chromosome line-by-line from left to right. Thus, the short is in assending order, first by line coordinate, and second by sample coordinate. 
     Call sortin(edge,n,ind) 
     n is the number of end points. 
     Upon return, IND=0 if the sort was successful, ≠ 0 if not. 
     EDGE is a buffer area 4N words long. The first 2N words contain the end point coordinates for the chromosome. The remaining 2N words is used as a work area for the bucket sort routine. 
     SORTIN uses a byte array to keep track of the ordering of the end points. Because of this, a maximum of 255 end points may be sorted. 
     ERASE 
     ERASE is invoked by SEGMENT to remove a chromosome from the binary spread image. 
     Call erase(word,edge,area,n2,nw) 
     word points to the buffer area containing the binary image. 
     EDGE points to the end point coordinates for the chromosome. 
     N2 is the number of coordinates in EDGE (two per coordinate pair). 
     NW is the number of words per line in the binary image. 
     AREA is returned as the number of sample points contained in the chromosome. 
     ORIOB 
     Purpose: Orient objects. 
     Call oriob(ibuf,obuf,ef,chdir,nl,oprot,rcode) 
     oriob finds the minimum enclosing rectangle for the object in IBUF using the endpoint table EP and 32 rotations from 0° to 90°. It then rotates the object into OBUF and sets the rotated NL and NS in CHDIR. OPROT specifies any additional rotation desired by the operator. 
     EPROT 
     Purpose: Rotates chromosome endpoints. 
     Call eprot(sin,cos,nl,ep,xmin,xmax,ymin,ymax) 
     eprot rotates the endpoints (EP) by the angle specified by SIN and COS. It returns the limits of the enclosing rectangle (XMIN,XMAX, YMIN,YMZX). 
     OBROT 
     Purpose: To rotate objects. 
     Call obrot(xmin,xmax,ymin,ymax,cos,sin,ibuf,obuf) 
     obrot rotates the object in IBUF into OBUF. COS and SIN specify the rotation angle and XMIN,XMAX,YMIN,YMAX give the enclosing rectangle of the object in unrotated coordinates. 
     Four point linear interpolation is used to set the intensity values of the rotated object. 
     ACCSUB 
     Purpose: Accumulate area and density by sample for rotated object. 
     Call accsub(buf,nl,ms,areaa,dena,tarea,tden) 
     the chromosome is located in BUF and is NL by NS. AREAA is the area accumulator by sample and DENA is the density by sample. TAREA and TDEN are the area and density totals for the object. 
     CHROUT 
     Purpose: To stand objects up and move them into the output buffer. 
     Call chrout(ibuf,obuf,ns,nl,lpb,ip,flg,bufsz) 
     chrout rotates the object in IBUF (NS X NL) by ± 90° in to OBUF for output. LPB gives # of lines that will fit into OBUF, FLG tell which way to rotate object and BUFSZ is NS for IBUF. 
     KURSOR 
     Purpose: To locate information about the karyogram for the current cursor position. 
     Call kurso r(y,x,l,s,slid,slcl,slcs,n) 
     y,x,l,s are the cursor coordinates returned by cursor. SLID is the slot ID indicated; SLCL and SLCS are the slot center coordinates; and N is the object ID of the object residing in the slot. ##SPC12## ##SPC13## ##SPC14## ##SPC15## ##SPC16## ##SPC17## ##SPC18## ##SPC19## ##SPC20## ##SPC21## ##SPC22## ##SPC23## ##SPC24## ##SPC25## ##SPC26## ##SPC27## ##SPC28## ##SPC29## ##SPC30## ##SPC31## ##SPC32##