Ejemplo n.º 1
0
[nx, ny, nz, nt] = image4d.shape
if timepts == []:
    timepts = range(0, nt)  # set time points used for correlation


''' select area used as reference waveform '''
fig = pyplot.figure(2)
ax = pyplot.gca()
REFimg = ax.imshow(np.mean(image4d[:, :, 0, :], axis=2), interpolation='none')
RS = RectangleSelector(ax, onselect)
RS.coords = np.array([0, 0, ny-1, nx-1])  # image and plot reverse axes
pyplot.show()

RS.coords = RS.coords.astype(int)
RS.dims = np.array([RS.coords[2]-RS.coords[0], RS.coords[3]-RS.coords[1]])

# generate signal wave
Ipxtimeseries = np.reshape(image4d[:, :, 0, :], (nx*ny, nt))
I = Ipxtimeseries[:, timepts]
mI = np.mean(I, axis=1)
sI = np.std(I, axis=1)

# generate reference wave
REFimg = image4d[RS.coords[0]:RS.coords[2], RS.coords[1]:RS.coords[3], 0, :]
REFpxtimeseries = np.reshape(REFimg, (RS.dims[0]*RS.dims[1], nt))
# REF = np.percentile(REFpxtimeseries[:,timepts], 90, axis=0)
REF = np.mean(REFpxtimeseries[:, timepts], axis=0)
mREF = np.mean(REF, axis=0)
sREF = np.std(REF, axis=0)
Ejemplo n.º 2
0
start_java_bridge()
image4d = readfile(filename)

[nx, ny, nz, nt] = image4d.shape
if timepts == []:
    timepts = range(0, nt)  # set time points used for correlation
''' select area used as reference waveform '''
fig = pyplot.figure(2)
ax = pyplot.gca()
REFimg = ax.imshow(np.mean(image4d[:, :, 0, :], axis=2), interpolation='none')
RS = RectangleSelector(ax, onselect)
RS.coords = np.array([0, 0, ny - 1, nx - 1])  # image and plot reverse axes
pyplot.show()

RS.coords = RS.coords.astype(int)
RS.dims = np.array([RS.coords[2] - RS.coords[0], RS.coords[3] - RS.coords[1]])

# generate signal wave
Ipxtimeseries = np.reshape(image4d[:, :, 0, :], (nx * ny, nt))
I = Ipxtimeseries[:, timepts]
mI = np.mean(I, axis=1)
sI = np.std(I, axis=1)

# generate reference wave
REFimg = image4d[RS.coords[0]:RS.coords[2], RS.coords[1]:RS.coords[3], 0, :]
REFpxtimeseries = np.reshape(REFimg, (RS.dims[0] * RS.dims[1], nt))
# REF = np.percentile(REFpxtimeseries[:,timepts], 90, axis=0)
REF = np.mean(REFpxtimeseries[:, timepts], axis=0)
mREF = np.mean(REF, axis=0)
sREF = np.std(REF, axis=0)
''' calculate correlation corr(x,y) '''