def augment_multi(images,random_flip_x,shift_x,shift_y,rotation_degrees,zoom_factor):
pixels = images[0].shape[2]
center = pixels/2.-0.5
for i in range(len(images)):
image = images[i]
if random_flip_x:
print "flipping image"
#image[:,:] = image[:,::-1]
image[:,:,:] = image[:,:,::-1] #original
print image.shape
if rotation_degrees != 0:
print "rotating images"
if i == 0: #lung
image = rotate(image, rotation_degrees, axes=(1,2), reshape=False,cval=-3000,order=0)
else:
image = rotate(image, rotation_degrees, axes=(1,2), reshape=False,order=0)
print "post rotate ",image.shape
image = crop_or_pad_multi(image, pixels, -3000)
print image.shape
if shift_x != 0 or shift_y != 0:
print "shifting images by ",shift_x,shift_y, image.shape
if i == 0:
image = shift(image, [0,shift_x,shift_y],order=0,cval=-3000)
else:
image = shift(image, [0,shift_x,shift_y],order=0)
images[i] = image
return images
评论列表
文章目录