def test_readroi_inplace(self): header = pyklb.readheader(self.testread_filepath) lb = [9, 15, 15] ub = [11, 99, 99] img = np.zeros(1 + np.array(ub) - np.array(lb), header["datatype"]) pyklb.readroi_inplace(img, self.testread_filepath, lb, ub, nochecks=False) self.assertEqual(round(np.mean(img)), 568) img = np.zeros(1 + np.array(ub) - np.array(lb), header["datatype"]) pyklb.readroi_inplace(img, self.testread_filepath, lb, ub, nochecks=True) self.assertEqual(round(np.mean(img)), 568) img = np.zeros(1 + np.array(ub) - np.array(lb), np.uint8) with self.assertRaises(TypeError): pyklb.readroi_inplace(img, self.testread_filepath, lb, ub) img = np.zeros([666, 666], header["datatype"]) with self.assertRaises(IOError): pyklb.readroi_inplace(img, self.testread_filepath, lb, ub) img = np.zeros(1 + np.array(ub) - np.array(lb), header["datatype"]) with self.assertRaises(IOError): pyklb.readroi_inplace(img, self.testread_filepath, ub, lb)
def execute(self, slot, subindex, roi, result): if result.flags.c_contiguous: pyklb.readroi_inplace(result, self._filepath, roi.start, roi.stop - 1, nochecks=False) else: result[:] = pyklb.readroi(self._filepath, roi.start, roi.stop - 1)
def execute(self, slot, subindex, roi, result): if result.flags.c_contiguous: pyklb.readroi_inplace(result, self._filepath, roi.start, roi.stop-1, nochecks=False) else: result[:] = pyklb.readroi(self._filepath, roi.start, roi.stop-1)