#NEWLINE# def build_center_uncenter_transforms( image_shape ) : #NEWLINE# #INDENT# '\n    These are used to ensure that zooming and rotation happens around the center of the image.\n    Use these transforms to center and uncenter the image around such a transform.\n    ' #NEWLINE# center_shift = ( ( np . array ( [ image_shape [ 1 ] , image_shape [ 0 ] ] ) / 2.0 ) - 0.5 ) #NEWLINE# tform_uncenter = skimage . transform . SimilarityTransform ( translation = ( - center_shift ) ) #NEWLINE# tform_center = skimage . transform . SimilarityTransform ( translation = center_shift ) #NEWLINE# return ( tform_center , tform_uncenter )