How to change the default precision of fiducials?


(Sara Rolfe) #1

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


(Steve Pieper) #2

I would think that be default we should change the save precision to be lossless with respect to the datatype (float) in this code. Currently it looks like we use default precision.

It would be analogous to what’s done here for double.


(Andras Lasso) #3

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.


(Andras Lasso) #4

@smrolfe Somewhat related: I have added PositionStatus 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).


(Steve Pieper) #5

Yes, agreed, it’s probably a holdover.


(Sara Rolfe) #6

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


(Sara Rolfe) #7

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


(Andras Lasso) #8

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.


(Sara Rolfe) #9

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


(Sara Rolfe) #10

It looks like the precision was set in the Markups module here. I removed the default precision of 3 and formatted the output string using itk::NumberToString, following the example suggested by @pieper.

This is working well for me, so I’ve submitted a pull request for this update here.