Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-04 - decus/20-0110/gtdisp.sai
There are 2 other files named gtdisp.sai in the archive. Click here to see a list.
Entry;
COMMENT
.SEC(GTDISP.SAI - gray scale display package for GT40)
.index(GTDISP.SAI - gray scale display package for GT40)
.;
Begin "GTDISP.SAI[50,555]"

"

			Bruce Shapiro
                     Image Processing Unit
                   National Cancer Institute
                 National Institutes of Health
                     Building 36 Room 4D28
                 Bethesda, Maryland 20014 USA

                      Phone 301-496-2394

Revised Oct 12, 1976 - Lemkin, added gamma correction
Revised Aug 6, 1976 - Lemkin, fix contrast stretching
Revised May 26,, 1976, 1976 - Lemkin change over INTERNALS
Revised April 13, 1976, 1976 - Lemkin and Shapiro - OMNI==>LCS
Revised March 19, 1976 - Lemkin and Shapiro - removed DINI, DGET

	This procedure will display a RTPP grey scale image  on
the  GT-40  graphics  CRT.   The  image  is  linearly scaled to
coincide with the 8 intensity levels that  are  permitted  with
the  GT-40. The pixels are displayed by run length encoding the
scaled grey levels and displaying the pixels as vectors of  the
specified  length and grey scale. The use of vectors instead of
dots decreases the length of a GT-40 display file which thereby
reduces  flicker and  permits the display of larger images. The
size of the image is a function of the  number  of  of  vectors
required.  It  should  be  noted  that the background intensity
level (0) is not displayed.  This saves display file space  and
speeds up image regeneration.

"

Require "DEFINE.REQ" Source!file;
Require "PRCMAX.REQ" Source!file;
Require "PRCINV.REQ" Source!file;
Require "Sys:Disprm.sai" Source!file;
Define Spread="2";


Internal Procedure GTDISP(String Title;
		Real Xp,Yp;
		Integer array Pict;
		Integer Nrows, Ncolumns;
		Integer dmin, dmax;
		Real Scaling;
		Integer Npict);
Begin "GT40"
Integer
	Veccount,
	Cvalue,
	Rvalue,
	Grayscale,
	rr,
	cc,
	r,
	c;
Real
	Previ,
	Scalevalue;




"Initialize some things"
Veccount_0;

Dwind(0,767,0,767);

"Open the picture"
DOPEN(Npict);


"Scan the picture"
For r_0 step 1 until Nrows-1 do
Begin "Outer loop"

	"Set raster to left side"
	DMOVE(Spread*(xp),767-Spread*(yp+r));

	"Extract real grey scale and scale to 3 bits.
	 Save it so it may be used as a trailing value"
"	Contrast stretch the image"
	grayscale_((dmin Max pict[r,0]) Min dmax);
	If scaling=0
		Then
		grayscale_(255/(dmax-dmin))*(grayscale-dmin)
		Else
		grayscale_255*scaling*grayscale/(dmax-dmin);
	Previ_((Grayscale Land '340) lsh -5)/7.;

	For c_0 step 1 until Ncolumns-1 do
	Begin "Fetch"
		"Get the real gray values"
"	Contrast stretch the image"
	grayscale_((dmin Max pict[r,c]) Min dmax);
	If scaling=0
		Then
		grayscale_(255/(dmax-dmin))*(grayscale-dmin)
		Else
		grayscale_255*scaling*grayscale/(dmax-dmin);

		"Scale the values between 0 and 1"
		Scalevalue_((Grayscale Land '340) lsh -5)/7.;

		"Check to see if at end of run"
		If Previ=Scalevalue then
		Begin "Same run"
			rr_r;
			cc_c;
		End "Same run"
		Else
		Begin "New run"

			"Set the intensity level of vector"
			DINT(Previ);

			"Check if background intensity"
			If Previ<.1 then
			Begin "Background"

				"set cursor and intensity"
				rr_r;
				cc_c;
				Previ_Scalevalue;
				"move beam"
				DMOVE(Spread*(xp+cc),
					767-Spread*(yp+rr));
			End "Background"
			Else
			Begin "Not background"
				DDRAW(Spread*(xp+cc),
					767-Spread*(yp+rr));
				Veccount_Veccount+1;
				Previ_Scalevalue;
				rr_r;
				cc_c;
			End "Not background";
		End "New run";
	End "Fetch";

	"Force ending of raster line"

	"Check if background"
	If Previ<.1 then continue
	Else
	Begin "End raster"
		DINT(Previ);
		Cvalue_Spread*(xp+(c-1));
		Rvalue_767-Spread*(yp+r);
		DDRAW(Cvalue,Rvalue);
		Veccount_Veccount+1;
	End "End raster";
End "Outer loop";
Outstr("# vectors= "&cvs(Veccount)&crlf);
"Post the picture"
DPOST(Npict);
DDONE;

End "GT40";
End "GTDISP.SAI[50,555]";