def _validate_image_rank(self, img_array):
if img_array.ndim == <NUM_LIT:1> or img_array.ndim > <NUM_LIT:3>:<EOL><INDENT>msg = "<STR_LIT>".format(img_array.ndim)<EOL>raise IOError(msg)<EOL><DEDENT>
Images must be either 2D or 3D.