We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 03b60d9 commit 1c4591bCopy full SHA for 1c4591b
nibabel/freesurfer/io.py
@@ -160,6 +160,25 @@ def read_morph_data(filepath):
160
return curv
161
162
163
+def write_morph_data(filename, values):
164
+ '''
165
166
+ with open(filename, 'wb') as f:
167
+
168
+ # magic number
169
+ np.array([255], dtype='>u1').tofile(f)
170
171
172
173
+ # vertices number and two un-used int4
174
+ np.array([len(values)], dtype='>i4').tofile(f)
175
+ np.array([0], dtype='>i4').tofile(f)
176
+ np.array([1], dtype='>i4').tofile(f)
177
178
+ # now the data
179
+ np.array(values, dtype='>f4').tofile(f)
180
181
182
def read_annot(filepath, orig_ids=False):
183
"""Read in a Freesurfer annotation from a .annot file.
184
0 commit comments