Ejemplo n.º 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)
Ejemplo n.º 2
0
		from mien.wx.base import wx
		wxapp = wx.PySimpleApp()			
	else:
		gui=False
	if files:
		ma=time.time()
		kwargs={'gui':gui}
		if 'f' in switches:
			if switches['f']=="tonmp":
				kwargs["convertxml"]=True
			else:	
				kwargs['format']=switches['f']
		if 'i' in switches:
			kwargs['select']=True
		import mien.parsers.fileIO as io
		doc=io.readall(files, **kwargs)
		print time.time()-ma 
	else:
		doc=None	
	if gui:
		if switches.has_key('v'):
			if not doc:
				print "No files specified to view. Exiting"
				sys.exit()
			a=io.getViewerApp(doc)
			if a:
				switches['a']=a
		if switches.has_key('a'):
			app=switches['a'].lower()
			if app.startswith('i'):
				from mien.image.viewer import ImageViewer