# Visualize the difference between two meshes

**URL:** https://discourse.slicer.org/t/visualize-the-difference-between-two-meshes/20729
**Category:** Support
**Tags:** visualization, deformation, meshing
**Created:** [November 22, 2021, 4:07pm UTC](https://discourse.slicer.org/t/visualize-the-difference-between-two-meshes/20729 "2021-11-22T16:07:39Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![suranga](https://avatars.discourse-cdn.com/v4/letter/s/8491ac/32.png) [@suranga](https://discourse.slicer.org/u/suranga)
#### Post date: [November 22, 2021, 4:07pm UTC](https://discourse.slicer.org/t/visualize-the-difference-between-two-meshes/20729/1 "2021-11-22T16:07:39Z")

</div>

I have two volumetric liver meshes in .vtk format (i.e. ground-truth and predicted versions) and I want to plot the error i.e., for example, the difference between the ground-truth and the predicted liver meshes on the predicted mesh / mesh coordinates with a different colour (colour code based on displacement magnitudes) to visualize how much deviation that each point has ? Is it possible in 3D slicer ? If so can you elaborate the steps with an example please ?

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [November 23, 2021, 7:07am UTC](https://discourse.slicer.org/t/visualize-the-difference-between-two-meshes/20729/2 "2021-11-23T07:07:31Z")

</div>

Does the N-th point in the first mesh correspond to the N-th point in the other mesh? If yes, then you can easily color the mesh by displacement. You can [get the point positions in a numpy array](https://slicer.readthedocs.io/en/latest/developer_guide/slicer.html#slicer.util.arrayFromModelPoints), subtract them from each other, and [add the resulting displacement as point scalars to the mesh](https://slicer.readthedocs.io/en/latest/developer_guide/slicer.html#slicer.util.arrayFromModelPointData). See examples in the [script repository](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html).

Alternatively, you can get a dense b-spline displacement field from the scattered points using [ScatteredTransform extension](https://www.slicer.org/wiki/Documentation/Nightly/Extensions/ScatteredTransform), convert it to a displacement field image, and then use [Probe Volume with Model module](https://slicer.readthedocs.io/en/latest/user_guide/modules/probevolumewithmodel.html) to set the displacement values into model point data.
