unit Globals;

{Global declarations for NIH Image program.}


interface


uses
		Types, QuickDraw, Controls, Menus, Dialogs, TextEdit, Palettes, Printing, Files, Components, QDOffscreen;

const
		Version = 162;

		UsingFPU = false; {If true, select 68881/68882 in Compile Options dialog box.}

		AppleMenu = 128;

		FileMenu = 129;
		NewItem = 1;
		OpenItem = 2;
		ImportItem = 3;
		CloseItem = 5;
		SaveItem = 6;
		SaveAsItem = 7;
		ExportItem = 8;
		RecordPreferencesItem = 10;
		RevertItem = 11;
		DuplicateItem = 12;
		GetInfoItem = 13;
		AcquireItem = 15;
		PlugInExportItem = 16;
		PageSetupItem = 18;
		PrintItem = 19;
		QuitItem = 21;

		AcquireMenu = 42; {Sub Menu}

		ExportMenu = 44; {Sub Menu}

		EditMenu = 130;
		UndoItem = 1;
		CutItem = 3;
		CopyItem = 4;
		PasteItem = 5;
		ClearItem = 6;
		FillItem = 8;
		InvertItem = 9;
		DrawBoundaryItem = 10;
		DrawScaleItem = 11;
		SelectAllItem = 13;
		DeselectItem = 14;
		ScaleAndRotateItem = 15;
		RotateLeftItem = 17;
		RotateRightItem = 18;
		FlipVerticalItem = 19;
		FlipHorizontalItem = 20;
		UnzoomItem = 22;
		ShowClipboardItem = 23;

		OptionsMenu = 131;
		GrayscaleItem = 1;
		ColorTablesItem = 2;
		LutOptionsItem = 3;
		PreferencesItem = 9;
		PlotOptionsItem = 10;
		ScaleToFitItem = 11;
		ThresholdItem = 12;
		SliceItem = 13;
		PropagateItem = 14;

		FontMenu = 32; {Sub Menu}

		SizeMenu = 33; {Sub Menu}

		StyleMenu = 34; {Sub Menu}
		LeftItem = 8;
		CenterItem = 9;
		RightItem = 10;
		NoBackgroundItem = 12;
		WithBackgroundItem = 13;

		ColorTablesMenu = 41; {Sub Menu}
		SystemPaletteItem = 1;
		Pseudo20Item = 2;
		Pseudo32Item = 3;
		RainbowItem = 4;
		Fire1Item = 5;
		Fire2Item = 6;
		IceItem = 7;
		GraysItem = 8;
		SpectrumItem = 9;

		PropagateMenu = 38;   {Sub Menu}
		LUTItem = 1;
		SpatialItem = 2;
		DensityItem = 3;
		AllItem = 4;

		ProcessMenu = 132;
		SmoothItem = 1;
		SharpenItem = 2;
		ShadowItem = 3;
		FindEdgesItem = 4;
		RankItem = 5;
		DitherItem = 6;
		ConvolveItem = 7;
		FilterItem = 8;
		BinaryItem = 10;
		ConstMathItem = 11;
		ImageMathItem = 12;
		fftItem =13;
		BackgroundItem = 14;
		ApplyItem = 15;
		EnhanceItem = 16;
		EqualizeItem = 17;
		FixColorsItem = 18;

		FilterMenu = 43; {Sub Menu}

		BinaryMenu = 35; {Sub Menu}
		MakeBinaryItem = 1;
		ErosionItem = 3;
		DilationItem = 4;
		OpeningItem = 5;
		ClosingItem = 6;
		SetCountItem = 7;
		IterationsItem = 8;
		OutlineItem = 10;
		SkeletonizeItem = 11;
		EDMItem = 13;
		UltimateItem =14;
		WatershedItem = 15;

		ArithmeticMenu = 37; {Sub Menu}
		AddItem = 1;
		SubtractItem = 2;
		MultiplyItem = 3;
		DivideItem = 4;
		AndItem2 = 5;
		OrItem2 = 6;
		XorItem2 = 7;
		LogItem = 8;

		BackgroundMenu = 40; {Sub Menu}
		HorizontalItem = 1;
		VerticalItem = 2;
		Sub2DItem = 3;
		RemoveStreaksItem = 4;
		FasterItem = 6;
		RadiusItem = 7;
		
		fftMenu = 45;  {Sub Menu}
		ForewardFFTItem = 1;
		InverseFFTItem = 2;
		RedisplayItem = 4;
		SwapItem = 5;
	
		AnalyzeMenu = 133;
		MeasureItem = 1;
		AnalyzeItem = 2;
		ShowItem = 3;
		HistogramItem = 4;
		PlotItem = 5;
		PlotSurfaceItem = 6;
		OptionsItem = 7;
		SetScaleItem = 9;
		CalibrateItem = 10;
		RedoItem = 11;
		DeleteItem = 12;
		ResetItem = 13;
		RestoreItem = 14;
		MarkItem = 15;

		SpecialMenu = 140;
		StartItem = 1;
		AverageItem = 2;
		SaveBlankFieldItem = 3;
		VideoControlItem = 4;
		PhotoModeItem = 5;
		LoadMacrosItem = 7;
		FirstMacroItem = 9;

		StacksMenu = 141;
		StackFromWindowsItem = 1;
		WindowsFromStackItem = 2;
		AddSliceItem = 3;
		DeleteSliceItem = 4;
		NextSliceItem = 5;
		PreviousSliceItem = 6;
		MakeMovieItem = 8;
		CaptureFramesItem = 9;
		AnimateItem = 10;
		AverageSlicesItem = 11;
		MakeMontageItem = 12;
		CaptureColorItem = 14;
		RGBToColorItem = 15;
		ColorToRGBItem = 16;
		RGBToHSVItem = 17;
		RegisterItem = 19;
		ProjectItem = 20;
		ResliceItem = 21;
		StackInfoItem = 22;

		WindowsMenu = 138;
		NextImageItem = 1;
		CascadeImagesItem = 2;
		TileImagesItem = 3;
		PasteControlItem = 4;
		SelectToolsItem = 6;
		SelectGrayMapItem = 7;
		SelectLutItem = 8;
		SelectInfoItem = 9;
		SelectHistogramItem = 10;
		SelectPlotItem = 11;
		SelectResultsItem = 12;

		UserMenu = 139;

		TransferModeMenu = 200;  {Popup Menu in Paste Control window}
		CopyModeItem = 1;
		AndItem = 2;
		OrItem = 3;
		XorItem = 4;
		ReplaceItem = 5;
		BlendItem = 6;

		LineToolMenu = 201;
		StraightItem = 1;
		SegmentedItem = 2;
		FreehandItem = 3;

		ImageMathOpsMenu = 202;
		ImageListMenu = 203;
		UnitsMenu = 204;

		InvertID = 1;
		HighLightID = 2;
		TriggerID = 3;
		SyncID = 4;
		FirstChannelID = 6;
		OffsetID = 12;
		GainID = 13;
		OffsetUpID = 14;
		OffsetDownID = 15;
		GainUpID = 16;
		GainDownID = 17;
		ResetID = 18;

		MinFree = 150000;
		HeaderSize = 512;
		TiffDirSize = 256;
		MaxLine = 4096;
		tleft = 36;
		ttop = 40;
		twidth = 44;
		tmiddle = 22;
		theight = 277;
		gmleft = 2;
		gmtop = 338;
		gmwidth = 78;
		gmheight = 118;
		gmRectLeft = 7;
		gmRectTop = 6;
		gmRectRight = 71;
		gmRectBottom = 70;
		gmSlideWidth = 68;
		gmSlideHeight = 7;
		gmSlide1Offset = 8;
		gmSlide2Offset = 19;
		gmIconWidth = 17;
		gmIconHeight = 14;
		gmIconOffset = 31;
		gmIcon1Left = 17;
		gmIcon2Left = 46;
		cleft = 2;
		ctop = 40;
		cwidth = 30;
		rwidth = 200;
		rheight = 225;
		hleft = 220;
		hwidth = 256;
		hheight = 120;
		pcwidth = 186;
		pcheight = 85;
		MaxPseudoColors = 32;
		MaxPseudoColorsLessOne = 31;
		PicKind = 88;
		HistoKind = 89;
		ProfilePlotKind = 90;
		LUTKind = 91;
		MapKind = 92;
		ToolKind = 93;
		InfoKind = 94;
		CalibrationPlotKind = 95;
		PasteControlKind = 96;
		ResultsKind = 97;
		TextKind = 98;
		IOErrorID = 400;
		AboutID = 256;
		VersItem = 2;
		MemItem = 3;
		StackSize = 40000;
		ToolFont = 249;      {Bits 7-14 of font resource ID(31884) }
		WindowsMenuItems = 13;       {Items in Windows menu before images - nTextWindows}
		WhiteIndex = 0;
		BlackIndex = 255;
		OvalSize = 15;
		LinesLeft = 13;
		LinesRight = 40;
		nLinetypes = 6;
		CheckMarkChar = 65;
		TxPlain = 1;
		TxBold = 2;
		TxItalic = 3;
		TxUnderLine = 4;
		TxOutLine = 5;
		TxShadow = 6;
		FileID8 = 'IPICIMAG';
		DefaultBufferSize = 307200; {Enough for 640x480 image}
		PickerCursorID = 111;
		LUTCursorID = 112;
		gmCursorID = 113;
		GrabberCursorID = 114;
		PencilCursorID = 115;
		CrossCursorID = 117;
		CrossCursorPlusID = 118;
		CrossCursorMinusID = 119;
		BucketCursorID = 120;
		GlassCursorPlusID = 121;
		GlassCursorMinusID = 122;
		WandCursorID = 123;
		WandPlusCursorID = 124;
		WandMinusCursorID = 125;
		TextCursorID = 126;
		EraserCursorID = 127;
		SprayCursorID = 128;
		BrushCursorID = 129;
		FirstAnimatedWatchID = 130;
		FingerCursorID = 137;
		AppleDefaultCLUT = 8;
		SpectrumCLUT = 200;
		KlutzID = 200;
		PixelPaintID = 999; {Used for PixelPaint and Canvas CLUTs}
		GhostWindow = $A84;
		GrayRgnGlobal = $9EE;
		MBarHeight = $BAA;
		MaxPics = 250;
		FirstExtraColorsEntry = 1;
		MaxExtraColors = 6;
		MaxExtraPlus2 = 8;
		ExtraColorsHeight = 10;
		MyMaxLong = 2000000000;
		MaxTextBufSize = 32700;
		MaxMaxRegions = 8000;
		MaxStandards = 20;
		BadReal = 808080.0;
		NoValue = -808080.0;
		TabSpacing = 12;
		MaxPolyVertices = 4000;
		pi = 3.1415926535898;
		InfoVStart = 11;
		InfoHStart = 4;
    {TIFF Constants}
		short = 3;
		long = 4;
		NewSubfileType = 254;
		ImageWidth = 256;
		ImageLength = 257;
		BitsPerSample = 258;
		Compression = 259;
		PhotoInterp = 262;
		StripOffsets = 273;
		SamplesPerPixelTag = 277;
		RowsPerStrip = 278;
		StripByteCount = 279;
		XResolution = 282;
		YResolution = 283;
		PlanarConfigTag = 284;
		ResolutionUnit = 296;
		ColorMapTag = 320;
		ImageHdrTag = -22222; {43314}
		TiffFillerSize = 58;
		RoiHandleSize = 5;
		CancelResetID = 3;
		npcItems = 7;
{Blend = 32;}
{Transparent = 36;}
		LeftArrow = 28;
		RightArrow = 29;
		UpArrow = 30;
		DownArrow = 31;
		hPicOffset = 8;
		vPicOffset = 16;
		FunctionKey = 16;

		MaxMacroSize = 20000;
		MaxMacroFileSize = 32767;
		MaxSymbols = 550;
		MaxMacroStackSize = 200;
		MaxMacros = 100;
		SymbolSize = 12;
		BlankSymbol = '            ';
		StackOverflow = 'Stack overflow';

		MaxPicSize = 16383;
		ScrollBarWidth = 15;
		PrefsName = 'Image Prefs';
		StraightChar = 97;
		SegmentedChar = 98;
		FreehandChar = 99;
		MaxSlices = 1000;
		HomeKey = 1;
		EndKey = 4;
		PageUp = 11;
		PageDown = 12;
		osEvt = 15;
		Pseudo20ID = 1001;
		Pseudo32ID = 1002;
		RainbowID = 1003;
		Fire1ID = 1004;
		Fire2ID = 1005;
		IceID = 1006;
		GraysID = 1007;
		MaxColor = 15000;
		MaxMaxCoordinates = 25000;
		DefaultDacLow = 60;
		DefaultDacHigh = 185;
		MaxTextWindows = 10;
		maxCoeff = 6;
		maxLabelLength = 9;
		maxTitle = 31;
		maxUnit = 11;
		maxUM = 15;
		maxImageSize = 1000000000; {pixels}
		

	type
		LineType = packed array[0..MaxLine] of Byte;
		LinePtr = ^LineType;
		rLineType = array[0..MaxLine] of real;
		rLinePtr = ^rLineType;
		RealLine = array[1..MaxLine] of real;
		ClutTable = packed array[0..255] of integer;
		ColorArray = packed array[0..MaxPseudoColorsLessOne] of byte;
		LutArray = packed array[0..255] of byte;
		PicType = (NewPicture, Normal, PictFile, Leftover, imported, FrameGrabberType, NullPicture, BlankField, TiffFile, FourBitTIFF, PicsFile);
		LUTModeType = (PseudoColor, OldAppleDefault, OldSpectrum, GrayScale, ColorLut, CustomGrayscale);
		ColorTableType = (CustomTable, AppleDefault, Pseudo20, Pseudo32, Rainbow, Fire1, Fire2, Ice, Grays, Spectrum);
		ExtraColorsArray = array[1..MaxExtraColors] of rgbColor;
		MyCSpecArray = array[0..255] of ColorSpec;
		CoefficientArray = array[1..maxCoeff] of extended;
		CurveFitType = (StraightLine, Poly2, Poly3, Poly4, Poly5, ExpoFit, PowerFit, LogFit, RodbardFit, SpareFit1, Uncalibrated, UncalibratedOD);
		UnitsType = (Nanometers, Micrometers, Millimeters, Centimeters, Meters, Kilometers, Inches, Feet, Miles, Pixels, OtherUnits);
		UnitType = string[maxUnit];
		FileDepthType = (EightBits, SixteenBitsUnsigned, SixteenBitsSigned, ThirtyTwoBits);
		RoiTypeType = (PolygonRoi, RectRoi, OvalRoi, LineRoi, FreeLineRoi, SegLineRoi, NoRoi, FreehandRoi, TracedRoi);
		StackTypeType = (VolumeStack, RGBStack, MovieStack, HSVStack);

		FakeDouble = array[1..2] of LongInt;
		
		PicHeader = record
				FileID: packed array[1..8] of char; {8  8}
				hnlines: integer;                    {2  10}
				hPixelsPerLine: integer;        {2  12}
				hversion: integer;                   {2  14}
				hOldLutMode: LutModeType;    {2  16}
				hOldnColors: integer;                {2  18}
				hr, hg, hb: ColorArray;              {96 114}
				hOldColorStart: integer;             {2  116}
				hColorWidth: integer;                 {2  118}
				hExtraColors: ExtraColorsArray;   {36 154}
				hnExtraColors: integer;              {2  156}
				hForegroundIndex: integer;     {2  158}
				hBackgroundIndex: integer;      {2  160}
				hXScale: FakeDouble;            {8  168}
				Unused2: integer;                    {2  170}
				Unused3: integer;                    {2  172}
				hUnitsID: integer;                   {2  174}
				hp1x, hp1y, hp2x, hp2y: integer;     {8  182}
				hfit: CurveFitType;                  {2  184}
				hnCoefficients: integer;           {2  186}
				hCoeff: array[1..maxCoeff] of FakeDouble; {48 234}
				hUM: string[maxUM];              {16 250}
				UnusedBoolean: boolean;          {1  251}
				hBinaryPic: boolean;               {1  252}
				hSliceStart: integer;           {2 254}
				hSliceEnd: integer;              {2  256}
				hScaleMagnification: real;   {4  260}
				hNSlices: integer;             {2 262}
				hSliceSpacing: real;          {4 266}
				hCurrentSlice: integer;        {2 268}
				hFrameInterval: real;          {4  272}
				hPixelAspectRatio: real;       {4  276}
				hColorStart: integer;             {2  278}
				hColorEnd: integer;               {2  280}
				hnColors: integer;                  {2  282}
				hFill1, hFill2: RGBColor;    {12  294}
				hTable: ColorTableType;       {1  295}
				hLutMode: LutModeType;      {1  296}
				hInvertedTable: boolean;      {1  297}
				hZeroClip: boolean;               {1  298}
				hXUnit: string[maxUnit];            {12 310}
				hStackType: StackTypeType;     {2  312}
				UnusedBytes: packed array[1..200] of byte;
			end;

		StackInfoRec = record
				nSlices: integer;
				CurrentSlice: integer;
				PicBaseH: array[1..MaxSlices] of handle;
				SliceSpacing: real; {Pixels}
				FrameInterval: real; {seconds}
				StackType: StackTypeType;
			end;
		StackInfoPtr = ^StackInfoRec;

		PaletteHeader = record
				pID: packed array[1..4] of char;  {4  4}
				pVersion: integer;                              {2  6}
				pnColors: integer;                              {2  8}
				pColorStart: integer;                         {2  10}
				pColorEnd: integer;                            {2  12}
				pFill1: rgbColor;                               {6  18}
				pFill2: rgbColor;                               {6  24}
				pUnused: array[1..4] of integer;     {8  32}
			end;

		RoiHeader = record
				rID: packed array[1..4] of char;  {4   4}
				rVersion: integer;                              {2   6}
				rRoiType: RoiTypeType;                    {2   8}
				rRoiRect: rect;                                   {8   16}
				rNCoordinates: integer;                     {2   18}
				rX1, rY1, rX2, rY2: real;                 {16 34}
				rLineWidth: integer;                          {2   36}
				rUnused: array[1..14] of integer;    {28 64}
			end;

		PicInfo = record
				iVersion:LongInt;
				nlines, PixelsPerLine: LongInt;
				ImageSize: LongInt;
				BytesPerRow: LongInt;
				PicBaseAddr: ptr;
				PicBaseHandle: handle;
				DataH: handle;
				StackInfo: StackInfoPtr;
				osPort: cGrafPtr;         {Offscreen Port}
				PicRect: rect;
				RoiRect: rect;
				roiRgn: rgnHandle;
				RoiType: RoiTypeType;
				RoiShowing: boolean;
				SrcRect: rect;
				wrect: rect;
				initwrect: rect;
				xScale, yScale, zScale: extended;
				PixelAspectRatio: extended;
				xUnit: UnitType;  {Someday there may be yUnit}
				Fit: CurveFitType;
				nCoefficients: integer;
				Coefficient: CoefficientArray;
				ZeroClip: boolean;
				UnitOfMeasure: string[maxUM];
				LX1, LY1, LX2, LY2, LAngle: extended;
				savewrect, SaveSrcRect: rect;
				SaveMagnification: extended;
				savehloc, savevloc: integer;  {Old window location in global coordinates}
				title: string[maxTitle];
				NewPic: boolean;
				Magnification: extended;
				vref: integer;
				PictureType: PicType;
				wptr: WindowPtr;
				PicNum, PidNum: integer;
				ScaleToFitWindow: boolean;
				Changes: boolean;
				RedLUT, GreenLUT, BlueLUT: LutArray;
				nColors: LongInt;
				ColorStart, ColorEnd, SaveColorStart, SaveColorEnd: LongInt;
				FillColor1, FillColor2, SaveFill1, SaveFill2: RGBColor;
				LUTMode: LUTModeType;
				ColorTable: ColorTableType;
				InvertedColorTable: boolean;
				cTable: MyCSpecArray;
				IdentityFunction: boolean;
				PixMapSize: LongInt;
				HeaderOffset, ImageDataOffset, ColorMapOffset: LongInt;
				UnusedBoolean, SpatiallyCalibrated: boolean;
				BinaryPic: boolean;
				WindowState: (NormalWindow, TiledSmall, TiledSmallScaled, TiledBig, TiledBigScaled);
				Revertable: boolean;
				Thresholding: boolean;
				DataType: FileDepthType;
				AbsoluteMin, AbsoluteMax, CurrentMin, CurrentMax: LongInt;
				LittleEndian, InvertedImage: boolean;
				fileVersion:integer;
			end;

		InfoPtr = ^PicInfo;
		ToolType = (MagnifyingGlass, SelectionTool, Grabber, OvalSelectionTool, Pencil, PolygonTool, Eraser, FreehandTool, Brush, LineTool, ruler, LUTTool, PaintBucket, TextTool, PlotTool, SprayCanTool, Wand, PickerTool, AngleTool, CrossHairTool);
		OpType = (InvertOp, PaintOp, FrameOp, EraseOp, PasteOp, AddOp, SubtractOp, MultiplyOp, DivideOp);
		ObjectType = (lineObj, oval, SelectionOval, Rectangle, SelectionRect, BrushObj);
		FilterType = (WeightedAvg, UnweightedAvg, fsharpen, SharpenMore, ShadowN, ShadowNE, ShadowE, ShadowSE, ShadowS, ShadowSW, ShadowW, ShadowNW, {}
			EdgeDetect, FindEdges, ReduceNoise, dither, erosion, dilation, OutlineFilter, skeletonize, MinRankFilter, MaxRankFilter);
		rhptr = ^RgnHandle;
		FlipRotateType = (RotateLeft, RotateRight, FlipVertical, FlipHorizontal);
		TextBackType = (NoBack, WithBack);
		HistogramType = array[0..255] of LongInt;
		str4 = packed array[1..4] of char;
		LookupTable = packed array[0..255] of Byte;
		TextBufType = packed array[1..MaxTextBufSize] of char;
		TextBufPtr = ^TextBufType;
		StandardsArray = array[1..MaxStandards] of extended;
		MeasurementTypes = (AreaM, MeanM, StdDevM, xyLocM, ModeM, LengthM, MajorAxisM, MinorAxisM, AngleM, IntDenM, MinMaxM, User1M, User2M);
		SetOfMeasurements = Set Of MeasurementTYpes;
		TiffHdr = record
				ByteOrder: packed array[1..2] of char;
				Version: integer;
				FirstIFDOffset: LongInt;
			end;
		TiffEntry = record
				TagField: integer;
				ftype: integer;
				length: LongInt;
				offset: LongInt;
			end;
		pcItemType = (pcPopupMenu, pcCheckBox, pcButton);
		WhatToImportType = (ImportTIFF, ImportMCID, ImportLUT, ImportText, ImportCustom, ImportDICOM);
		FateTable = array[0..255] of integer;
		SaveAsWhatType = (asTIFF, asPICT, asQuickTime, asPICS, AsPalette, AsOutline, AsRawData, SaveAsMCID);
		ExportAsWhatType = (AsRaw, asMCID, asText, AsLUT, asMeasurements, asPlotValues, asHistogramValues, asCoordinates);

		RealArray = array[0..MaxMaxRegions] of real;
		meanType = RealArray;
		sdType = RealArray;
		PixelCountType = array[0..MaxMaxRegions] of LongInt;
		AreaType = RealArray;
		modeType = RealArray;
		IntegratedDensityType = RealArray;
		idBackgroundType = RealArray;
		xcenterType = RealArray;
		ycenterType = RealArray;
		MajorAxisType = RealArray;
		MinorAxisType = RealArray;
		orientationType = RealArray;
		MinType = RealArray;
		MaxType = RealArray;
		plengthType = RealArray;
		User1Type = RealArray;
		User2Type = RealArray;

		meanPtr = ^meanType;
		sdPtr = ^sdType;
		PixelCountPtr = ^PixelCountType;
		AreaPtr = ^AreaType;
		modePtr = ^modeType;
		IntegratedDensityPtr = ^IntegratedDensityType;
		idBackgroundPtr = ^idBackgroundType;
		xcenterPtr = ^xcenterType;
		ycenterPtr = ^ycenterType;
		MajorAxisPtr = ^MajorAxisType;
		MinorAxisPtr = ^MinorAxisType;
		orientationPtr = ^orientationType;
		MinPtr = ^MinType;
		MaxPtr = ^MaxType;
		plengthPtr = ^plengthType;
		User1Ptr = ^User1Type;
		User2Ptr = ^User2Type;
		SyncModeType = (NormalSync, SeparateSync, SyncOnGreen);
		
