コード例 #1
0
ファイル: hairtrack.py プロジェクト: gic888/mienblocks
def _vizPt(doc, datpath, vispath, sshape, overlay=None):
	if not vispath:
		return
	image=vispath
	if not ":" in image:
		image="/Data:" + image
	fromTimeSeries(doc, datpath, ptsize=4.0, outputPath=image)
	vd, h = getImageDataAndHeader(doc, image)
	hpad=sshape[0]-vd.shape[0]
	vpad=sshape[1]-vd.shape[1]
	pad(doc, image, left=0, right=hpad, top=0, bottom=vpad)
	if overlay:
		frameOverlay(doc, overlay, image, image)
コード例 #2
0
ファイル: findangle.py プロジェクト: gic888/mienblocks
def showProjection(doc, upath="/Data:DataFile"):
	nip='/Data:proj'
	ndat=doc.getInstance(upath).getData()
	fromTimeSeries(doc, upath, 2.0, width=-1, outputPath=nip)
	#pad(doc, nip, 10, 10, 50, 50)
	idat, h=getImageDataAndHeader(doc, nip)
	ndat-=array(h['SpatialAnchor'][:2])
	m, b = regress(ndat)
	line=255*_makeline(m, b, idat.shape)
	line=reshape(line, (line.shape[0], line.shape[1], 1, 1))
	df=colorOverlay(idat, line)
	frames=[]
	for i in range(idat.shape[3]):
		x, y = _ptoline(ndat[i,0], ndat[i,1], m, b)
		ball = 255*makeball(x, y, 1.0, idat.shape)
		ball=reshape(ball, (ball.shape[0], ball.shape[1], 1, 1))
		frames.append(concatenate([idat[:,:,:,i:i+1], line, ball], 2))
	df=concatenate(frames, 3)
	setImageData(df, nip, doc)