def __call__(self, image, x, y, sheet_xdensity, sheet_ydensity, width=<NUM_LIT:1.0>, height=<NUM_LIT:1.0>):
<EOL>self.image=image<EOL>for wpof in self.whole_pattern_output_fns:<EOL><INDENT>wpof(self.image)<EOL><DEDENT>if not self.background_value_fn:<EOL><INDENT>self.background_value = <NUM_LIT:0.0><EOL><DEDENT>else:<EOL><INDENT>self.background_value = self.background_value_fn(self.image)<EOL><DEDENT>pattern_rows,pattern_cols = self.image.shape<EOL>if width==<NUM_LIT:0> or height==<NUM_LIT:0> or pattern_cols==<NUM_LIT:0> or pattern_rows==<NUM_LIT:0>:<EOL><INDENT>return np.ones(x.shape)*self.background_value<EOL><DEDENT>x=x*sheet_xdensity <EOL>y=y*sheet_ydensity<EOL>self.__apply_size_normalization(x,y,sheet_xdensity,sheet_ydensity,self.size_normalization)<EOL>x/=width<EOL>y/=height<EOL>r,c = self.scs.sheet2matrixidx(x,y)<EOL>r.clip(<NUM_LIT:0>,pattern_rows-<NUM_LIT:1>,out=r)<EOL>c.clip(<NUM_LIT:0>,pattern_cols-<NUM_LIT:1>,out=c)<EOL>left,bottom,right,top = self.scs.bounds.lbrt()<EOL>return np.where((x>=left) & (x<right) & (y>bottom) & (y<=top),<EOL>self.image[r,c],<EOL>self.background_value)<EOL>
Return pixels from the supplied image at the given Sheet (x,y)
coordinates.

The image is assumed to be a NumPy array or other object that
exports the NumPy buffer interface (i.e. can be converted to a
NumPy array by passing it to numpy.array(), e.g. Image.Image).
The whole_pattern_output_fns are applied to the image before
any sampling is done.

To calculate the sample, the image is scaled according to the
size_normalization parameter, and any supplied width and
height. sheet_xdensity and sheet_ydensity are the xdensity and
ydensity of the sheet on which the pattern is to be drawn.