[Insight-developers] precision of meta data floating point values in NRRD format

Simon Warfield simon.warfield at childrens.harvard.edu
Sat Nov 28 12:50:31 EST 2009


When writing NRRD format images, some numerical precision is currently 
lost when writing out values of the origin and space directions.  The 
NrrdIO utility has some functionality to maintain precision, in 
accessors.c, that does this:
int _nrrdSprintFL(char *s, const FL *v) {
  return airSinglePrintf(NULL, s, "%.8g", (double)(*v)); }
int _nrrdSprintDB(char *s, const DB *v) {
  return airSinglePrintf(NULL, s, "%.17g", *v); }

However, these routines are not used when writing out some of the meta data.
The attached version of write.c is patched to write out this double 
precision meta data to 17 decimal places.
This better represents the true precision of the meta data.

-- 
Simon 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: write.c
Type: text/x-csrc
Size: 30033 bytes
Desc: not available
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20091128/944d352b/attachment.c>


More information about the Insight-developers mailing list