Trailing-Edge
-
PDP-10 Archives
-
decuslib10-06
-
43,50416/hlfton.sai
There are 2 other files named hlfton.sai in the archive. Click here to see a list.
entry;
COMMENT
.SEC(HLFTON.SAI - gray scale display package)
.INDEX(HLFTON.SAI - gray scale display package)
.;
Begin "HLFTON.SAI"
comment
Richard Gordon
Image Processing Unit
National Cancer Institute
National Institutes of Health
Building 36 Room 4D28
Bethesda, Maryland 20014 USA
phone 301-496-2394
Revised Nov 14, 1976 - add Number mode
Revised Oct 12, 1976 - Lemkin, added Gamma correction to ASR33
Revised Aug 6, 1976 - Lemkin, make display normalization compat.
all displays.
Revised May 26, 1976 -Lemkin deleted INSPOOL and BOUND.REQ, reversed
display so get better contrast
Revised May 20, 1976 -Lemkin added Q to quit display
Revised April 27, 1976 -Lemkin and Shapiro x0,yo==>xlcs,ylcs and ASR33
Revised March 22, 1976 -Gordon, call to CROSSHAIRS put in
Revised Jan 5, 1976 - Peter Lemkin
Revised January 15, 1976, R. Gordon, errors in error msgs
Revised Feb 1, 1976 - Peter Lemkin added ASR33 print
Revised Feb 6, 1976 - Peter Lemkin fixed ASR33 rows/columns mixup
Revised Feb 9, 1976 - Lemkin, changed terminal names
Revised March 12, 1976- density reversed for compatibility with
the Dicomed -Gordon
Revised March 16, 1976- Shapiro added GT40 intensity level
display capability
Introduction
------------
Procedure for displaying standard RTPP DDTG formated images as
gray scale windows on the GT40, Tektronix 4012 or 4023 graphics
terminals, or an ASR33 like terminal.;
Require "DEFINE.REQ" source!file;
Require "SYS:DISPRM.SAI" Source!file;
Require "LOWER.REQ" Source!file;
Require "TK4012.REQ" Source!file;
Require "TK4023.REQ" Source!file;
Require "GTDISP.REQ" Source!file;
Require "PRCMAX.REQ" Source!file;
Require "PRCINV.REQ" Source!file;
Require "PPAK.REQ" Source!file;
Require "CROSSH.REQ" source!file;
Internal Procedure HLFTON( Integer Array image;
Integer first!row,last!row,first!column,
last!column,sampling;
String title;
Real xlcs,ylcs;
Integer dmin,dmax;
Real scaling;
Integer npict;
Reference Integer row!cross,
column!cross;
String terminal);
Begin "Display pix"
Integer
nrows,
ncolumns,
pict!row,
pict!column,
sampled!row,
sampled!column,
pictval,
row,
column,
character,
last!sampled!column,
last!sampled!row;
String subtitle;
External Integer
crossrow,
crosscolumn;
Real Array
xy[1:2];
comment [HT.1] Set subtitle. Check the picture sampling
limits;
subtitle_ "(" & cvs(first!row) & ":" & cvs(last!row)
&","&cvs(first!column)&":"&cvs(last!column) &
")/" & cvs(sampling);
ncolumns_(last!column-first!column+1)/abs(sampling);
nrows_(last!row-first!row+1)/abs(sampling);
If nrows leq 0 or ncolumns leq 0
Then
Begin "error"
outstr("No points in picture: " & title & crlf);
return;
End "error";
If sampling=0
Then
Begin "error"
outstr("Error in HLFTON: sampling=0" & crlf);
return;
End "error";
comment [HT.2] sample the image into array 'PICT'.;
Begin "get pictures"
Integer Array pict[0:nrows-1,0:ncolumns-1];
comment For displays which glow, the density is flipped for
compatibility with DICOMED images.
Comment - May 20, 1976 - lemkin, reversed it so
that white is 255, black is 0;
Procedure DENSITY!FLIP;
Begin "DENSITY!FLIP"
For pict!row_0 step 1 until nrows-1 do
For pict!column_0 step 1 until ncolumns-1 do
pict[pict!row,pict!column]_trunc!max-pict[
pict!row,pict!column];
End "DENSITY!FLIP";
" [HT.2.0] compute a sampled image"
pict!row_0;
pict!column_0;
For sampled!row_first!row step abs(sampling) until last!row
-abs(sampling)+1 do
Begin "row"
for sampled!column_first!column step abs(sampling) until
last!column-abs(sampling)+1 do
Begin "column"
If sampling<0
Then pict[pict!row,pict!column]_FETCH2D(image,
sampled!row,sampled!column)
Else
Begin "averaging over square"
pictval_0;
for row_sampled!row step 1 until (
last!sampled!row_last!row MIN
sampled!row+abs(sampling)-1) do
Begin "summing"
For column_sampled!column step 1 until (
last!sampled!column_last!column
MIN sampled!column+abs(sampling)
-1) do
pictval_pictval+FETCH2D(image,row,
column);
End "summing";
pict[pict!row,pict!column]_pictval/((
last!sampled!column-sampled!column+1)*(
last!sampled!row-sampled!row+1));
End "averaging over square";
pict!column_pict!column+1;
End "column";
pict!row_pict!row+1;
pict!column_0;
End "row";
Comment [HT.2.0] If NUMBER mode then
print it on the TTY: as decimal numbers;
If sip2="N"
Then
Begin "Print numbers"
Integer p,q,qchar;
GETFORMAT(p,q);
SETFORMAT(3,0);
For pict!row_0 step 1 until (nrows-1) do
Begin "print line"
Outstr(CVS(pict!row)&":");
If (qchar_INCHRS)="q" or qchar="Q"
Then Return;
For pict!column_0 step 1 until (ncolumns-1) Min 18 do
Outstr(" "&CVS(pict[pict!row,pict!column]));
Outstr(crlf);
End "print line";
SETFORMAT(p,q);
Return;
End "Print numbers";
comment [HT.2.1] Display the image on Tektronix 4012.;
If equ(LOWER(terminal),LOWER("4012"))
Then
Begin "4012"
# -- not flipped 5/20/76 - DENSITY!FLIP;
setformat(0,7);
TK4012(title,subtitle,xlcs,ylcs,pict,
nrows,ncolumns,0 max (255 min dmin),
0 max (255 min dmax),scaling,"POS",
npict);
If row!cross neq 0
Then crosshairs;
comment TEMPORARY PATCH:;
row!cross_crossrow;
column!cross_crosscolumn;
End "4012";
comment [HT.2.2] Display the image on Tektronix 4023 if
selected.;
If equ(LOWER(terminal),LOWER("4023"))
Then
Begin "4023"
# -- not flipped 5/20/76 - DENSITY!FLIP;
TK4023(title,subtitle,xlcs,ylcs,pict,nrows,ncolumns,
0 max(255 min dmin),0 max (255 min dmax),
scaling,"POS", npict);
End "4023";
comment [HT.2.3] Display the image on ASR33 if selected.;
If equ(LOWER(terminal),LOWER("ASR33"))
Then
Begin "ASR33"
Integer i,j;
Preload!with
" ",
".",
",",
":",
"!",
"/",
"&",
"#";
Own String Array pp[0:7];
Integer avg, qchar;
comment display the image;
For i_ 0 Step 1 Until nrows-1 Do
Begin "Print Line"
For j_0 Step 1 Until (ncolumns-1) Min 72 Do
Begin "print pixel"
If (qchar_INCHRS)="q" or qchar="Q"
Then Return;
pictval_(dmin Max pict[i,j]) Min dmax;
" Contrast stretch it"
avg_If scaling=0
Then
(255/(dmax-dmin))*(pictval-dmin)
Else
255*scaling*(pictval/(dmax-dmin));
outstr(pp[(avg lsh -5) Land '7]);
End "print pixel";
outstr(crlf);
End "Print Line";
Outstr(Title & crlf & subtitle & crlf);
End "ASR33";
comment [HT 2.4] GT-40 display;
If Equ(LOWER(terminal),LOWER("GT40"))
then
Begin "GT40"
DENSITY!FLIP;
GTDISP(Title,xlcs,ylcs,Pict,Nrows,Ncolumns,
dmin,dmax,Scaling,Npict);
End "GT40";
End "get pictures";
End "Display pix";
End "HLFTON.SAI";