示例#1
0
def apply_rotation_gaps(angleset1, qrot):
    from EMAN2 import Transform, Vec2f
    import types
    if (type(qrot) == list):
        rot = Transform({
            "type": "spider",
            "phi": qrot[0],
            "theta": qrot[1],
            "psi": qrot[2]
        })
    else:
        rot = qrot
    for i in range(len(angleset1)):
        if (len(angleset1[i]) > 1):
            T1 = Transform({
                "type": "spider",
                "phi": angleset1[i][0],
                "theta": angleset1[i][1],
                "psi": angleset1[i][2],
                "tx": 0.0,
                "ty": 0.0,
                "tz": 0.0,
                "mirror": 0,
                "scale": 1.0
            })
            T1.set_trans(Vec2f(-angleset1[i][3], -angleset1[i][4]))
            T = T1 * rot
            d = T.get_params("spider")
            angleset1[i] = [d["phi"], d["theta"], d["psi"], -d["tx"], -d["ty"]]
示例#2
0
def rotate_shift_params(paramsin, transf):
    from EMAN2 import Vec2f
    t = Transform({
        "type": "spider",
        "phi": transf[0],
        "theta": transf[1],
        "psi": transf[2],
        "tx": transf[3],
        "ty": transf[4],
        "tz": transf[5],
        "mirror": 0,
        "scale": 1.0
    })
    t = t.inverse()
    cpar = []
    for params in paramsin:
        d = Transform({
            "type": "spider",
            "phi": params[0],
            "theta": params[1],
            "psi": params[2]
        })
        d.set_trans(Vec2f(-params[3], -params[4]))
        c = d * t
        u = c.get_params("spider")
        cpar.append([u["phi"], u["theta"], u["psi"], -u["tx"], -u["ty"]])
    return cpar
示例#3
0
def apply_rotation(angleset1, qrot):
	from EMAN2 import Transform, Vec2f

	"""
	if indexes != None:
		new_ang1 = []
		new_ang2 = []
		for i in indexes:
			new_ang1.append(angleset1[i])
			new_ang2.append(angleset2[i])
		angleset1 = new_ang1
		angleset2 = new_ang2
	"""
	import types
	if(type(qrot) == types.ListType): rot = Transform({"type":"spider","phi":qrot[0],"theta":qrot[1],"psi":qrot[2]})
	else:                             rot = qrot
	for i in xrange(len(angleset1)):
		T1 = Transform({"type":"spider","phi":angleset1[i][0],"theta":angleset1[i][1],"psi":angleset1[i][2],"tx":0.0,"ty":0.0,"tz":0.0,"mirror":0,"scale":1.0})
		T1.set_trans(Vec2f(-angleset1[i][3], -angleset1[i][4]))
		T = T1*rot
		d = T.get_params("spider")
		angleset1[i] = [d["phi"], d["theta"], d["psi"], -d["tx"], -d["ty"]]