コード例 #1
0
import math
import matplotlib.pyplot as plt
import ImageTool as imtl
import AWA_tool as awa

Filename = "./data_samples/vc.dat"
cal = 0.039  # mm per pixel

X, dx, dy, Nframes = imtl.LoadAWA(Filename)
print("Dx,Dy,NFrames= ", dx, dy, Nframes)

# sum m all the frame
X_all_frame = imtl.DesInterlace(np.sum(X, axis=2))

TT = imtl.MouseCrop(X_all_frame)
centers = imtl.ImageCenter(TT)
print('center=', centers)

plt.figure()
#imtl.DisplayImage(X_all_frame)
#plt.subplot (2,2,1)
#imtl.DisplayCalibratedProj(X_all_frame, cal, 0.3)
#
#plt.subplot (2,2,2)
#imtl.DisplayCalibratedProj(imtl.Crop(X_all_frame,centers, [200,200]), cal, 0.3)

#plt.subplot (2,2,3)
imtl.DisplayCalibratedProj(TT, cal, 0.3)

plt.show()
コード例 #2
0
# display raw image
plt.figure()
plt.subplot(2, 2, 1)
imgtl.DisplayImage(IMG)
plt.title('raw data::' + FilenameBeam, fontsize=FTsize)
plt.axis('off')
print 'size raw:', np.shape(IMG)
# crop image
#    plt.figure()
plt.subplot(2, 2, 2)
# need to fix autocrop not to see image
#TODOFIX
# IMGc=imgtl.AutoCrop(IMG, bbox)
IMGc = imgtl.RemoveEdge(IMG, 100)
print 'size removed:', np.shape(IMGc)
imgtl.DisplayCalibratedProj(IMGc, cal, fudge)
plt.title('cropped' + FilenameBeam, fontsize=FTsize)
plt.axis('off')
# threshold image
#    plt.figure()
plt.subplot(2, 2, 3)
IMGt = ndimage.gaussian_filter(IMGc, 0)
# imgtl.Threshold(IMGc, threshold)
imgtl.DisplayCalibratedProj(IMGt, cal, fudge)
plt.title('cropped::' + FilenameBeam, fontsize=FTsize)
plt.axis('off')
# compute profiles
histx, histy, x, y = imgtl.GetImageProjection(IMGt, cal)
#    plt.figure()
plt.subplot(2, 2, 4)
x = x - x[np.argmax(histx)]