def readNL(f, **kwargs): nlr = NLReader(f) objlist=[] singlepoint=[] for o in nlr.object_list: if o.__tag__=="Fiducial" and o.attrib("Style")=="points": if o.points.shape[0]==1: singlepoint.append(o) continue d = o.getPoints()[:,3] if not all(d == d[0]): o.attributes["Style"]="spheres" objlist.append(o) if singlepoint: f = createElement("Fiducial", singlepoint[0].attributes) for o in singlepoint: p = o.points[0] n = o.name() f.setPoints(p, append=1) i = len(f.points)-1 f.point_labels[i]=n objlist.append(f) n = createElement("Nmpml", {"Name":"Doc"}) for o in objlist: n.newElement(o) return n