home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD1.img
/
d2xx
/
d235
/
ct
/
ct.readme
< prev
next >
Wrap
Text File
|
1989-08-06
|
13KB
|
254 lines
CT IMAGE PROCESSING PROGRAM DOCUMENTATION.
Version 2.2, August 2,1989.
The program CT is copyright 1989 by Jon Harman. It is freely
distributable as long as this documentation is included. I can be
contacted at:
Jon Harman
Imatron
389 Oyster Point Blvd.
S San Francisco, CA 94080
(415) 583-9964
I wrote this program as a tool at work to help me test out ideas.
Because I only intended it for my own use it has a very rudimentary user
interface. For this I apologize. I hope this documentation can ease some
of the difficulties. The user interface is a hard problem because CT is
something of a hybrid. It has a high res interlaced screen at the bottom
and a regular workbench window above. I did this because I disliked the
interlaced screen for text input and display. Because of this hybrid
nature the screen handling is a little strange. Don't use the left mouse
button when the pointer is in the bottom screen. Use the right mouse
button for zooming, indicating a point in an image, and to resize an ROI.
Some mouse accelerators (like dmouse) don't work well with CT.
Getting Started:
Execute the file viewimages to see the images on this disk. This file
executes the CT program with a special command line which gives a crude
slideshow. When it finishes it will remain in the CT program. If you want
to exit the slideshow early type q. To pause the slideshow type p. To exit
the program completely click on the close gadget. There should be an icon
available for workbench execution of viewimages using iconx.
The program CT must be started from the CLI (or using a CLI script plus
the iconx command). If it is unable to get enough memory to function it
will say so then die. You can specify the number of image buffers to try
to open on the command line (example: ct b2). If it can't open that many it
will tell you how many it could open. The default number of buffers is 5.
The program is a memory hog, but a 512k system can get 2 buffers if you
type control-d right at startup.
The command line can also be used to load and display a file. Use the
flag f followed by the file name (example: ct b2 fdf1:ct/brain5.img).
The program has a very brief help message which is displayed when you
type ?. All commands to the program start with a single letter, are followed
by 0 or more integers which select image buffers to be used by the command,
and are terminated by a return. Upper case does not equal lower case. The
command h will toggle a flag which makes the commands explain themselves
a bit more fully.
For example (I do not show the return needed after each line. Some
disks may not have a subdirectory CT.):
First get into the CT directory. Type: cd df1:ct
To start the program type: ct
To read in an image into buffer 0 type: R 0
then when it asks for the filename reply: biopsy.img
(or other image file name.) The image will
automatically be displayed on the left.
To change the scaling type: s 400 0
To display the buffer on the right side
with the new scaling type: D 0
To zoom in on the display position the cursor over
the desired point then hit the right mouse button.
To exit the program type: q
Description of image files on this disk:
See the .doc files.
Currently I have 5 disks worth of images available:
CT : The images sent with the original release: Skull, brain, heart,
spine, abdomen. I have updated the heart image and added a montage
of heart images showing a heart beat.
CT_IM1: A set of misc. images: Brain scan showing shunt, biopsy scan,
brain flow scans, liver flow scans, several 3D reconstructed spines.
KIDNEY: A set of 9 contiguous slices from an abdomen study. Shows abdominal
anatomy nicely.
BHEAD: A complete brain study (14 scans) of a 5 mo old child.
CT_IM2: A scan of some gallstones, a scan of a severe case of pulmonary
fibrosis, and 16 scans from a unique study of a child with a
thoracic kidney.
To get these images send me blank disks and a return envelope.
Image format:
I want to encourage people to use CT on other images. Here is a
description of the format. If you have access to medical or other images
that CT could display please contact me.
The original format was very simple: a 256x256 array of 16 bit integers
in a file 131072 bytes long. The new version supports this old format and
a new one which allows me to save on disk space:
1. The first five words of the file are a header:
xdim,ydim,defwin,deflev,pack.
2. The image data follows row by row. If pack equals 0 to 8 the image data
is in one byte per pixel. If pack equals 9 to 16 the image data is in
one word per pixel. If pack equals 17 each two pixels of image data
are packed into 3 bytes. First two bytes hold lower 8 bits of the two
pixels. Next byte holds next 4 bits of each pixel. The header
variable xdim refers to the number of pixels in the image, not the
number of bytes in a row.
3. The file read routine will set the display scale to defwin and deflev.
Once in memory CT assumes the gray level data is in the low 11 bits of
each word. Thus gray levels can vary from 0 to 2047. The program maps the
gray levels into a CT number scale that ranges from -1000 to +1047. It is
this CT scale that is used by the s command to set the display scaling.
Image scaling and display:
Although the images have 11 bits of gray level information the display
has only 4 bits (16 gray levels). You specify how to map the 11 bits into
4 bits by using the s command. The command has two parameters: window and
level. The window can be any integer from 1 to 2048, the level can vary
from -1000 to 1047. The window specifies the size of the CT number range
which gets mapped to the 16 display gray levels. The level specifies the
center of the range. The defaults are window = 2048, level = 0. These
are fine for looking at the boney part of a skull but a more narrow window
is needed to see detail in brain or body tissue. A window of 100 would be
more appropriate for the brain images. The smaller the window the higher
the contrast. A window of 1 gives a black and white display with all
CT values less than or equal the level becomming black and values greater
becomming white.
You can display the image in one of two places. The d command displays
on the left side, the D command displays on the right side. Both commands
need you to specify the image buffer to be displayed. If you want to see
a portion of the display in greater detail there is a zoom command. Position
the pointer over the area to be zoomed and then either click the right mouse
button or enter z or Z.
Other functions:
I've included a variety of image processing functions. They often
produce very interesting images. The v functions are convolutions:
averaging, laplacian, unsharp masking. The e functions are edge detection
functions: absolute value of the gradient, value of the gradient in various
directions. You may have to play with the window and level values to
display these images properly. To find out what the image values are in
a region of interest use the n function. Type n <buffer number> <ret> and
place the pointer over the region of interest in the left display area.
The program will tell you the pointer position and image value at that
position. If you type return you get the values in a neighborhood of
the point. Use the ROI command (i or I) to get information on a larger
region. To display the region with maximum contrast choose a window
the same size as the maximum difference of CT values in the region and
choose a level equal to the median CT value in the region.
Description of commands.
? Print help message. Shows number of buffers available and their
numbering.
h Toggle help flag. When this flag is on the commands will explain
themselves more fully.
r <buf> Read image from file into buffer. Will ask for file name.
R <buf> Use R to automatically display the image on left.
w <buf> Write buffer to file.
s <win> <lev> Set display scaling. Use S to automatically display the last
S <win> <lev> displayed buffer with the new scaling.
d <buf> Display buffer on left. Use D to display on right. Uses the
D <buf> current display scale.
z Zoom in on display. Same as clicking right mouse button. Uses
Z the upper zoom area. Use Z to zoom to the lower zoom area.
m <buf1> <buf2> Move buf1 to buf2.
c <color> Change the color table. Table 0 is the default. Table 1 gives
negative images. Table 3 gives pseudo colors ranging from 0=blue
to 15=red. Will ask if you want to clear the display.
n <buf> Look at values of image at a point. Until you type return it will
display the x,y position of the pointer and the image CT number
at that point. Use N to skip this and just type out the CT
numbers in a neighborhood of the pointer.
i <buf> Computes mean and standard deviation of an elliptical region of
I <buf> interest (ROI). Use I for a rectangular ROI. Use the right mouse
button to resize the ROI. Type q to exit this routine. Type
h to display a histogram of the pixels in the ROI. When in
histogram mode you can use the pointer to find out the number of
points at a CT number - just move the pointer to that number
along the x axis of the histogram. Use the right mouse button to
select the first and last points for a zoomed plot.
b Toggle screen to back. Moving the screen to the back can speed
up the computations a little. Sometimes a requester can move the
screen to back. Type b twice to get it back to the front.
t <buf> Generate test patterns.
k <buf> Vary the window size while keeping the level constant. Displays
K <buf> the buffer with each new window size on the left (right for K)
until you type a key. Useful to see effect of changing the
window.
l <buf> Same as above but vary the level and keep the window constant.
L <buf>
a <buf1> <buf2> <buf3> Do arithmatic on buffers. The sources are buf1 and
buf2, the destination is buf3. Buf1 can equal buf2
can equal buf3.
You can choose:
+: buf3[i] = (buf1[i] + buf2[i])/ 2
-: buf3[i] = (buf1[i] - buf2[i] + 1000)
&: buf3[i] = buf1[i] & buf2[i] (and)
|: buf3[i] = buf1[i] | buf2[i] (or)
^: buf3[i] = buf1[i] ^ buf2[i] (exclusive or)
a: buf3[i] = (scale * (buf1[i] + buf2[i]) + offset)/ divsor
v <buf1> <buf2> Convolutions. You must have buf1 != buf2.
You can choose:
a: average of 9 neighbors. kernel = (1,1,1;1,1,1;1,1,1)/9.
g: gaussian average. kernel = (1,2,1;2,4,2;1,2,1)/16.
v: vertical average. kernel = (0,1,0;0,2,0;0,1,0)/4.
h: horizontal average. kernel = (0,0,0;1,2,1;0,0,0)/4.
l: laplacian. kernel = (-1,-1,-1;-1,8,-1;-1,-1,-1) + 1000.
u: unsharp mask. kernel = (-1,-1,-1;-1,24,-1;-1,-1,-1)/16.
f: a special adaptive filter. Larger threshold gives more
smoothing.
e <buf1> <buf2> Edge functions. You must have buf1 != buf2.
You can choose:
a: absolute value of gradient. (use s 400 -800 to display)
v: gradient in vertical direction. (use s 400 0 to display)
h: gradient in horizontal direction. "
d: gradient in diagonal direction. "
e: gradient in opposite diagonal direction. "
f <buf1> <buf2> Functions of binary images. You must have buf1 != buf2.
A binary image is one in which the only values are 0 or 1.
(In this case -1000 or 1047.)
You can choose:
t:threshold - create a binary image from a gray scale image.
~:complement
g:8-neighbor grow (dilation)
G:4-neighbor grow (dilation)
s:8-neighbor shrink (erosion)
S:4-neighbor shrink (erosion)
l:a special edge finding function used on laplacian images
c:contour at level
x Execute outside program. Doesn't work. I wanted to be able to
execute separately compiled programs using this command. I pass
the screen pointer and the pointers to the buffers to the new
program as hex strings via the argv array. This works fine as
long as the program doesn't try to do graphics to the screen.
Then it crashes the system. Must be blitter conflicts. Any help
on this would be appreciated.