def set_data(self, A, shape=None):
<EOL>if hasattr(A,'<STR_LIT>'):<EOL><INDENT>self._A = pil_to_array(A)<EOL><DEDENT>elif ma.isMA(A):<EOL><INDENT>self._A = A<EOL><DEDENT>else:<EOL><INDENT>self._A = np.asarray(A) <EOL><DEDENT>if self._A.dtype != np.uint8 and not np.can_cast(self._A.dtype, np.float):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>if (self._A.ndim not in (<NUM_LIT:2>, <NUM_LIT:3>) or<EOL>(self._A.ndim == <NUM_LIT:3> and self._A.shape[-<NUM_LIT:1>] not in (<NUM_LIT:3>, <NUM_LIT:4>))):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>self._imcache =None<EOL>self._rgbacache = None<EOL>self._oldxslice = None<EOL>self._oldyslice = None<EOL>
Set the image array

ACCEPTS: numpy/PIL Image A