home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff235.lzh / Ct / CT.readme < prev    next >
Text File  |  1989-08-06  |  13KB  |  254 lines

  1.  
  2.                   CT IMAGE PROCESSING PROGRAM DOCUMENTATION.
  3.                         Version 2.2, August 2,1989.
  4.  
  5.     The program CT is copyright 1989 by Jon Harman.  It is freely
  6. distributable as long as this documentation is included.  I can be 
  7. contacted at:
  8.  
  9.             Jon Harman
  10.             Imatron
  11.             389 Oyster Point Blvd.
  12.             S San Francisco, CA 94080
  13.             (415) 583-9964
  14.  
  15.     I wrote this program as a tool at work to help me test out ideas.
  16. Because I only intended it for my own use it has a very rudimentary user
  17. interface.  For this I apologize.  I hope this documentation can ease some
  18. of the difficulties.  The user interface is a hard problem because CT is 
  19. something of a hybrid.  It has a high res interlaced screen at the bottom 
  20. and a regular workbench window above.  I did this because I disliked the 
  21. interlaced screen for text input and display.  Because of this hybrid
  22. nature  the screen handling is a little strange.  Don't use the left mouse
  23. button when the pointer is in the bottom screen.  Use the right mouse
  24. button for  zooming, indicating a point in an image, and to resize an ROI.
  25. Some mouse  accelerators (like dmouse) don't work well with CT.
  26.  
  27. Getting Started:
  28.     Execute the file viewimages to see the images on this disk.  This file
  29. executes the CT program with a special command line which gives a crude
  30. slideshow.  When it finishes it will remain in the CT program.  If you want
  31. to exit the slideshow early type q.  To pause the slideshow type p.  To exit
  32. the program completely click on the close gadget.  There should be an icon
  33. available for workbench execution of viewimages using iconx.
  34.     The program CT must be started from the CLI (or using a CLI script plus
  35. the iconx command). If it is unable to get  enough memory to function it
  36. will say so then die.  You can specify the  number of image buffers to try
  37. to open on the command line (example: ct b2). If it can't open that many it
  38. will tell you how many it could open.  The  default number of buffers is 5.
  39.  The program is a memory hog, but a 512k  system can get 2 buffers if you
  40. type control-d right at startup.
  41.     The command line can also be used to load and display a file.  Use the
  42. flag f followed by the file name (example: ct b2 fdf1:ct/brain5.img).
  43.     The program has a very brief help message which is displayed when you
  44. type ?.  All commands to the program start with a single letter, are followed
  45. by 0 or more integers which select image buffers to be used by the command,
  46. and are terminated by a return.  Upper case does not equal lower case.  The 
  47. command h will toggle a flag which makes the commands explain themselves
  48. a bit more fully.
  49.  
  50. For example (I do not show the return needed after each line.  Some
  51. disks may not have a subdirectory CT.): 
  52.  
  53. First get into the CT directory. Type:                 cd df1:ct
  54. To start the program type:                             ct
  55. To read in an image into buffer 0 type:                R 0 
  56. then when it asks for the filename reply:              biopsy.img
  57. (or other image file name.) The image will
  58. automatically be displayed on the left.
  59. To change the scaling type:                            s 400 0
  60. To display the buffer on the right side
  61. with the new scaling type:                             D 0
  62. To zoom in on the display position the cursor over
  63. the desired point then hit the right mouse button.
  64. To exit the program type:                              q 
  65.  
  66. Description of image files on this disk:
  67.     See the .doc files.
  68.  
  69. Currently I have 5 disks worth of images available:
  70.  
  71. CT    : The images sent with the original release: Skull, brain, heart,
  72.         spine, abdomen.  I have updated the heart image and added a montage
  73.         of heart images showing a heart beat.        
  74. CT_IM1: A set of misc. images: Brain scan showing shunt, biopsy scan,
  75.         brain flow scans, liver flow scans, several 3D reconstructed spines.
  76. KIDNEY: A set of 9 contiguous slices from an abdomen study.  Shows abdominal
  77.         anatomy nicely.
  78. BHEAD:  A complete brain study (14 scans) of a 5 mo old child.
  79. CT_IM2: A scan of some gallstones, a scan of a severe case of pulmonary
  80.         fibrosis, and 16 scans from a unique study of a child with a
  81.         thoracic kidney.
  82.  
  83.    To get these images send me blank disks and a return envelope.
  84.  
  85. Image format:
  86.     I want to encourage people to use CT on other images.  Here is a 
  87. description of the format.  If you have access to medical or other images
  88. that CT could display please contact me.
  89.     The original format was very simple: a 256x256 array of 16 bit integers
  90. in a file 131072 bytes long.  The new version supports this old format and
  91. a new one which allows me to save on disk space:
  92. 1.  The first five words of the file are a header:
  93.     xdim,ydim,defwin,deflev,pack.
  94. 2.  The image data follows row by row.  If pack equals 0 to 8 the image data
  95.     is in one byte per pixel.  If pack equals 9 to 16 the image data is in
  96.     one word per pixel.  If pack equals 17 each two pixels of image data
  97.     are packed into 3 bytes.  First two bytes hold lower 8 bits of the two
  98.     pixels.  Next byte holds next 4 bits of each pixel.  The header
  99.     variable xdim refers to the number of pixels in the image, not the
  100.     number of bytes in a row.  
  101. 3.  The file read routine will set the display scale to defwin and deflev.
  102.  
  103. Once in memory CT assumes the gray level data is in the low 11 bits of 
  104. each word.  Thus gray levels can vary from 0 to 2047.  The program maps the 
  105. gray levels into a CT number scale that ranges from -1000 to +1047.  It is 
  106. this CT scale that is used by the s command to set the display scaling.
  107.  
  108. Image scaling and display:
  109.     Although the images have 11 bits of gray level information the display
  110. has only 4 bits (16 gray levels).  You specify how to map the 11 bits into
  111. 4 bits by using the s command.  The command has two parameters: window and
  112. level.  The window can be any integer from 1 to 2048, the level can vary
  113. from -1000 to 1047.  The window specifies the size of the CT number range
  114. which gets mapped to the 16 display gray levels.  The level specifies the
  115. center of the range.   The defaults are window = 2048, level = 0.  These
  116. are fine for looking at the boney part of a skull but a more narrow window
  117. is needed to see detail in brain or body tissue.  A window of 100 would be
  118. more appropriate for the brain images.  The smaller the window the higher
  119. the contrast.  A window of 1 gives a black and white display with all
  120. CT values less than or equal the level becomming black and values greater
  121. becomming white.
  122.     You can display the image in one of two places.  The d command displays
  123. on the left side, the D command displays on the right side.  Both commands
  124. need you to specify the image buffer to be displayed.  If you want to see
  125. a portion of the display in greater detail there is a zoom command.  Position
  126. the pointer over the area to be zoomed and then either click the right mouse
  127. button or enter z or Z.
  128.  
  129. Other functions:
  130.     I've included a variety of image processing functions.  They often
  131. produce very interesting images.  The v functions are convolutions:
  132. averaging, laplacian, unsharp masking.  The e functions are edge detection
  133. functions: absolute value of the gradient, value of the gradient in various
  134. directions.  You may have to play with the window and level values to
  135. display these images properly.  To find out what the image values are in
  136. a region of interest use the n function.  Type n <buffer number> <ret> and
  137. place the pointer over the region of interest in the left display area.
  138. The program will tell you the pointer position and image value at that
  139. position.  If you type return you get the values in a neighborhood of
  140. the point.  Use the ROI command (i or I) to get information on a larger
  141. region.  To display the region with maximum contrast choose a window
  142. the same size as the maximum difference of CT values in the region and 
  143. choose a level equal to the median CT value in the region.
  144.  
  145.  
  146.                  Description of commands.
  147.  
  148. ?           Print help message.  Shows number of buffers available and their
  149.             numbering.
  150.  
  151. h           Toggle help flag.  When this flag is on the commands will explain
  152.             themselves more fully.
  153.  
  154. r <buf>     Read image from file into buffer.  Will ask for file name.
  155. R <buf>     Use R to automatically display the image on left.
  156.  
  157. w <buf>     Write buffer to file.
  158.  
  159. s <win> <lev>  Set display scaling. Use S to automatically display the last
  160. S <win> <lev>  displayed buffer with the new scaling.
  161.  
  162. d <buf>     Display buffer on left.  Use D to display on right.  Uses the
  163. D <buf>     current display scale.
  164.  
  165. z           Zoom in on display.  Same as clicking right mouse button.  Uses
  166. Z           the upper zoom area. Use Z to zoom to the lower zoom area.
  167.  
  168. m <buf1> <buf2>  Move buf1 to buf2.
  169.  
  170. c <color>   Change the color table.  Table 0 is the default.  Table 1 gives
  171.             negative images.  Table 3 gives pseudo colors ranging from 0=blue
  172.             to 15=red.  Will ask if you want to clear the display.
  173.  
  174. n <buf>     Look at values of image at a point.  Until you type return it will
  175.             display the x,y position of the pointer and the image CT number
  176.             at that point.  Use N to skip this and just type out the CT 
  177.             numbers in a neighborhood of the pointer.
  178.  
  179. i <buf>     Computes mean and standard deviation of an elliptical region of
  180. I <buf>     interest (ROI).  Use I for a rectangular ROI.  Use the right mouse
  181.             button to resize the ROI.  Type q to exit this routine.  Type
  182.             h to display a histogram of the pixels in the ROI.  When in 
  183.             histogram mode you can use the pointer to find out the number of
  184.             points at a CT number - just move the pointer to that number
  185.             along the x axis of the histogram.  Use the right mouse button to
  186.             select the first and last points for a zoomed plot. 
  187.  
  188. b           Toggle screen to back.  Moving the screen to the back can speed
  189.             up the computations a little.  Sometimes a requester can move the
  190.             screen to back.  Type b twice to get it back to the front.
  191.  
  192. t <buf>     Generate test patterns. 
  193.  
  194. k <buf>     Vary the window size while keeping the level constant.  Displays
  195. K <buf>     the buffer with each new window size on the left (right for K)
  196.             until you type a key.  Useful to see effect of changing the
  197.             window.
  198.  
  199. l <buf>     Same as above but vary the level and keep the window constant.
  200. L <buf>   
  201.  
  202. a <buf1> <buf2> <buf3>  Do arithmatic on buffers. The sources are buf1 and
  203.                         buf2, the destination is buf3.  Buf1 can equal buf2
  204.                         can equal buf3.
  205.                  You can choose:
  206.                  +: buf3[i] = (buf1[i] + buf2[i])/ 2
  207.                  -: buf3[i] = (buf1[i] - buf2[i] + 1000)
  208.                  &: buf3[i] = buf1[i] & buf2[i]  (and)               
  209.                  |: buf3[i] = buf1[i] | buf2[i]  (or)             
  210.                  ^: buf3[i] = buf1[i] ^ buf2[i]  (exclusive or)             
  211.                  a: buf3[i] = (scale * (buf1[i] + buf2[i]) + offset)/ divsor
  212.  
  213. v <buf1> <buf2> Convolutions.  You must have buf1 != buf2.
  214.                  You can choose:
  215.                  a: average of 9 neighbors.  kernel = (1,1,1;1,1,1;1,1,1)/9.
  216.                  g: gaussian average.  kernel = (1,2,1;2,4,2;1,2,1)/16.
  217.                  v: vertical average.  kernel = (0,1,0;0,2,0;0,1,0)/4.
  218.                  h: horizontal average. kernel = (0,0,0;1,2,1;0,0,0)/4.
  219.                  l: laplacian. kernel = (-1,-1,-1;-1,8,-1;-1,-1,-1) + 1000.
  220.                  u: unsharp mask. kernel = (-1,-1,-1;-1,24,-1;-1,-1,-1)/16.
  221.                  f: a special adaptive filter.  Larger threshold gives more
  222.                     smoothing.
  223.  
  224. e <buf1> <buf2> Edge functions.  You must have buf1 != buf2.
  225.                  You can choose:
  226.                  a: absolute value of gradient. (use s 400 -800 to display)
  227.                  v: gradient in vertical direction. (use s 400 0 to display)
  228.                  h: gradient in horizontal direction.           "
  229.                  d: gradient in diagonal direction.             "
  230.                  e: gradient in opposite diagonal direction.    "
  231.  
  232. f <buf1> <buf2> Functions of binary images.  You must have buf1 != buf2.
  233.                  A binary image is one in which the only values are 0 or 1.
  234.                  (In this case -1000 or 1047.)  
  235.                  You can choose:
  236.                  t:threshold - create a binary image from a gray scale image.
  237.                  ~:complement
  238.                  g:8-neighbor grow (dilation)
  239.                  G:4-neighbor grow (dilation)
  240.                  s:8-neighbor shrink (erosion)
  241.                  S:4-neighbor shrink (erosion)
  242.                  l:a special edge finding function used on laplacian images
  243.                  c:contour at level
  244.  
  245. x        Execute outside program.  Doesn't work.  I wanted to be able to
  246.          execute separately compiled programs using this command.  I pass
  247.          the screen pointer and the pointers to the buffers to the new
  248.          program as hex strings via the argv array.  This works fine as
  249.          long as the program doesn't try to do graphics to the screen.
  250.          Then it crashes the system.  Must be blitter conflicts.  Any help
  251.          on this would be appreciated.
  252.  
  253.  
  254.