MCPcopy
hub / github.com/mne-tools/mne-python / load_geometry

Method load_geometry

mne/viz/_brain/surface.py:105–151  ·  view source on GitHub ↗

Load geometry of the surface. Parameters ---------- None Returns ------- None

(self)

Source from the content-addressed store, hash-verified

103 )
104
105 def load_geometry(self):
106 """Load geometry of the surface.
107
108 Parameters
109 ----------
110 None
111
112 Returns
113 -------
114 None
115 """
116 if self.surf == "flat": # special case
117 fname = path.join(self.data_path, "surf", f"{self.hemi}.cortex.patch.flat")
118 _check_fname(
119 fname, overwrite="read", must_exist=True, name="flatmap surface file"
120 )
121 coords, faces, orig_faces = _read_patch(fname)
122 # rotate 90 degrees to get to a more standard orientation
123 # where X determines the distance between the hemis
124 coords = coords[:, [1, 0, 2]]
125 coords[:, 1] *= -1
126 else:
127 # allow ?h.pial.T1 if ?h.pial doesn't exist for instance
128 # end with '' for better file not found error
129 for img in ("", ".T1", ".T2", ""):
130 surf_fname = path.join(
131 self.data_path, "surf", f"{self.hemi}.{self.surf}{img}"
132 )
133 if path.isfile(surf_fname):
134 break
135 coords, faces = read_surface(surf_fname)
136 orig_faces = faces
137 if self.units == "m":
138 coords /= 1000.0
139 if self.offset is not None:
140 x_ = coords @ self.x_dir
141 if self.hemi == "lh":
142 coords -= (np.max(x_) + self.offset) * self.x_dir
143 else:
144 coords -= (np.min(x_) + self.offset) * self.x_dir
145 surf = dict(rr=coords, tris=faces)
146 complete_surface_info(surf, copy=False, verbose=False, do_neighbor_tri=False)
147 nn = surf["nn"]
148 self.coords = coords
149 self.faces = faces
150 self.orig_faces = orig_faces
151 self.nn = nn
152
153 def __len__(self):
154 """Return number of vertices."""

Callers 2

__init__Method · 0.80
add_fociMethod · 0.80

Calls 4

_check_fnameFunction · 0.85
_read_patchFunction · 0.85
read_surfaceFunction · 0.85
complete_surface_infoFunction · 0.85

Tested by

no test coverage detected