{ppc-bug}
		TokenTypeX = (NullT, MacroT, NewLineT, beginT, endT, Identifier, UnknownIdentifier, DoneT, LeftParen,
			RightBracket, comma, colon, SemiColon, StringLiteral, NumericLiteral, VarT, IntegerT, RealT, BooleanT, CommandT,
			FunctionT, ArrayT, AssignOp, ForT, ToT, DoT, IfT, ThenT, ElseT, whileT, repeatT, untilT, Variable, PlusOp,
			MinusOp, MulOp, DivOp, eqOP, ltOp, gtOp, neOp, leOp, geOp, orOp, IntDivOp, modOp, andOp, NotOp, ProcedureT,
			ProcIdT, TrueT, FalseT, RightParen, LeftBracket, StringT, StringVariable,
			StringFunctionT, UserFunctionT, UserFuncIDT);
			
	CommandType = (InvertLUTC, UserCodeC, MoveWindowC, AutoThresholdC, SetExportC, SubtractBackgroundC,
			SetUser1C, SetUser2C, GetPlotDataC, RequiresC, SetOptionsC, GetSpacingC, SetSpacingC,
			PropagateLutC, PropagateDensityC, PropagateSpatialC, SetCountC, ShowMsgC, UpdateLutC, SetCounterC,
			SaveStateC, RestoreStateC, GetTimeC, SetScaleC, MakeLineC, PlotProfileC, ResliceC, CopyModeC,
			TriggerC, AverageFramesC, AddSliceC, DeleteSliceC, MakeStackC, GetSliceC, nSlicesC, SelectSliceC, ChooseSliceC,
			GetMouseC, SetMajorC, SetMinorC, TileC, UpdateResultsC, rCountC, ChangeC, ExportC, PicNumC,
			ScaleSelectionC, ScalingOptionsC, PutPixelC, ChoosePicC, WriteC, WritelnC,
			SetPrecisionC, SetParticleSizeC, AdjustC, IgnoreC,
			OutlineParticlesC, LabelC, IncludeC, AutoC, PlotXYZC, CalibratedC, cValueC, SameSizeC, GetColumnC, PutColumnC,
			GetRowC, PutRowC, ShowResultsC, SetWidthC, ScaleMathC, InvertYC, AndC, OrC, XorC, BlendC, ReplaceC, AddC, SubC,
			MulC, DivC, SetOptionC, GetResultsC, SetLabelsC, SetPlotScaleC, SetDimC, ColumnC, ChannelC, ShowPasteC, NullC,
			RotateRC, RotateLC, FlipVC, FlipHC, CopyC, SelectC, ClearC, FillC, InvertC, FrameC, PasteC, KillC, RestoreC, AnalyzeC,
			ConvolveC, NextC, MarkC, MeasureC, ThresholdC, ResetgmC, MakeBinC, DitherC, SmoothC, SharpenC, ShadowC,
			TraceC, ReduceC, SetSliceC, RedirectC, WaitC, ResetmC, UndoC, SetForeC, SetBackC, ScaleC, HistoC, EnhanceC,
			EqualizeC, ErodeC, DilateC, OutlineC, ThinC, AddConstC, MulConstC, RevertC, BeepC, NopC, MakeC, MakeOvalC,
			MoveC, InsetC, MoveToC, LineToC, DrawTextC, DrawNumC, SetFontC, SetFontSizeC, SetTextC, GetPicSizeC, PutMsgC,
			ExitC, GetRoiC, TruncC, RoundC, GetNumC, StartC, StopC, CaptureC, RandomC, MakeNewC, DrawScaleC, SetPaletteC,
			GetPixelC, ButtonC, oddC, absC, sqrtC, sinC, cosC, expC, lnC, arctanC, sqrC, OpenC, ImportC, SetImportC, SetMinMaxC,
			SetCustomC, nPicsC, SelectPicC, SetPicNameC, ApplyLutC, SetSizeC, SaveC, SaveAllC, SaveAsC, CopyResultsC, CloseC,
			DisposeC, DisposeAllC, DupC, GetInfoC, PrintC, GetLineC, nCoordinatesC, GetStringC,
			OpenSerialC, GetSerialC, PutSerialC, ChrC, OrdC, SetCursorC, TickCountC, ConcatC, SetVideoC, StringToNumC, AcquireC,
			UndoSizeC, CallFilterC, PhotoModeC, RGBToIndexedC, SurfacePlotC, SelectWindowC, NewTextWindowC, CaptureColorC,
			GetThresholdC, AverageSlicesC, BitAndC, BitOrC, PidNumC, SortPaletteC, ProjectC, WindowTitleC, ScaleConvolutionsC,
			ImageMathC, PasteLiveC, PidExistsC, PosC, DeleteC, LengthC, GetScaleC, AutoOutlineC, FilterC, SetSaveAsC,
			CalibrateC, CallExportC, KeyDownC, IndexedToRgbC, MakeMovieC, SetProjectionC, GetHistogramC, GetC, fftC,
			GetPathC, GetFileInfoC, SelectToolC, BinaryC);

		ArrayType = (HistogramA, rAreaA, rMeanA, rXA, rYA, rLengthA, rMajorA, rMinA, rMaxA, rUser1A, rUser2A, rMinorA,
			rAngleA, RedLutA, GreenLutA, BlueLutA, rStdDevA, BufferA, PlotDataA, xCoordinatesA, yCoordinatesA, ScionA);

		SymbolType = packed array[1..SymbolSize] of char;
		VarType = (IntVar, RealVar, BooleanVar, StringVar);
		SymTabRec = record
				Symbol: SymbolType;
				tType: TokenTypeX;
				cType: CommandType;
				loc: integer;
			end;
		str255P = ^str255;
		str255H = ^str255P;
		StackRec = record
				SymbolTableIndex: integer;
				Value: extended;
				vType: VarType;
				StringH: str255H;
			end;
		MacrosRec = record
				Macros: packed array[0..MaxMacroSize] of char;
				SymbolTable: array[1..MaxSymbols] of SymTabRec;
				stack: array[1..MaxMacroStackSize] of StackRec;
				aLine: LineType;
			end;
		MacrosPtr = ^MacrosRec;
		rsMethodType = (Bilinear, NearestNeighbor);
		TiffColorMapType = array[1..3] of array[0..255] of integer;
		StackIFDType = record
				nEntries: integer; {2}
				TiffDir: array[1..6] of TiffEntry; {72}
				NextIFD: LongInt;  {4}
			end;
		VideoDigitizerStandard = (defaultStd, NTSCStd, PALStd, SECAMStd);
		VideoDigitizerMode = (digitizeGrayscale, digitizeColor, digitizeRGB);

		SettingsType = record
				sID: packed array[1..4] of char;
				sVersion: integer;
				sForegroundIndex, sBackgroundIndex: integer;
				sBrushHeight, sBrushWidth: integer;
				sSprayCanDiameter: integer;
				sLUTMode: LUTModeType;
				sOldColorStart: integer;
				sOldColorWidth: integer;
				sCurrentFontID: integer;
				sCurrentStyle: style;
				sCurrentSize: integer;
				sTextJust: integer;
				sTextBack: TextBackType;
				snExtraColors: integer;
				sExtraColors: ExtraColorsArray;
				sInvertVideo: boolean;
				sMeasurements: SetOfMeasurements;
				sInvertPlots, sAutoScalePlots, sLinePlot, sDrawPlotLabels, sFixedSizePlot: boolean;
				sUnused1: packed array[1..12] of integer;
				sProfilePlotWidth, sProfilePlotHeight: integer;
				sFramesToAverage: integer;
				sNewPicWidth, sNewPicHeight: integer;
				sBufferSize: LongInt;
				sUnused3: integer;
				sThresholdToForeground, sNonThresholdToBackground: boolean;
				sVideoChannel: integer;
				sWhatToImport: WhatToImportType;
				sImportCustomWidth, sImportCustomHeight: integer;
				sImportCustomOffset: LongInt;
				sWandAutoMeasure, sWandAdjustAreas: boolean;
				sBinaryIterations: integer;
				sScaleArithmetic: boolean;
				sInvertPixelValues: boolean;
				sInvertYCoordinates: boolean;
				sFieldWidth, sPrecision: integer;
				sMinParticleSize, sMaxParticleSize: LongInt;
				sIgnoreParticlesTouchingEdge, sLabelParticles, sOutlineParticles, sIncludeHoles: boolean;
				sKernelsVRefNum: integer;
				sKernelsDirID: LongInt;
				sDefaultVRefNum: integer;
				sDefaultDirID: LongInt;
				sOscillatingMovies: boolean;
				sDriverHalftoning: boolean;
				sMaxMeasurements: integer;
				sImportCustomDepth: FileDepthType;
				sImportSwapBytes, sImportCalibrate, sImportAutoscale: boolean;
				sUnused2: packed array[1..12] of integer;
				sShowHeadings: boolean;
        {Added with V1.40}
				sProfilePlotMin, sProfilePlotMax: real;
				sImportMin, sImportMax: real;
				sHighlightPixels: boolean;
        {Added with V1.41}
				sBallRadius: integer;
				sFasterBackgroundSubtraction: boolean;
				sScaleConvolutions: boolean;
       {Added with V1.42}
				sBinaryCount: integer;
				sColorTable: ColorTableType;
				sColorStart, sColorEnd: integer;
				sInvertedTable: boolean;
       {Added with V1.44}
				sHalftoneFrequency, sHalftoneAngle: integer;
				sHalftoneDotFunction: boolean;
       {Added with V1.46}
				sDacLow, sDacHigh: integer;
      {Added with V1.47}
				sSyncMode: SyncModeType;
      {Added with V1.49}
				sSwitchLUTOnSuspend: boolean;
				sVideoRateAveraging: boolean;
      {Added with V1.50}
				sImportInvert: boolean;
      {Added with V1.52}
				sTextCreator: packed array[1..4] of char;
      {Added with V1.56}
      	sMathSubGain: real;
      	sMathSubOffset: LongInt;
      {Added with V1.60}
      	sfgScale: integer;
				sUseBuiltinDigitizer: boolean;
				sDigitizerMode: VideoDigitizerMode;
				sDigitizerStandard: VideoDigitizerStandard;
				sLutFriendlyMode: boolean;
				sUnused: array[1..10] of LongInt;
			end;

		TiffInfoRec = record
				Width, Height: integer;
				BitsPerPixel: integer;
				SamplesPerPixel: integer;
				PlanarConfig: integer;
				ZeroIsBlack: boolean;
				OffsetToData, OffsetToColorMap, OffsetToImageHeader: LongInt;
				Resolution: extended;
				ResUnits: (tCentimeters, tInches, tNoUnits);
				NextIFD: LongInt;
			end;

		TiffIFDTable = array[1..MaxSlices] of record
				iWidth, iHeight: integer;
				Offset: LongInt;
				Invert: boolean;
			end;

		PaletteRecType = record
				NumberOfColors: integer;
				RedData: ColorArray;
				GreenData: ColorArray;
				BlueData: ColorArray;
			end;

		ProjectionMethodType = (NearestPoint, BrightestPoint, MeanValue);
		AxisType = (XAxis, YAxis, ZAxis);
		FiducialMethodType = (OnScreen, FromFile);

		CoordinatesType = array[1..MaxMaxCoordinates] of integer;
		xCoordinatesPtr = ^CoordinatesType;
		yCoordinatesPtr = ^CoordinatesType;
		WhatToUndoType = (NothingToUndo, UndoEdit, UndoFlip, UndoRotate, UndoFilter, UndoPaste, UndoTransform, UndoClear, UndoMeasurement, UndoPoint, UndoZoom, UndoOutline, UndoSliceDelete, UndoFirstSliceDelete, UndoLUT);

		TextInfoRec = record
				TextWindowPtr: WindowPtr;
				TextLeft, TextTop, TextWidth, TextHeight: integer;
				hTextScrollBar, vTextScrollBar: ControlHandle;
				hTextPageSize, vTextPageSize: integer;
				TextTE: TEHandle;
				TextTitle: str255;
				TextRefNum: integer;
				Changes, TooBig: boolean;
				WindowNum: integer;
			end;
		TextInfoPtr = ^TextInfoRec;

		ImageData = packed array[0..maxImageSize] of byte;
		ImageP = ^ImageData;
		
		rImageData = packed array[0..maxImageSize] of real;
		rImagePtr = ^rImageData;

		eType=(e1,e2,e3);
		uPtr=^byte; {pointer to unsigned bytes}
		fftType = (ForewardFFT, InverseFFT, InverseFFTWithMask, InverseFFTWithFilter);
		
	var
		TraceInfo: str4;
		finished: boolean;
		trect, gmrect, MapRect1, MapRect2, crect, HistoRect: rect;
		gmSlide1, gmslide2, gmSlide1i, gmSlide2i, gmicon1, gmicon2: rect;
		ToolWindow, MapWindow, LUTWindow, InfoWindow, HistoWindow, PlotWindow, PasteControl: WindowPtr;
		BuggyWatch: CursHandle;
		cr, tab, BackSpace, eofChr: char;
		crStr:string[1]; {ppc-bug}
		CharCount: LongInt;
		ScreenPort: GrafPtr;
		CScreenPort: cGrafPtr;
		ipTicks:LongInt;
		MonoFunction: ClutTable;
		Info: InfoPtr;
		ToolCursor: array[ToolType] of Cursor;
		AnimatedWatch: array[1..8] of Cursor;
		WatchIndex: integer;
		PickerCursor, LUTCursor, gmCursor, CrossPlusCursor, CrossMinusCursor, GlassMinusCursor, watch, WandPlusCursor, WandMinusCursor, FingerCursor: Cursor;
		CurrentTool, PreviousTool, FirstTool, LastTool: ToolType;
		ToolRect: array[ToolType] of rect;
		ToolTime, LutTime: longInt;
		nPics, nextPid: integer;
		PicWindow: array[1..MaxPics] of WindowPtr;
		ScreenWidth, ScreenHeight: integer;
		ScreenBase: ptr;
		ScreenRowBytes: LongInt;
		ScreenPixMap: PixMapHandle;
		Histogram: HistogramType;
		HistogramSliceStart, HistogramSliceEnd: integer;
		ForegroundIndex, BackgroundIndex: integer;
		lines: array[1..nLineTypes] of rect;
		CheckRect: rect;
		LineWidth, LineIndex: integer;
		StartOfLines: integer;
		MaskRgn: RgnHandle;
		PlotPICT: PicHandle;
		PlotLeft, PlotTop, PlotWidth, PlotHeight, PlotPicNum: integer;
		PlotMin, PlotMax, ActualPlotMin, ActualPlotMax: extended;
		PlotCount, PlotAvg: integer;
		PlotData: rLinePtr;
		PlotAngle, PlotScale: extended;
		PlotStart: point;
		PlotXUnits, PlotYUnits: string[MaxUM];
		InvertPlots, AutoscalePlots, LinePlot, DrawPlotLabels, FixedSizePlot: boolean;
		ProfilePlotMin, ProfilePlotMax: extended;
		ProfilePlotWidth, ProfilePlotHeight: integer;
		UndoBuf, ClipBuf, BigBuf: ptr;
		ClipBufSize, UndoBufSize, BigBufSize: LongInt;
		UndoInfoRec: PicInfo;
		UndoInfo: InfoPtr;
		CurrentUndoSize: LongInt;
		SprayCanDiameter, SprayCanRadius, SprayCanRadius2: integer;
		BrushHeight, BrushWidth: integer;
		CurrentFontID, CurrentSize, NumFontItems: integer;
		CurrentStyle: Style;
		InsertionPoint: point; {Offscreen coordinates}
		IsInsertionPoint: boolean;
		TextJust: integer;
		TextBack: TextBackType;
		TextStr: str255;
		TextRect: rect;
		TextStart: point;
		BlinkTime: LongInt;
		AntPattern: array[0..7] of pattern;
		PatIndex: integer;
		OpPending: boolean;
		CurrentOp: OpType;
		IsOK: boolean;
		PicLeftBase, PicTopBase, PicLeft, PicTop: integer;
		ClipBufInfoRec: PicInfo;
		ClipBufInfo: InfoPtr;
		MouseState: (NotInRoi, InRoi, DownInRoi);
		osMouseDownLoc: point;
		OldRoiRect: rect;
		WhatsOnClip: (NothingOnClip, AColor, RectPic, NonRectPic, ImportedPic, CameraPic, TextOnClip, LivePic);
		ClipTextInBuffer: boolean;
		ExtraColors: ExtraColorsArray;
		nExtraColors: integer;
		PasteTransferMode: integer;
		cheight: integer;
		ExtraColorsRect: array[1..MaxExtraPlus2] of rect;
		ExtraColorsEntry: array[1..MaxExtraPlus2] of integer;
		RoiMode: (MoveMode, StretchMode, LeftEndMode, RightEndMode);
		OldScrapCount: integer;
		ClipboardConverted: boolean;
		results: record
				UncalibratedMean: extended;
				MinIndex, MaxIndex, imode: integer;
			end;
		FrameGrabber: (QuickCapture, ScionLG3, ScionAG5, ScionVG5f, QTvdig, NoFrameGrabber);
		fgSlotBase, fgRowBytes: LongInt;
		ControlReg, ChannelReg, BufferReg, DacHighReg, DacLowReg: ptr;
		Digitizing: boolean;
		debugging: boolean;
		NoInfo: InfoPtr;
		NoInfoRec: PicInfo;
		UndoFromClip: boolean;
		DensitySlicing, ThresholdToForeground, NonThresholdToBackground: boolean;
		SliceStart, SliceEnd: integer;
		SliceColor: RGBColor;
		BlankFieldInfo: InfoPtr;
		BlankFieldMean: integer;
		InvertVideo, HighlightSaturatedPixels: boolean;
		VideoChannel: integer;
		TextBufSize, TextBufColumn: integer;
		TextBufLineCount: LongInt;
		TextBufP: TextBufPtr;
		BitInfoCount: integer;
		mCount, mCount2: integer;
		nPoints, nLengths, nAngles: integer;
		umean: array[0..MaxStandards] of extended; {Uncalibrated means}
		StandardValues: StandardsArray;
		nStandards, nKnownValues: integer;
		cvalue: array[0..255] of extended;
		minCValue, maxCValue, FitGoodness, FitSD: extended;
		PlotLeftMargin, PlotTopMargin, PlotBottomMargin, PlotRightMargin: integer;
		WhatToUndo: WhatToUndoType;
		WhatToCopy: (NothingToCopy, CopySelection, CopyCLUT, CopyGrayMap, CopyTools, CopyPlot, CopyCalibrationPlot, CopyHistogram, CopyMeasurements, CopyColor, CopyText);
		WhatToPrint: (NothingToPrint, PrintImage, PrintSelection, PrintMeasurements, PrintPlot, PrintHistogram, PrintText);
		PrintRecord: THPrint;
		isLaserWriter: boolean;
		printing: boolean;
		HalftoneFrequency, HalftoneAngle: integer;
		HalftoneDotFunction: boolean;
		AppleMenuH, FileMenuH, AcquireMenuH, ExportMenuH, EditMenuH, OptionsMenuH, ColorTablesMenuH, {}
		PropagateMenuH, ProcessMenuH, FilterMenuH, BinaryMenuH, ArithmeticMenuH, BackgroundMenuH, {}
		AnalyzeMenuH, SpecialMenuH, StacksMenuH, SortPaletteMenuH, FontMenuH, SizeMenuH, StyleMenuH, {}
		WindowsMenuH, UserMenuH, TransferModeMenuH, LineToolMenuH, ImageMathOpsMenuH, ImageListMenuH, {}
		UnitsMenuH, fftMenuH: MenuHandle;
		rleft, rtop: integer;
		ListDone: boolean;
		ResultsWindow: WindowPtr;
		hScrollBar, vScrollBar: ControlHandle;
		ListTE: TEHandle;
		hListPageSize, vListPageSize: integer;
		measuring: boolean;
		Measurements: SetOfMeasurements;
		nListColumns: integer;
		FramesToAverage: LongInt;
		xLabel, yLabel, zLabel: string[31];
		xValueLoc, yValueLoc, zValueLoc: integer;
		MenuBarHeight: integer;
		NewPicWidth, NewPicHeight: LongInt;
		RestoreUndoBuf: boolean;
		WhatToOpen: (OpenImage, OpenPICT2, OpenTIFF, OpenMCID, OpenUnknown, OpenImported, OpenCustom);
		WhatToImport: WhatToImportType;
		ImportCustomWidth, ImportCustomHeight, ImportCustomSlices: LongInt;
		ImportCustomOffset: LongInt;
		ImportCustomDepth: FileDepthType;
		ImportSwapBytes, ImportAll, ImportCalibrate, ImportInvert: boolean;
		IntelByteOrder: boolean;
		BufferSize: LongInt;
		isSelectionTool: boolean;
		SelectionMode: (NewSelection, AddSelection, SubSelection);
		RoiMovementState: (Unconstrained, Constrained, ConstrainedH, ConstrainedV);
		pcItem: array[1..npcItems] of record
				r: rect;
				itype: pcItemType;
				str: string[20];
			end;
		PictF: integer;
		PictBuffer, curPictBufPtr: ptr;
		BytesInPictBuffer: LongInt;
		FitsInPictBuffer, RoiNudged, GrayMapReady, RedoSelection: boolean;
		ThresholdingMode: (DensitySlice, GrayMapThresholding, BinaryImage, NoThresholding);
		WandAutoMeasure, WandAdjustAreas, RedirectSampling: boolean;
		LabelParticles, OutlineParticles, IgnoreParticlesTouchingEdge, IncludeHoles: boolean;
		MinParticleSize, MaxParticleSize: LongInt;
		OptionKeyWasDown, ScaleArithmetic, FitEllipse, AnalyzingParticles: boolean;
		WhiteRGB, BlackRGB: RGBColor;
		BinaryIterations: integer;
		nMonitors: integer;
		Monitors: array[1..6] of GDHandle;
		InfoMessage: str255;
		fgStartTicks, fgFrameCount: LongInt;
		SaveAsWhat: SaveAsWhatType;
		ExportAsWhat: ExportAsWhatType;
		SaveAllState: (NoSaveAll, SaveAllStage1, SaveAllStage2);
		InvertPixelValues, InvertYCoordinates, ContinuousHistogram: boolean;
		fgPort: cGrafPtr;
		fgPixMap: PixMapHandle;
		fgWidth, fgHeight, fgScale: integer;
		RoiUpdateTime: LongInt; {Time required to draw ROI outline. Set to 0 to force redraw.}
		FieldWidth: integer;
		Precision: integer; {Digits to right of decimal point}
		MeasurementToRedo: integer;
		Has32BitQuickDraw: boolean;
		DefaultRefNum, KernelsRefNum, MacrosRefNum: integer;
		LaunchVRefNum, PlugInsVRefNum: integer;
		LaunchDirID, PlugInsDirID: LongInt;
		DefaultFileName: string[63];
		rsHScale, rsVScale, rsAngle: extended; {Rotate and Scale Parameters}
		rsMethod: rsMethodType;
		rsCreateNewWindow: boolean;
		rsInteractive: boolean;
		TextEol, TextEof: boolean;
		Textf, TextIndex: integer;
		TextFileSize: LongInt;
		nMacros, nSymbols: integer;
		pcStart, TopOfStack, CurrentX, CurrentY, EndMacros: integer;
		nProcedures, TokenLoc, TokenStackLoc, SavePC, nGlobals, SymbolTableLoc: integer;
		LegalWithoutImage: set of CommandType;
		SaveForeground: integer;
		PC: integer; {"program counter" used by macro interpreter}
		MacroLineNumber: integer;
		MacroStart: array[1..MaxMacros] of integer;
		MacroKey: packed array[1..MaxMacros] of char;
		Token, SaveToken:TokenTypeX;
		TokenStr: str255;
		TokenSymbol, MacroOrProcName: SymbolType;
		TokenValue: extended;
		Macro: boolean; {True if macro is running.}
		MacrosP: MacrosPtr;
		MacroCommand: CommandType;
		SerialIn, SerialOut: integer;
		SerialBufferP: ptr;
		ImportAutoScale: boolean;
		ImportMin, ImportMax: extended;
		OscillatingMovies, DriverHalftoning: boolean;
		ExplicitPalette: PaletteHandle;
		LivePasteMode: boolean;
		ShowCount: boolean;
		PasteControlLeft, PasteControlTop: integer;
		MaxMeasurements, MaxCoordinates: integer;
		mean: meanPtr;
		sd: sdPtr;
		PixelCount: PixelCountPtr;
		mArea: AreaPtr;
		mode: modePtr;
		IntegratedDensity: IntegratedDensityPtr;
		idBackground: idBackgroundPtr;
		xcenter: xcenterPtr;
		ycenter: ycenterPtr;
		MajorAxis: MajorAxisPtr;
		MinorAxis: MinorAxisPtr;
		orientation: orientationPtr;
		mMin: MinPtr;
		mMax: MaxPtr;
		plength: plengthPtr;
		User1: User1Ptr;
		User2: User2Ptr;
		ResultsLeft, ResultsTop, ResultsWidth, ResultsHeight: integer;
		UnsavedResults: boolean;
		MajorLabel, MinorLabel, User1Label, User2Label: string[maxLabelLength];
		OldSystem, System7: boolean;
		SystemRefNum: integer;
		ShowHeadings: boolean;
		MakingLOI: boolean;
		LOIType: (Straight, Freehand, Segmented);
		MakingStack: boolean;
		FramesWanted: integer;
		ScaleConvolutions: boolean;
		FasterBackgroundSubtraction: boolean;
		BallRadius: integer;
		DelayTicks: integer;
		CmdPeriodToStop: string[21];
		CommandKey: char;
		BinaryCount, BinaryThreshold: integer;
		ClipboardColor: rgbColor;
		InitAngle, TotalAngle, AngleInc,                 {initial, total, and incremental angles of volume rotation}
		TransparencyLower,                                   {pixels below this threshold are transparent}
		TransparencyUpper,                                   {pixels above this threshold are transparent}
		Opacity,                                                       {percentage nearest-point in a combined projection}
		DepthCueSurf,                                             {depth-cueing constant for nearest-pt component}
		DepthCueInt: integer;                                  {depth-cueing constant for other projection components}
		AxisOfRotation: AxisType;                           {project volume as it rotates about x,y,or z-axis}
		SaveProjections,                                         {if TRUE, save and close proj frames once created}
		MinProjSize: boolean;                                {if FALSE, make windows same size regardless of rotation axis}
		ProjectionMethod: ProjectionMethodType;
		MeterWindow: WindowPtr;
		xCoordinates: xCoordinatesPtr;
		yCoordinates: yCoordinatesPtr;
		nCoordinates: integer;
		CoordinatesWidth, CoordinatesHeight: integer;
		CoordinatesRoiType: RoiTypeType;
		SwitchLUTOnSuspend: boolean;
		SumFrames, ExternalTrigger, BlindMovieCapture, ShowIntegratedValues, FixIntegrationScale: boolean;
		IntegrationMin, IntegrationMax: LongInt;
		DacHigh, DacLow: integer;
		MaxLG3Frames: integer;
		VideoRateAveraging: boolean;
		VideoControl: DialogPtr;
		ConstantReg: ptr;
		ScaleHighReg, ScaleLowReg: IntegerPtr;
		AG5LutMode: boolean;
		AG5GrabMode: (GrabNormal, GrabSum, GrabDivide, GrabScale);
		AG5BufferMode: (Read0Lut0Grab0, Read1Lut0Grab0, Read2Lut0Grab0, Read3Lut0Grab0, Read0Lut1Grab0, Read1Lut1Grab0, Read2Lut1Grab0, Read3Lut1Grab0,{}
			Read0Lut0Grab1, Read1Lut0Grab1, Read2Lut0Grab1, Read3Lut0Grab1, Read0Lut1Grab1, Read1Lut1Grab1, Read2Lut1Grab1, Read3Lut1Grab1);
		SyncMode: SyncModeType;
		DitherColor: boolean;
		RGBLut: (ExistingLUT, SystemLUT, CustomLUT);
		Highlight1, Highlight254: rgbColor;
		HighlightMode: boolean;
		OpeningPlugInWindow: boolean;
		DacAReg, DacBReg: ptr;
		LG3DacA, LG3DacB, LG3DataOut: integer;
		nAcqPlugIns, nExportPlugIns, nFilterPlugIns: integer;
		LastAcqPlugIn, LastFilterPlugIn, LastExportPlugIn, NewTitle: string[31];
		TextInfo: TextInfoPtr;
		nTextWindows: integer;
		TextWindow: array[1..MaxTextWindows] of WindowPtr;
		SearchString: string[31];
		CurrentWPtr: WindowPtr;
		CurrentKind: integer;
		ToolBits: BitMap;
		TextCreator: packed array[1..4] of char;
		CurrentMathOp: (AddMath, SubMath, MulMath, DivMath, AndMath, OrMath, XorMath, MaxMath, MinMath, cMulMath, CopyMath);
		MathSrc1, MathSrc2: integer;
		MathGain, MathSubGain: extended;
		MathOffset, MathSubOffset: extended;
		MathResult: string[31];
		APReset: boolean;
		ShowPlot: boolean;
		osGDevice: GDHandle;
		gCopyMode: integer;
		SaveScreenDepth: integer;
		FiducialMethod: FiducialMethodType;
		ConfirmFidClicks: boolean;
		WireframeSurfacePlots, GrayscaleSurfacePlots: boolean;
		RankFilter: (MedianRank, MinRank, MaxRank, OpeningRank, ClosingRank);
		RankIterations: integer;eVar:eType;
		TextScrollActionProc:UniversalProcPtr;{ControlActionUPP} {ppc-bug}
		AboutBoxFilterProc, AboutBoxUserProc, ResultsScrollActionProc, ImageMathUserProc, SetScaleUserProc:UniversalProcPtr;
		OpenDHookProc, SaveAsDHookProc, ImportDHookProc, ExportDHookProc:UniversalProcPtr;
		BitInfoProc, GetPictDataProc:UniversalProcPtr;
		TestAbortProc, UpdateProgressProc:UniversalProcPtr;
		IntegrateOnChip: boolean;
		OpeningFinderFiles:boolean;
		gNumberSlices, gBorders: boolean;
		RealImageMath:boolean;
		StartupSpec: FSSpec;
		DicomInitialized, ImportingDicom:boolean;
		OpeningRGB: boolean;
		superSlotBase: LongInt; {address of frame buffer using 32-bit addressing}
		PrecisionTiming, TimeStamp, LG3BufferCapture: boolean;
		SecondsPerFrame: extended;
		TriggerFirstFrameOnly: boolean;
		UseExistingStack: boolean;
		RealArithmetic: boolean;
		vdig: ComponentInstance;
		GWorldLUT: CTabHandle;
		osGWorld: GWorldPtr;
		UseBuiltinDigitizer: boolean;
		DigitizerMode: VideoDigitizerMode;
		DigitizerStandard: VideoDigitizerStandard;
		fgSuperSlotBase0, fgSuperSlotBase1: LongInt;
		PCIFrameGrabber, DoubleBuffering, CurrentBufferIsZero: boolean;
		LUTFriendlyMode: boolean;
		MovieToolboxInitialized: boolean;
	

implementation

end.
