예제 #1
0
def pts2data(arg):
    """pts2data  fname [fname2 [...]] - extract points from sphere fiducials to a text data file

This function will load the contents of all the named files (provided they are readable by MIEN), 
select all the Fiducial elements that have Style == spheres, extract the point data from these
elements, concatenate the data into a single data element, and print that data to standard output
in text data file format. You can use shell redirection (e.g. "pts2data fname > data.txt") to 
write the points to a file.
"""
    doc = io.readall(arg)
    fid = doc.getElements("Fiducial", {"Style": "spheres"})
    pts = [f.getPoints() for f in fid]
    pts = row_stack(pts)
    d = md.newData(pts, {"SampleType": "generic"})
    f = io.match_extension("txt")[0]
    io.write(d, sys.stdout, format=f, newdoc=True)
예제 #2
0
파일: mienapp.py 프로젝트: gic888/MIEN
	else:
		import mien.interface.cli as cli
		if switches.has_key('t'):
			cli.startCli(doc)
		elif switches.has_key('s'):
			cli.scan(doc, int(switches['s']))
		elif switches.has_key('r'):
			from mien.interface.cli import runmethod
			runmethod(doc, switches['r'])
		elif switches.has_key('c'):
			format=switches['c']
			if not io.filetypes.has_key(format):
				try:
					if not format.startswith('.'):
						format='.'+format
					format=io.match_extension(format)[0]
				except:
					print "Can't determine format (use mien -f list to see formats)"
					format=None
			if format:
				fname, ex=os.path.splitext(files[0])
				ex=ex[1:]
				if ex.isdigit():
					fname=fname+"-"+ex
				ma=time.time()
				io.write(doc, fname, format=format, forceext=True)
				print time.time()-ma 
sys.exit()