GENERIC INTERFACE LocalAttributes(Nbr, Atr, Erg) = (* Computes local energy for a given neighborhood. WHERE /\ TYPE Nbr.T /\ Atr = Vector(...) *) TYPE T = Atr.T; PROCEDURE FromNeighborhood(READONLY n: Nbr.T; VAR a: Atr.T); (* Computes the local attributes from the neighborhood of a pixel. *) TYPE T = OBJECT METHODS eval ( READONLY p: Atr.T; VAR E: LONGREAL; VAR dEdp: Atr.T; ); (* Given a set of attributes for a texel, computes the corresponding local term of the energy function, and its derivatives relative to each attribute. *) print (wr: Wr.T); (* Prints a description of the energy evaluation function *) END; PROCEDURE EvalNeighborhood( READONLY n: Nbr.T; energy: Erg.T; VAR E: LONGREAL; VAR dEdn: Nbr.T; ); (* Computes the energy term "E" associated with a given neighborhood "n", and the partial derivatives "dEdn" of "E" relative to each component of "n", by way of the local attributes of the texture. More precisely, converts "n" to some set of local attributes "a" of type "Atr.T", then calling "eval" on "a", and mapping the derivatives "dEda" to the derivatives "dEdn". *) *) END LocalEnergy.