# How to change the default precision of fiducials?

**URL:** <https://discourse.slicer.org/t/how-to-change-the-default-precision-of-fiducials/6157>\
**Category:** Support\
**Created:** [March 15, 2019, 3:43pm UTC](https://discourse.slicer.org/t/how-to-change-the-default-precision-of-fiducials/6157 "2019-03-15T15:43:26Z")\
**Posts on this page:** 14\
**Page:** 1

<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:** [March 15, 2019, 3:43pm UTC](https://discourse.slicer.org/t/how-to-change-the-default-precision-of-fiducials/6157/1 "2019-03-15T15:43:26Z")

</div>

Hello,  
I’d like to add more significant digits to fiducial points when saving to a FCSV file. I can set the values I want using Python, but the Markups table and the output FCSV file show the default precision. I have tried changing the precision under Application Settings-\> Units but this doesn’t impact the fiducial points. Is there a way to do this?

Thank you for your help.  
Sara

---

<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:** [March 18, 2019, 1:55pm UTC](https://discourse.slicer.org/t/how-to-change-the-default-precision-of-fiducials/6157/2 "2019-03-18T13:55:54Z")

</div>

I would think that be default we should change the save precision to be lossless with respect to the datatype (float) in [this code](https://github.com/Slicer/Slicer/blob/a02f79c7c788708a3dccfeb9ff4df76b6a5868be/Libs/MRML/Core/vtkMRMLFiducialListStorageNode.cxx#L498). Currently it looks like we use default precision.

It would be analogous to what’s done [here](https://github.com/Slicer/Slicer/blob/d9cad8916139374f5462e137b878697387874cb8/Libs/vtkTeem/vtkTeemNRRDWriter.cxx#L349-L352) for double.

---

<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:** [March 18, 2019, 2:01pm UTC](https://discourse.slicer.org/t/how-to-change-the-default-precision-of-fiducials/6157/3 "2019-03-18T14:01:31Z")

</div>

I agree, file writing must be lossless.

Should we remove `std::setprecision(17)` from the code referenced above? I guess `itk::NumberToString<double>` generates a string, so setting precision should not be necessary.

---

<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:** [March 18, 2019, 2:06pm UTC](https://discourse.slicer.org/t/how-to-change-the-default-precision-of-fiducials/6157/4 "2019-03-18T14:06:31Z")

</div>

@smrolfe Somewhat related: I have added [PositionStatus](https://github.com/Slicer/Slicer/blob/master/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsNode.h#L112) attribute to markup points. A point can be defined, undefined, or previewed. This can be used for defining landmark points (with name, description, order, etc.) without specifying a position. If a point is undefined then you would need to leave position values empty in the written file (or set position to 0.0 and add a new PositionStatus column).

---

<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:** [March 18, 2019, 3:07pm UTC](https://discourse.slicer.org/t/how-to-change-the-default-precision-of-fiducials/6157/5 "2019-03-18T15:07:28Z")

</div>

> [@lassoan](#):
>
> Should we remove `std::setprecision(17)` from the code referenced above? I guess `itk::NumberToString<double>` generates a string, so setting precision should not be necessary.

Yes, agreed, it’s probably a holdover.

---

<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:** [March 18, 2019, 5:03pm UTC](https://discourse.slicer.org/t/how-to-change-the-default-precision-of-fiducials/6157/6 "2019-03-18T17:03:46Z")

</div>

Thanks @lassoan! I will try out the new PositionStatus attribute.

---

<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:** [March 18, 2019, 5:11pm UTC](https://discourse.slicer.org/t/how-to-change-the-default-precision-of-fiducials/6157/7 "2019-03-18T17:11:28Z")

</div>

Thanks @pieper and @lassoan, I will add this fix and confirm that it solves the issue.

---

<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:** [March 18, 2019, 5:16pm UTC](https://discourse.slicer.org/t/how-to-change-the-default-precision-of-fiducials/6157/8 "2019-03-18T17:16:49Z")

</div>

PositionStatus is only implemented in the markups MRML node (and used in some modules for distinguishing points being previewed vs. finally placed), but we don’t have storage node or GUI support yet. It would be great if you could contribute these.

---

<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:** [March 18, 2019, 5:24pm UTC](https://discourse.slicer.org/t/how-to-change-the-default-precision-of-fiducials/6157/9 "2019-03-18T17:24:34Z")

</div>

Sounds like a good plan. I’ll update you on how it goes.

---

<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:** [March 21, 2019, 12:49am UTC](https://discourse.slicer.org/t/how-to-change-the-default-precision-of-fiducials/6157/10 "2019-03-21T00:49:09Z")

</div>

It looks like the precision was set in the Markups module [here](https://github.com/Slicer/Slicer/blob/a02f79c7c788708a3dccfeb9ff4df76b6a5868be/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsFiducialStorageNode.cxx#L432). I removed the default precision of 3 and formatted the output string using itk::NumberToString, following the [example](https://github.com/Slicer/Slicer/blob/d9cad8916139374f5462e137b878697387874cb8/Libs/vtkTeem/vtkTeemNRRDWriter.cxx#L349-L352) suggested by @pieper.

This is working well for me, so I’ve submitted a pull request for this update [here](https://github.com/Slicer/Slicer/pull/1121).

---

<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:** [March 26, 2019, 6:05pm UTC](https://discourse.slicer.org/t/how-to-change-the-default-precision-of-fiducials/6157/11 "2019-03-26T18:05:15Z")

</div>

It would be helpful to have this fix added to one of the nightly builds soon. Is there any update on the timing of this? Thanks!

---

<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:** [March 26, 2019, 6:22pm UTC](https://discourse.slicer.org/t/how-to-change-the-default-precision-of-fiducials/6157/12 "2019-03-26T18:22:51Z")

</div>

Ah - yes, I’ll do that - thanks for the reminder.

---

<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:** [March 26, 2019, 6:31pm UTC](https://discourse.slicer.org/t/how-to-change-the-default-precision-of-fiducials/6157/13 "2019-03-26T18:31:15Z")

</div>

Okay, done now. Thanks Sara.

---

<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:** [March 26, 2019, 6:52pm UTC](https://discourse.slicer.org/t/how-to-change-the-default-precision-of-fiducials/6157/14 "2019-03-26T18:52:09Z")

</div>

Great news. Thanks @pieper.
