# FPS deteriation after prolonged fiducial registration

**URL:** <https://discourse.slicer.org/t/fps-deteriation-after-prolonged-fiducial-registration/15816>\
**Category:** Support\
**Tags:** registration\
**Created:** [February 3, 2021, 2:22pm UTC](https://discourse.slicer.org/t/fps-deteriation-after-prolonged-fiducial-registration/15816 "2021-02-03T14:22:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![WoutertenBolscher](https://avatars.discourse-cdn.com/v4/letter/w/ba9def/32.png) [@WoutertenBolscher](https://discourse.slicer.org/u/WoutertenBolscher)\
**Post date:** [February 3, 2021, 2:22pm UTC](https://discourse.slicer.org/t/fps-deteriation-after-prolonged-fiducial-registration/15816/1 "2021-02-03T14:22:07Z")

</div>

Hi everyone,

Currently, I am working on a tracked phantom and tool setup. I load the segmented phantom model and 4 associated registration points, and start receiving transforms via OpenIGTLink interface. Then the received sensor positions are continuously registered using the Fiducial Registration Wizard (rigid transform, automatic point matching and auto-update). The loaded model is attached to the resulting transform and thus moves accordingly in the 3D view.  
I am working on a HP z2 mini g4 running on Windows 10 with Slicer version: 4.11.  
Expected behavior: I would expected the framerate to stay constant at the initial +/- 30 fps.  
Actual behavior: A gradual decrease in framerate is observed, where fps is halved every 15-20 minutes.  
I have tried downsizing the model or setting manual point matching, however both show the same framerate drop. Furthermore, when the FRW is stopped the framerate instantly recovers to the initial 30 fps, and stays there until the FRW is started again. In that case it will directly drop to the fps of before switching off the FRW and continue a gradual decrease from there.

What could be the cause of the framerate drop and what could be done to prevent it from happening?

Thanks for any help!

Greetings,

Wouter ten Bolscher

---

<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:** [February 3, 2021, 9:04pm UTC](https://discourse.slicer.org/t/fps-deteriation-after-prolonged-fiducial-registration/15816/2 "2021-02-03T21:04:00Z")

</div>

Thanks for the detailed report. It does sound like some kind of resource management issue.

Probably the best is to find a way to profile the code and see where it is spending time and how that changes over time and with the wizard turned on and off. On linux you could use perf and on mac you can use Instruments for this, but I’m not sure what’s suggested on Windows. I’ll bet @lassoan knows though.

---

<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:** [February 5, 2021, 4:22am UTC](https://discourse.slicer.org/t/fps-deteriation-after-prolonged-fiducial-registration/15816/3 "2021-02-05T04:22:26Z")

</div>

There should be no need to keep fiducial registration wizard running. Once you computed the transform between the patient image and the patient-attached marker, that transform should remain constant. Can you share your scene so that we have a better idea of your setup?

---

<div class="post-metadata">

**Author:** ![WoutertenBolscher](https://avatars.discourse-cdn.com/v4/letter/w/ba9def/32.png) [@WoutertenBolscher](https://discourse.slicer.org/u/WoutertenBolscher)\
**Post date:** [February 8, 2021, 12:48pm UTC](https://discourse.slicer.org/t/fps-deteriation-after-prolonged-fiducial-registration/15816/4 "2021-02-08T12:48:30Z")

</div>

Thanks for the quick responses. I’ve attached a link to the scene.  
We use continuous FRW to update the pose of the segmented phantom. Two 5DOF sensors are embedded in the phantom and based on this 5DOF information 2 points per sensor are defined (on x distance from sensor position along the z-axis, see code below), resulting in a total of 4 points. We assume the relationship between the sensors to be rigid and therefore the 4 points (when not placed ambiguously) can be used for 6DOF registration of the phantom.  
We could circumvent use of continuous FRW by sensor fusion of the two sensors, resulting in one 6DOF continuously updated transform, which in turn could be transformed to CT coordinates with a constant registration transform. However, to my knowledge there is no easy way of 5DOF-6DOF sensor fusion in Slicer, right?  
In short, we use the automatic update option in the FRW to solve a sensor fusion problem.

> **[2021-02-08-Scene.mrml](https://drive.google.com/file/d/1jLxNV_Tm6zAOuUBSJ3gtySkGhNZjuAl_/view?usp=sharing)**
>
> Google Drive file.

def TransformMarkups(caller, event):  
M\_SensToEM = caller.GetMatrixTransformToParent()  
p1 = M\_SensToEM.MultiplyPoint([0, 0, -10, 1])  
p2 = M\_SensToEM.MultiplyPoint([0, 0, 10, 1])  
markupsNode\_EM.SetNthFiducialPosition(0, p1[0], p1[1], p1[2])  
markupsNode\_EM.SetNthFiducialPosition(1, p2[0], p2[1], p2[2])

---

<div class="post-metadata">

**Author:** ![WoutertenBolscher](https://avatars.discourse-cdn.com/v4/letter/w/ba9def/32.png) [@WoutertenBolscher](https://discourse.slicer.org/u/WoutertenBolscher)\
**Post date:** [February 15, 2021, 2:09pm UTC](https://discourse.slicer.org/t/fps-deteriation-after-prolonged-fiducial-registration/15816/5 "2021-02-15T14:09:34Z")

</div>

Best @lassoan,

Did you have a chance to look into our problem or do you need any additional information? Hope to hear your take on our issue.

Kind regards

---

<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:** [February 16, 2021, 12:15am UTC](https://discourse.slicer.org/t/fps-deteriation-after-prolonged-fiducial-registration/15816/7 "2021-02-16T00:15:41Z")

</div>

I’ve managed to reproduce and [fix the issue](https://github.com/SlicerIGT/SlicerIGT/commit/39dfcfa3c83e07981054b6e2164c5f26552b93bb). It’ll be available tomorrow: if you use Slicer Stable Release then reinstall SlicerIGT extension; if you use Slicer Preview Release then upgrade to the latest Slicer Preview Release.

---

<div class="post-metadata">

**Author:** ![WoutertenBolscher](https://avatars.discourse-cdn.com/v4/letter/w/ba9def/32.png) [@WoutertenBolscher](https://discourse.slicer.org/u/WoutertenBolscher)\
**Post date:** [February 16, 2021, 8:25am UTC](https://discourse.slicer.org/t/fps-deteriation-after-prolonged-fiducial-registration/15816/8 "2021-02-16T08:25:15Z")

</div>

Great, thank you so much @lassoan! Amazing to see this level of support on the 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:** [February 17, 2021, 3:12am UTC](https://discourse.slicer.org/t/fps-deteriation-after-prolonged-fiducial-registration/15816/9 "2021-02-17T03:12:40Z")

</div>

Thank you. It would be great if you could write a short post in the “Success stories” category about what you do and how Slicer and the community helped you to achieve your goals. A few sentences (and a nice image, if there is anything that you can share) would suffice. It would help us in getting more grant funding.

> **[Success stories](https://discourse.slicer.org/c/community/success-stories/29)**
>
> This is the place where you can share how Slicer helped your work. Describe your project and how Slicer was useful in achieving your goal. Include reference to any publication(s) and if possible also add a few nice images or links to videos.
