def splitImg(): for t in dirtype: imgdir = TIFF3D.open(t + "-volume.tif") imgarr = imgdir.read_image() for i in range(imgarr.shape[0]): imgname = t + "/" + str(i) + ".tif" img = TIFF.open(imgname, 'w') img.write_image(imgarr[i])
def merge_img(): ''' merge single tif into a tif volume ''' path = '/home/zhixuhao/Downloads/imgs_mask_test_server2/' imgdir = TIFF3D.open("test_mask_volume_server2.tif", 'w') imgarr = [] for i in range(30): img = TIFF.open(path + str(i) + ".tif") imgarr.append(img.read_image()) imgdir.write_image(imgarr)
def split_img(): ''' split a tif volume into single tif ''' for t in dirtype: imgdir = TIFF3D.open(t + "-volume.tif") imgarr = imgdir.read_image() for i in range(imgarr.shape[0]): imgname = t + "/" + str(i) + ".tif" img = TIFF.open(imgname, 'w') img.write_image(imgarr[i])
def merge_img(): ''' merge single tif into a tif volume ''' path = '/home/greg/data/code/python3/UNet/unet/data/' imgdir = TIFF3D.open("test_mask_volume_server2.tif", 'w') imgarr = [] for i in range(30): img = TIFF.open(path + str(i) + ".tif") imgarr.append(img.read_image()) imgdir.write_image(imgarr)
def merge_img(): ''' merge single tif into a tif volume ''' path = '/home/zhixuhao/Downloads/imgs_mask_test_server2/' imgdir = TIFF3D.open("test_mask_volume_server2.tif",'w') imgarr = [] for i in range(30): img = TIFF.open(path + str(i) + ".tif") imgarr.append(img.read_image()) imgdir.write_image(imgarr)
def split_img(): ''' split a tif volume into single tif ''' for t in dirtype: if os.path.isdir(t): shutil.rmtree(t) os.mkdir(t) else: os.mkdir(t) imgdir = TIFF3D.open(t + "-volume.tif") imgarr = imgdir.read_image() for i in range(imgarr.shape[0]): imgname = t + "/" + str(i) + ".tif" img = TIFF.open(imgname, 'w') img.write_image(imgarr[i])
from libtiff import TIFF3D, TIFF imgdir = TIFF3D.open("train-volume.tif") imgarr = imgdir.read_image() for i in range(imgarr.shape[0]): imgname = str(i) + ".tif" img = TIFF.open(imgname, 'w') img.write_image(imgarr[i])