Beispiel #1
0
import Visualization
from scipy import ndimage

volume000 = sio.loadmat(
    'F:\For JC\practice run/volume000.mat')  # read the file
im1 = volume000['par1']  #[280:500,90:350,:] #[350:450,150:250,:]
volume125 = sio.loadmat('F:\For JC\practice run/volume125_regi.mat'
                        )  # big region three point alignment
im2 = volume125['par1']  #[280:500,90:350,:]

fig = plt.figure()
plt.imshow(im1[:, :, 70], cmap='Greys_r')
ax = fig.add_subplot(111)
ax.set_title('click to build line segments')
line, = ax.plot([0], [0])  # empty line
linebuilder = ImageProcessing.LineBuilder(line)
plt.show()

x_cor = linebuilder.xs
y_cor = linebuilder.ys

points = np.array([x_cor, y_cor]).T
points = np.delete(points, (0), axis=0)

imx, imy = im1[:, :, 60].shape
mx, my = np.meshgrid(np.linspace(0, imx - 1, imx),
                     np.linspace(0, imy - 1, imy))
# meshgrid change the orientation of x,y: x becomes the horizontal axis, y becomes the vertical
# this change would affect the return statement of reshape.
Cord_xy = np.vstack([mx.flatten(), my.flatten()]).T  # column major vector