Skip to content

Commit fe7584d

Browse files
committed
added writing warp field
1 parent 33afc2c commit fe7584d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

nipype/algorithms/mesh.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ class ComputeMeshWarp(BaseInterface):
6666
Example
6767
-------
6868
69-
>>> import nipype.algorithms.mesh as mesh
70-
>>> dist = mesh.ComputeMeshWarp()
69+
>>> import nipype.algorithms.mesh as m
70+
>>> dist = m.ComputeMeshWarp()
7171
>>> dist.inputs.surface1 = 'surf1.vtk'
7272
>>> dist.inputs.surface2 = 'surf2.vtk'
7373
>>> res = dist.run() # doctest: +SKIP
@@ -140,16 +140,21 @@ def _run_interface(self, runtime):
140140
out_mesh = tvtk.PolyData()
141141
out_mesh.points = vtk1.points
142142
out_mesh.polys = vtk1.polys
143-
out_mesh.point_data.warpings = [tuple(d) for d in diff]
144-
145-
write_data(out_mesh, op.abspath(self.inputs.out_warp))
143+
out_mesh.point_data.vectors = diff
144+
out_mesh.point_data.vectors.name = 'warpings'
145+
writer = tvtk.PolyDataWriter(
146+
file_name=op.abspath(self.inputs.out_warp))
147+
writer.set_input_data(out_mesh)
148+
writer.write()
149+
#write_data(out_mesh, op.abspath(self.inputs.out_warp))
146150

147151
self._distance = np.average(errvector, weights=weights)
148152
return runtime
149153

150154
def _list_outputs(self):
151155
outputs = self._outputs().get()
152156
outputs['out_file'] = op.abspath(self.inputs.out_file)
157+
outputs['out_warp'] = op.abspath(self.inputs.out_warp)
153158
outputs['distance'] = self._distance
154159
return outputs
155160

0 commit comments

Comments
 (0)