# Model point count changing after transformation

**URL:** <https://discourse.slicer.org/t/model-point-count-changing-after-transformation/26736>\
**Category:** Support\
**Created:** [December 14, 2022, 8:46pm UTC](https://discourse.slicer.org/t/model-point-count-changing-after-transformation/26736 "2022-12-14T20:46:28Z")\
**Posts on this page:** 14\
**Page:** 2

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [December 16, 2022, 4:13pm UTC](https://discourse.slicer.org/t/model-point-count-changing-after-transformation/26736/21 "2022-12-16T16:13:34Z")

</div>

It sounds like dependency walker is a red herring.

I agree with @lassoan first step would be to explore fixing the module.

Then we could explore these platform / environment specific issues if they haven’t gone away.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [December 16, 2022, 6:18pm UTC](https://discourse.slicer.org/t/model-point-count-changing-after-transformation/26736/22 "2022-12-16T18:18:27Z")

</div>

> [@pieper](#):
>
> I agree with @lassoan first step would be to explore fixing the module.

@jcfr is any of the extension developers are on this forum?

---

<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:** [December 16, 2022, 8:17pm UTC](https://discourse.slicer.org/t/model-point-count-changing-after-transformation/26736/23 "2022-12-16T20:17:50Z")

</div>

It is a trivial change (just skip the [cleaning step](https://github.com/NIRALUser/3DMetricTools/blob/master/ModelToModelDistance/ModelToModelDistance.cxx#L85) if corresponding points are used). If you test it locally and send a pull request then we can get it merged quickly. Both @jcfr and @Sam_Horvath seem to have commit rights to the extension.

---

<div class="post-metadata">

**Author:** ![smrolfe](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/smrolfe/32/3659_2.png) [@smrolfe](https://discourse.slicer.org/u/smrolfe)\
**Post date:** [December 16, 2022, 9:13pm UTC](https://discourse.slicer.org/t/model-point-count-changing-after-transformation/26736/24 "2022-12-16T21:13:28Z")

</div>

> [@lassoan](#):
>
> **It may worth checking why on linux and macos model to model distance computation mode succeeds** when corresponding point option is used; because it should fail on all platforms.

When it does run on Linux and Mac, the output point number is equal to the reduced point number generated by vtkCleanPolyData, not the input mesh, so I suspect it may not actually be generating the point-to-point results.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [December 16, 2022, 10:34pm UTC](https://discourse.slicer.org/t/model-point-count-changing-after-transformation/26736/25 "2022-12-16T22:34:09Z")

</div>

> It is a trivial change (just skip the _cleaning step_ if corresponding points are used).

See [ModelToModelDistance: Skip cleaning if corresponding\_point\_to\_point mode is set by jcfr · Pull Request #12 · NIRALUser/3DMetricTools · GitHub](https://github.com/NIRALUser/3DMetricTools/pull/12)

@smrolfe Let me know if that addresses the issue.

---

<div class="post-metadata">

**Author:** ![smrolfe](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/smrolfe/32/3659_2.png) [@smrolfe](https://discourse.slicer.org/u/smrolfe)\
**Post date:** [December 20, 2022, 6:35am UTC](https://discourse.slicer.org/t/model-point-count-changing-after-transformation/26736/26 "2022-12-20T06:35:19Z")

</div>

Thanks @jcfr it looks like this should fix the issue. I just tried to build the extension to test, but am having a problem with the ITK/VTK builds, which are failing with errors:

> 2\>Performing download step (git clone) for ‘VTK’  
> 2\>Cloning into ‘VTK’…  
> 3\>Performing download step (git clone) for ‘ITKv4’  
> 3\>Cloning into ‘ITKv4’…  
> 3\>fatal: repository ‘[http://itk.org/ITK.git/](http://itk.org/ITK.git/)’ not found  
> 2\>fatal: repository ‘[VTK / VTK · GitLab](http://vtk.org/VTK.git/)’ not found

This looks like errors I’ve gotten when building Slicer behind our firewall with USE\_GIT\_PROTOCOL enabled, but I’ve checked that it’s disabled for this extension build.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [December 22, 2022, 7:38pm UTC](https://discourse.slicer.org/t/model-point-count-changing-after-transformation/26736/27 "2022-12-22T19:38:55Z")

</div>

We can build other extensions, but this seems to fail for us. Can anyone else have this issue?  
@lassoan @jcfr @pieper

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [December 22, 2022, 9:11pm UTC](https://discourse.slicer.org/t/model-point-count-changing-after-transformation/26736/28 "2022-12-22T21:11:12Z")

</div>

Since we focus our effort on building the extension against Slicer and not into supporting building the project as a standalone project, I suggest you configure the extension directly passing `Slicer_DIR`.

After removing the content of the build directory, there are two ways:

- start `cmake-gui`, add an entry called `Slicer_DIR` pointing to the `C:/path/to/Slicer-Release/Slicer-build`
- directly from the command-line with `cmake -DSlicer_DIR:PATH=C:/path/to/Slicer-Release/Slicer-build -S C:/path/to/3DMetricTools -B C:/path/to/3DMetricTools-Release`

If using a single config generator (e.g `Unix Makefiles`), specify `CMAKE_BUILD_TYPE` to `Release`.

### Background

Setting reasonable default during the first configuration is the approach we have been using for most extension intended to be build as either a Slicer extension or an independent

This is explained by the following logic:

> <https://github.com/NIRALUser/3DMetricTools/blob/ff114ebc86603773bb32a96b08ccab7713c7e57e/CMakeLists.txt#L4-L17>

> <https://github.com/NIRALUser/3DMetricTools/blob/ff114ebc86603773bb32a96b08ccab7713c7e57e/CMakeLists.txt#L45-L61>

---

<div class="post-metadata">

**Author:** ![smrolfe](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/smrolfe/32/3659_2.png) [@smrolfe](https://discourse.slicer.org/u/smrolfe)\
**Post date:** [December 23, 2022, 7:28am UTC](https://discourse.slicer.org/t/model-point-count-changing-after-transformation/26736/29 "2022-12-23T07:28:48Z")

</div>

Thanks @jcfr I’m using the instructions in the [extensions documentation](https://slicer.readthedocs.io/en/latest/developer_guide/extensions.html) which includes adding the Slicer\_DIR variable, so this has not resolved the git-related error. Is there anything else that might cause this? I did not get this error when I built Slicer.

---

<div class="post-metadata">

**Author:** ![smrolfe](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/smrolfe/32/3659_2.png) [@smrolfe](https://discourse.slicer.org/u/smrolfe)\
**Post date:** [December 23, 2022, 7:32am UTC](https://discourse.slicer.org/t/model-point-count-changing-after-transformation/26736/30 "2022-12-23T07:32:29Z")

</div>

I also got the following error on configuring:

> CMake Error at C:/Program Files/CMake/share/cmake-3.23/Modules/FindQt4.cmake:1314 (message):  
> Found unsuitable Qt version “5.9.7” from  
> C:/Users/srolfe/Anaconda3/Library/bin/qmake.exe, this code requires Qt 4.x  
> Call Stack (most recent call first):  
> Common.cmake:28 (find\_package)  
> SuperBuild.cmake:12 (include)  
> CMakeLists.txt:53 (include)

which I resolved this by getting QT 4.8 and setting the QT\_QMAKE\_EXECUTABLE. This took care of the error, but I’m wondering if this issue is expected or if using the requested version of Qt might be causing a problem?

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [December 23, 2022, 2:08pm UTC](https://discourse.slicer.org/t/model-point-count-changing-after-transformation/26736/31 "2022-12-23T14:08:50Z")

</div>

To move forward:

- Make sure you download the source from **`NIRALUser/3DMetricTools`** and not from `juliettepera/3DMetricTools`. See [1]
- Clear build directory
- Attempt to configure setting `Slicer_DIR` first

* * *

[1]: To avoid confusion, we have been trying to reach out to the owner of the “root” fork without success. See [Re-fork repositories to avoid confusion · Issue #10 · NIRALUser/3DMetricTools · GitHub](https://github.com/NIRALUser/3DMetricTools/issues/10)

---

<div class="post-metadata">

**Author:** ![smrolfe](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/smrolfe/32/3659_2.png) [@smrolfe](https://discourse.slicer.org/u/smrolfe)\
**Post date:** [December 23, 2022, 6:42pm UTC](https://discourse.slicer.org/t/model-point-count-changing-after-transformation/26736/32 "2022-12-23T18:42:17Z")

</div>

I rebuilt from **`NIRALUser/3DMetricTools`** , set Slicer\_DIR and Qt5\_DIR before configuring, and its now building correctly.

@jcfr I tested the fix in [ModelToModelDistance: Skip cleaning if corresponding\_point\_to\_point mode is set by jcfr · Pull Request #12 · NIRALUser/3DMetricTools · GitHub](https://github.com/NIRALUser/3DMetricTools/pull/12) and it resolves the issue with the point count changing.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [December 23, 2022, 6:55pm UTC](https://discourse.slicer.org/t/model-point-count-changing-after-transformation/26736/33 "2022-12-23T18:55:11Z")

</div>

Thanks for testing, changes have been integrated in `NIRALUser/3DMetricTools` and fixed extension `ModelToModelDistance` is expected to be published tomorrow for Slicer `5.2` and `Preview`.

@smrolfe If you need the updated extension to be published before that, let me know and I can manually take care of it.

---

<div class="post-metadata">

**Author:** ![smrolfe](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/smrolfe/32/3659_2.png) [@smrolfe](https://discourse.slicer.org/u/smrolfe)\
**Post date:** [December 23, 2022, 7:21pm UTC](https://discourse.slicer.org/t/model-point-count-changing-after-transformation/26736/34 "2022-12-23T19:21:02Z")

</div>

Thanks @jcfr! Tomorrow works for me.

[Previous page](https://discourse.slicer.org/t/model-point-count-changing-after-transformation/26736.md?page=1)
