def addObj(self, o): #{ logging.debug('addObj()') t = int(o.contents.type) self.errnum = c.c_int(w.WLZ_ERR_OBJECT_TYPE) if (t == int(w.WLZ_2D_DOMAINOBJ)) or (t == int( w.WLZ_3D_DOMAINOBJ)): #{ if t == int(w.WLZ_2D_DOMAINOBJ): #{ self.errnum = c.c_int(w.WLZ_ERR_NONE) else: #}{ logging.debug('making view struct') v = w.WlzMake3DViewStruct(c.c_int(w.WLZ_3D_VIEW_STRUCT), \ c.byref(self.errnum)) if not bool(self.errnum): #{ f = w.WlzDVertex3() v.vtX = c.c_double(0.0) v.vtY = c.c_double(0.0) v.vtZ = c.c_double(0.0) v.contents.theta = self.yaw * m.pi / 180.0 v.contents.phi = self.pitch * m.pi / 180.0 v.contents.zeta = self.roll * m.pi / 180.0 v.contents.dist = self.dist v.contents.fixed = f v.contents.view_mode = c.c_int(w.WLZ_UP_IS_UP_MODE) v.contents.scale = c.c_double(1.0) v.contents.voxelRescaleFlg = c.c_int(0) w.WlzFree3DViewStruct(self.view) self.view = w.WlzAssign3DViewStruct(v, None) #} #} #} if not bool(self.errnum): #{ w.WlzFreeObj(self.obj) self.obj = w.WlzAssignObject(o, None) self.errnum = self.setObj2D() #} if not bool(self.errnum): #{ ary = self.wlz2DToNP() logging.debug('setting image') self.img = ary.astype(np.float64).T self.img_itm.setImage(self.img) self.setROIType('N') #} if bool(self.errnum): #{ self.warnWlzError('Failed to add object.')
def GetLmkVertex(g): #{ vtx = w.WlzDVertex3() vtx.vtX = float(g.find('X').text) vtx.vtY = float(g.find('Y').text) vtx.vtZ = float(g.find('Z').text) return(vtx)