DIRECTORY Rope USING [ROPE], ImagerPixel USING [PixelBuffer], ImagerSample USING [Sample], UnixTapeOps USING [TapeHandle, Density], TapesCommon USING [FileHandleList]; OptronicsTape: CEDAR DEFINITIONS ~ BEGIN ROPE: TYPE ~ Rope.ROPE; TapeHandle: TYPE ~ UnixTapeOps.TapeHandle; TapeError: SIGNAL [reason: ErrorDesc]; ErrorDesc: TYPE ~ RECORD [code: ATOM, explanation: Rope.ROPE]; FileSpec: TYPE = REF FileSpecRep; FileSpecRep: TYPE = RECORD[ pixelsPerInch: PixelsPerInch, nLines, nPixels: NAT, rgbInterleaved: BOOLEAN _ FALSE, maxD: REAL _ 2.0 --suggested values: 2.0 for gray, 1.5 for color ]; FileSpecList: TYPE = LIST OF FileSpec; ColorType: TYPE = {rgb, gray, singleColor}; --linear in density PixelsPerInch: TYPE = {ppi63, ppi127, ppi254, ppi508, ppi1015, ppi2030}; WriteTape: PROC [tapeHandle: TapeHandle, header: ROPE, files: FileSpecList] RETURNS [TapesCommon.FileHandleList]; AISToTape: PROC [aisRootName: ROPE, color: BOOLEAN _ TRUE, pixelsPerInch: NAT _ 254]; ReadHeader: PROC [tapeHandle: TapeHandle] RETURNS [ROPE]; FileToAIS: PROC [tapeHandle: TapeHandle, fileNumber: NAT, colorType: ColorType, aisRootName: ROPE, reduce: NAT _ 4]; TRCTable: TYPE = REF TRCTableRec; TRCTableRec: TYPE = RECORD[length: NAT, values: SEQUENCE maxLength: NAT OF ImagerSample.Sample]; MakeRGBToDensity: PUBLIC PROC[maxSampleOut, maxSampleIn: NAT _ 255, maxD: REAL _ 2.0] RETURNS[TRCTable]; MakeDensityToRGB: PUBLIC PROC[maxSampleOut, maxSampleIn: NAT _ 255, maxD: REAL _ 2.0] RETURNS[TRCTable]; RGBToDensity: PROC [raster: ImagerPixel.PixelBuffer, rgbToDensity: TRCTable]; DensityToRGB: PROC[raster: ImagerPixel.PixelBuffer, densityToRGB: TRCTable]; SizeOfFile: PROC [fileSpec: FileSpec, density: UnixTapeOps.Density _ GCR6250] RETURNS [sizeInFeet: REAL]; SizeOfHeader: PROC [density: UnixTapeOps.Density _ GCR6250] RETURNS [sizeInFeet: REAL]; SizeOfList: PROC [files: FileSpecList, density: UnixTapeOps.Density _ GCR6250] RETURNS [sizeInFeet: REAL]; END. .OptronicsTape.mesa Copyright Σ 1987 by Xerox Corporation. All rights reserved. Maureen Stone, July 24, 1989 12:31:16 pm PDT Crow, March 30, 1989 12:50:26 pm PST Format to read/write Optronics tape format. RGB pixels, linear in density. One record per scanline. Each color separation is a separate file. Write Tape The maximum size on nPixels and nLines for each resolution is: 625, 1.25K, 2.5K, 5K, 10K, 20K From TapesCommon FileHandle: TYPE = REF FileHandleRep; FileHandleRep: TYPE = RECORD[ newLine: PROC[self: FileHandle, line: PixelBuffer] RETURNS[eof: BOOLEAN], data: REF ]; FileHandleList: TYPE = LIST OF FileHandle; Writes header and returns a list of FileHandle. Client rasterizes into each FileHandle in turn. newLine.eof is TRUE when tape has recorded nLines worth of rasters. Client can check newLine.eof to verify that the client and the tape are still in sync. In interleaved format, generates a File handle that expects an 3 deep PixelBuffer (r,g,b) and writes an interleaved red, green, blue file. Otherwise, expects only a 1 deep PixelBuffer Writes single AIS file (3 for color) to tape. Errors: - can't reach tape (not mounted, etc.) - image at specified pixelsPerInch won't fit on Optronics Read Tape Reads the header block Converts a tape file to 1 or 3 AIS files. If colorType=rgb the fileNumber should be the red file. colorType=gray and colorType=singleColor are treated indentically. Utilities Makes the tables that drive RGBToDensity and DensityToRGB Used internally, exported here for convenience of clients The length of the TRCTable should be the same as the size of the pixels in the raster Sizes A big tape is 2400 feet, a small tape is 600 feet. The file (three color files or one intensity file) The header block Convenience proc. SizeOfFile for each file in list + SizeOfHeader Κž˜code•Mark outsideHeaderšœ™Kšœ<™—head™ Kšœ œœ ˜!šœ œœ˜Kšœ˜Kšœœ˜Kšœœ˜ KšœœΟc/˜@Kšœ˜—Kšœœœœ ˜&K˜Kšœ œŸ˜?Kšœœ5˜H™>Kšœ™—K˜Kšœ™Kšœ œœ™%šœœœ™Kšœ œ&œœ™IKšœ™ Kšœ™—Kšœœœœ ™*K™šΟn œœ"œœ˜qKšœό™όKšœ‹™‹Kšœ- ™.—š   œœœ œœœ˜UKšœ›™›——™ K˜š  œœœœ˜9K™K™—š   œœ&œ%œ œ˜tK™)Kšœ7™7KšœB™B——™ Jšœ œœ ˜!Jš œ œœ œ œ œ˜`Kš  œ œœœœ ˜hKš  œ œœœœ ˜hKšœ  œ  ™9Kšœ™Kš  œœ;˜MKš  œœ:˜LK™9K™U—™K˜K™2š  œœ>œœ˜iK™2K™—š  œœ*œœ˜WK™K™—š  œœ?œœ˜jKšœ  œ  ™B——K˜Kšœ˜—…—’n