def test_seammarker_addPointSlice2Image_colSliceFalse_isUpToTrue(self): isUpTo = True colSlice = False demot = self.loadImageRow() points = getPointListFromPointPath(self.points_left_path) point = points[0] slicer = PointSlicer(point, demot) before = 0 after = 62 rowslice = os.path.join(self.imagedir, 'rowslice.png') rowslice = np.array(Image.open(rowslice)) rowslicecp = rowslice.copy() rowslicehalf = rowslicecp.shape[0] // 2 rowslicecp[rowslicehalf:rowslicehalf + 3, :] = 255 addedimg = slicer.addPointSlice2Image(beforeAfterCoord=(before, after), colSlice=colSlice, imgSlice=rowslicecp, isUpTo=isUpTo) compimg = os.path.join(self.imagedir, 'rowAddedImage.png') compimg = np.array(Image.open(compimg)) self.compareArrays(addedimg, compimg, "Added row does not give added image")
def test_seammarker_addPointSlice2Image_colSliceTrue_isUpToFalse(self): isUpTo = False colSlice = True viet = self.loadImageCol() points = getPointListFromPointPath(self.points_down_path) point = points[0] slicer = PointSlicer(point, viet) before = 138 after = 180 compcolslice = os.path.join(self.imagedir, 'colslice.png') compimg = np.array(Image.open(compcolslice)) compcp = compimg.copy() compcphalf = compcp.shape[1] // 2 compcp[:, compcphalf:compcphalf + 3] = 255 addedimg = slicer.addPointSlice2Image(beforeAfterCoord=(before, after), colSlice=colSlice, imgSlice=compcp, isUpTo=isUpTo) compimg = os.path.join(self.imagedir, 'columnAddedImage.png') compimg = np.array(Image.open(compimg)) self.compareArrays( addedimg, compimg, "Added column does not give the expected added image")