# vtkWindowedSincPolyDataFilter does NOT translate and scale the position coordinates back to the original coordinate frame

**URL:** <https://discourse.vtk.org/t/vtkwindowedsincpolydatafilter-does-not-translate-and-scale-the-position-coordinates-back-to-the-original-coordinate-frame/7561>\
**Category:** Development\
**Created:** [January 5, 2022, 12:21am UTC](https://discourse.vtk.org/t/vtkwindowedsincpolydatafilter-does-not-translate-and-scale-the-position-coordinates-back-to-the-original-coordinate-frame/7561 "2022-01-05T00:21:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Markus\_Heller](https://discourse.vtk.org/user_avatar/discourse.vtk.org/markus_heller/32/4500_2.png) [@Markus\_Heller](https://discourse.vtk.org/u/Markus_Heller)\
**Post date:** [January 5, 2022, 12:21am UTC](https://discourse.vtk.org/t/vtkwindowedsincpolydatafilter-does-not-translate-and-scale-the-position-coordinates-back-to-the-original-coordinate-frame/7561/1 "2022-01-05T00:21:08Z")

</div>

Hi, I noted a somewhat unexpected behavior when using the [vtkWindowedSincPolyDataFilter](https://vtk.org/doc/nightly/html/classvtkWindowedSincPolyDataFilter.html).

From the description of the filter, I expected that activation of the “NormalizeCoordinatesOn()” option should not affect the coordinates of the output.

However, I just checked with an amended version of the [“SmoothDiscreteMarchingCubes” example (Cxx)](https://kitware.github.io/vtk-examples/site/Cxx/Modelling/SmoothDiscreteMarchingCubes/) that turning NormalizeCoordinatesOn or Off (smoother-\>NormalizeCoordinatesOn(); vs smoother-\>NormalizeCoordinatesOff(); ) does results in a different outcome regarding the scale and position of the data.

I saved the results for both settings to a PLY file and it seems that with NormalizeCoordinatesOn(), the results returned by the filter reamin scaled and centred at the origin (bounds in Y are e.g. -0.282817 to 0.282877) whilst with NormalizeCoordinatesOff() the data appears at the expected location (bounds in Y are -43.4272 to 39.387).

This is on Windows 10, using a vcpkg installation of vtk (vtk:x64-windows, 9.0.3-pv5.9.1#5).

Is there maybe any other setting I might be missing here?  
It would be lovely to get some thoughts on what could be going on here.  
Markus

---

<div class="post-metadata">

**Author:** ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)\
**Post date:** [January 5, 2022, 12:53pm UTC](https://discourse.vtk.org/t/vtkwindowedsincpolydatafilter-does-not-translate-and-scale-the-position-coordinates-back-to-the-original-coordinate-frame/7561/2 "2022-01-05T12:53:33Z")

</div>

Markus, can you send code? I just ran through the filter with the debugger (using the test TestWindowedSincPolyDataFilter2.py), and printed the output and all seemed to work fine.

---

<div class="post-metadata">

**Author:** ![Markus\_Heller](https://discourse.vtk.org/user_avatar/discourse.vtk.org/markus_heller/32/4500_2.png) [@Markus\_Heller](https://discourse.vtk.org/u/Markus_Heller)\
**Post date:** [January 5, 2022, 1:43pm UTC](https://discourse.vtk.org/t/vtkwindowedsincpolydatafilter-does-not-translate-and-scale-the-position-coordinates-back-to-the-original-coordinate-frame/7561/3 "2022-01-05T13:43:55Z")

</div>

Thanks very much for looking into that – it might very well be a user problem though it was not obvious to me what would be the issue.

I’ve attached the code and Cmake list I used.

Markus

[SmoothDiscreteMarchingCubes.7z](https://discourse.vtk.org/uploads/short-url/3vg2TUlKYGM4pPq5TsWrchgQU9a.7z) (2.34 KB)

---

<div class="post-metadata">

**Author:** ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)\
**Post date:** [January 5, 2022, 3:42pm UTC](https://discourse.vtk.org/t/vtkwindowedsincpolydatafilter-does-not-translate-and-scale-the-position-coordinates-back-to-the-original-coordinate-frame/7561/4 "2022-01-05T15:42:37Z")

</div>

Markus everything seems to be fine. Check out the modified code. I’m not sure where you are getting the bounds values. Both files overlap in ParaView etc.

[SmoothDiscreteMarchingCubes.cxx](https://discourse.vtk.org/uploads/short-url/uj8bzRBskngepte685HQcOF4IMG.cxx) (6.03 KB)

---

<div class="post-metadata">

**Author:** ![Markus\_Heller](https://discourse.vtk.org/user_avatar/discourse.vtk.org/markus_heller/32/4500_2.png) [@Markus\_Heller](https://discourse.vtk.org/u/Markus_Heller)\
**Post date:** [January 5, 2022, 4:47pm UTC](https://discourse.vtk.org/t/vtkwindowedsincpolydatafilter-does-not-translate-and-scale-the-position-coordinates-back-to-the-original-coordinate-frame/7561/5 "2022-01-05T16:47:17Z")

</div>

Ah - thanks so much – this is weird though: if I run that very code you provided here I do get bounds as shown below (I saved the PLY files and opened them in ParaView where I got the bounds I mentioned earlier). At least here these files do not overlap.

Any idea what could possibly cause that behavior or suggestions on how to further explore that matter, for dummies?

![image](https://discourse.vtk.org/uploads/default/original/2X/a/a9a3e56214558476e8c52462dbb070010077ee33.png)

---

<div class="post-metadata">

**Author:** ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)\
**Post date:** [January 5, 2022, 5:01pm UTC](https://discourse.vtk.org/t/vtkwindowedsincpolydatafilter-does-not-translate-and-scale-the-position-coordinates-back-to-the-original-coordinate-frame/7561/6 "2022-01-05T17:01:52Z")

</div>

It’s a mystery Markus 🙂 I have no idea, except maybe somehow your code is picking up an old library etc. For reference, this is the output I see:

Discrete MC Bounds(: -42.4242,42.4242, -43.4343,39.3939, -43.4343,42.4242)  
On Bounds(: -42.4135,42.4123, -43.4232,39.4103, -43.4242,42.4144)  
Wrote file: poly\_with\_normalising\_on.ply  
Off Bounds(: -42.4135,42.4123, -43.4272,39.4062, -43.4252,42.4134)  
Wrote file: poly\_with\_normalising\_off.ply  
On Bounds(: -42.4135,42.4123, -43.4232,39.4103, -43.4242,42.4144)

---

<div class="post-metadata">

**Author:** ![Markus\_Heller](https://discourse.vtk.org/user_avatar/discourse.vtk.org/markus_heller/32/4500_2.png) [@Markus\_Heller](https://discourse.vtk.org/u/Markus_Heller)\
**Post date:** [January 5, 2022, 6:35pm UTC](https://discourse.vtk.org/t/vtkwindowedsincpolydatafilter-does-not-translate-and-scale-the-position-coordinates-back-to-the-original-coordinate-frame/7561/7 "2022-01-05T18:35:10Z")

</div>

Ok, thanks – I’ve checked but did not see an obvious issue so, for now, I have downloaded the python wheels for VTK 9.1 and am using these (all good as expected there). I will try the Cxx version again once vtk9.1 is available for vcpkg.

---

<div class="post-metadata">

**Author:** ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)\
**Post date:** [January 6, 2022, 6:34pm UTC](https://discourse.vtk.org/t/vtkwindowedsincpolydatafilter-does-not-translate-and-scale-the-position-coordinates-back-to-the-original-coordinate-frame/7561/8 "2022-01-06T18:34:21Z")

</div>

This was a regression in the filter after its big refactoring (2020-05-25). It was fixed [here](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/7569) (2021-02-02).
