obj Package

parser

Handlers for reading/writing from/into OBJ format Surfaces are defined in this module.

class tvb.adapters.uploaders.obj.parser.ObjParser[source]

Bases: object

This class reads geometry from a simple wavefront obj file. self.vertices, self.tex_coords, self.normals are lists of vectors represented as tuples self.faces is a list of faces. A face is a list of vertex info. Vertex info is a tuple vertex_index, tex_index, normal_index.

parse_f(args)[source]
parse_v(args)[source]
parse_vn(args)[source]
parse_vt(args)[source]
read(obj_file)[source]
class tvb.adapters.uploaders.obj.parser.ObjWriter(obj_file)[source]

Bases: object

write(vertices, faces, normals=None, comment='')[source]
Parameters:
  • normals (vertices:, :param) – are lists of vectors or ndarrays of shape (n,3)

  • faces – A face is a list of 3 vertex indices.

Normal indices not supported. Texture uv’s not supported. This method does not yet validate the input, so send valid data.

surface

class tvb.adapters.uploaders.obj.surface.ObjSurface(obj_file)[source]

Bases: object

Represents a surface compatible with tvb. self.triangles , self.vertices , self.normals are numpy arrays shaped (n, 3) self.triangles contains indices.