DIRECTORY SampleMapOps, Rope USING [ROPE]; SampleArrays: CEDAR DEFINITIONS IMPORTS SampleMapOps ~ BEGIN Buffer: TYPE ~ SampleMapOps.Buffer; CVEC: TYPE ~ SampleMapOps.CVEC; Function: TYPE ~ SampleMapOps.Function; SampleMap: TYPE ~ SampleMapOps.SampleMap; ROPE: TYPE ~ Rope.ROPE; maxCount: NAT ~ SampleMapOps.maxCount; nullFunction: Function ~ SampleMapOps.nullFunction; SampleArray: TYPE ~ REF SampleArrayRep; SampleArrayRep: TYPE ~ RECORD [ sSize, fSize: NAT, layer: SEQUENCE n: NAT OF SampleMapEntry ]; SampleMapEntry: TYPE ~ RECORD [ sm: SampleMap _ NIL, class: ATOM _ NIL, data: REF _ NIL ]; Sample: TYPE ~ CARDINAL; ErrorDesc: TYPE ~ RECORD [code: ATOM, explanation: ROPE]; Error: ERROR [error: ErrorDesc]; MaxSampleValue: PROC [sa: SampleArray, i: NAT] RETURNS [Sample]; GetSample: PROC [sa: SampleArray, i: NAT, index: CVEC] RETURNS [Sample] ~ INLINE { RETURN [SampleMapOps.GetSample[sampleMap: sa.layer[i].sm, index: index]]; }; PutSample: PROC [sa: SampleArray, i: NAT, index: CVEC, value: Sample, function: Function _ nullFunction] ~ INLINE { SampleMapOps.PutSample[sampleMap: sa.layer[i].sm, index: index, value: value, function: function]; }; GetSamples: PROC [buffer: Buffer, start: NAT _ 0, count: NAT _ maxCount, sa: SampleArray, i: NAT, s, f: NAT _ 0, ds: NAT _ 0, df: NAT _ 1]; InlineGetSamples: PROC [buffer: Buffer, start: NAT _ 0, count: NAT _ maxCount, sa: SampleArray, i: NAT, s, f: NAT _ 0, ds: NAT _ 0, df: NAT _ 1] ~ INLINE { SampleMapOps.Get[buffer: buffer, start: start, count: count, sampleMap: sa.layer[i].sm, s: s, f: f, ds: ds, df: df]; }; PutSamples: PROC [buffer: Buffer, start: NAT _ 0, count: NAT _ maxCount, sa: SampleArray, i: NAT, s, f: NAT _ 0, ds: NAT _ 0, df: NAT _ 1, function: Function _ nullFunction]; InlinePutSamples: PROC [buffer: Buffer, start: NAT _ 0, count: NAT _ maxCount, sa: SampleArray, i: NAT, s, f: NAT _ 0, ds: NAT _ 0, df: NAT _ 1, function: Function _ nullFunction] ~ INLINE { SampleMapOps.Put[buffer: buffer, start: start, count: count, sampleMap: sa.layer[i].sm, s: s, f: f, ds: ds, df: df, function: function]; }; Save: PROC [sa: SampleArray]; Extract: PROC [old: SampleArray, samplesPerSample: NAT, select: PROC [NAT] RETURNS [NAT]] RETURNS [new: SampleArray]; Join: PROC [list: LIST OF SampleArray] RETURNS [SampleArray]; JoinMaps: PROC [list: LIST OF SampleMapEntry] RETURNS [SampleArray]; Join3: PROC [sa1, sa2, sa3: SampleArray] RETURNS [SampleArray]; Join3Maps: PROC [sm1, sm2, sm3: SampleMapEntry] RETURNS [SampleArray]; FromAIS: PROC [name: ROPE] RETURNS [SampleArray]; MapFromAIS: PROC [name: ROPE] RETURNS [SampleMapEntry]; CreateAISFromMap: PROC [sm: SampleMap, name: ROPE]; Join3AIS: PROC [name1, name2, name3: ROPE] RETURNS [SampleArray]; FileNameRoot: PROC [sa: SampleArray] RETURNS [root: ROPE]; BackingFileOf: PROC [sme: SampleMapEntry] RETURNS [backingFileName: ROPE]; END. จSampleArrays.mesa Copyright c 1984, 1985 by Xerox Corporation. All rights reserved. Michael Plass, August 1, 1984 9:59:33 am PDT Doug Wyatt, May 19, 1985 2:49:54 pm PDT Eric Nickell January 6, 1986 3:34:57 pm PST Basic operations The sample array contains sSize*fSize pixels, samplesPerPixel*sSize*fSize samples. A sample is named by a triple: i IN[0..samplesPerSample), s IN[0..sSize), f IN[0..fSize). ... returns the maximum sample value for the ith sample. For all i IN[0..sa.samplesPerSample), s IN[0..sa.sSize), f IN[0..sa.fSize): sa.GetSample[i, s, f] IN[0..sa.MaxSampleValue[i]]. ... returns the sample value with indices [i, s, f]. ! BoundsFault if i ~IN[0..sa.samplesPerSample) OR s ~IN[0..sa.sSize) OR f ~IN[0..sa.fSize). ... returns the sample value with indices [i, s, f]. ! BoundsFault if i ~IN[0..sa.samplesPerSample) OR s ~IN[0..sa.sSize) OR f ~IN[0..sa.fSize). ! BoundsFault if any index into sa is out of range ! BoundsFault if any index into sa is out of range Saves the sample array out to disk. The actual operation performed depends on the class. Creating sample arrays ... extracts selected sample layers from a pixel array. new.samplesPerSample = samplesPerSample new.sSize = old.sSize, new.fSize = old.fSize new.MaxSampleValue[i] = old.MaxSampleValue[select[i]] new.GetSample[i, s, f] = old.GetSample[select[i], s, f] ! BoundsFault if for any i IN[0..samplesPerSample), select[i] ~IN[0..sa.samplesPerSample). ... joins multiple sample planes into one SampleArray. ! Error[[$incompatibleJoin, ...]] if sizes do not match. ... makes a pixel array from an AIS file with the specified name. ! FS.Error if the named file cannot be opened. ! Error[[$malformedAISFile, ...]] if the file is not a valid AIS file. ... makes a pixel array from an AIS file with the specified name. ! FS.Error if the named file cannot be opened. ! Error[[$malformedAISFile, ...]] if the file is not a valid AIS file. Puts the sample map out to an AIS file. A convenience, equivalent to Join3[FromAIS[name1], FromAIS[name2], FromAIS[name3]]. ! FS.Error or Error, as for FromAIS or Join. Other operations Returns the common part of the file name. Note that not all classes are guaranteed to have backing files. สw˜codešœ™Kšœ ฯmœ7™BK™,K™'K™+—K˜šฯk ˜ Kšœ ˜ Kšœžœžœ˜—K˜Kšะbl œžœž ˜Kšžœ ˜šœž˜K˜Kšœžœ˜#Kšžœžœžœ˜Kšœ žœ˜'Kšœ žœ˜)Kšžœžœžœ˜K˜Kšœ žœ˜&Kšœ3˜3—head™Kšœ žœžœ˜'šœžœžœ˜Kšœžœ˜Kšœžœžœžœ˜(Kšœ˜—šœžœžœ˜Kšœžœ˜Kšœžœžœ˜Kšœžœž˜Kšœ˜KšœR™RKšœ!žœžœžœ ™YK™—Kšœžœžœ˜K˜Kš œ žœžœžœžœ˜9Kšœžœ˜ K˜šฯnœžœžœžœ ˜@K™8šœ žœžœžœ™KKšœžœ™2—K™—š   œžœžœ žœžœ žœ˜RKšžœC˜IKšœ˜K™4Kš œžœžœžœžœžœ™[K˜—š   œžœžœ žœ6žœ˜sKšœb˜bKšœ˜K™4Kš œžœžœžœžœžœ™[K˜—Kš  œžœžœ žœ!žœžœ žœ žœ˜‹š œžœžœ žœ!žœžœ žœ žœžœ˜›K•StartOfExpansionฆ[buffer: SampleMapOps.Buffer, start: NAT _ 0, count: NAT _ 32767, sampleMap: SampleMapOps.SampleMap, s: NAT _ 0, f: NAT _ 0, ds: NAT _ 0, df: NAT _ 1]˜tK˜Kšœ2™2K˜—Kš  œžœžœ žœ!žœžœ žœ žœ)˜ฎš œžœžœ žœ!žœžœ žœ žœ+žœ˜พK–ฆ[buffer: SampleMapOps.Buffer, start: NAT _ 0, count: NAT _ 32767, sampleMap: SampleMapOps.SampleMap, s: NAT _ 0, f: NAT _ 0, ds: NAT _ 0, df: NAT _ 1]˜ˆK˜Kšœ2™2—code2š œžœ˜K™YK˜——™š œžœ&žœ žœžœžœžœžœ˜v™7Kšœ'™'Kšœ,™,Kšœ5™5Kšœ7™7—Kšœžœ"žœ™ZK˜—K˜Kš  œžœžœžœžœ˜=Kš  œžœžœžœžœ˜DKš œžœžœ˜?š  œžœ!žœ˜FKšœ6™6Kšœ8™8—š œžœžœžœ˜1KšœA™AKšœžœ*™.KšœF™F—š  œžœžœžœ˜7KšœA™AKšœžœ*™.KšœF™F—š œžœžœ˜3Kšœžœ™'—š œžœžœžœ˜AKšœS™SKšœžœ(™,——™š  œžœžœžœ˜:K™)—š  œžœžœžœ˜JK™?——K˜Kšžœ˜—…— 4S