[Insight-developers] Problems with precision with MetaImageIO

Stephen R. Aylward Stephen.Aylward at Kitware.com
Thu Mar 9 12:36:56 EST 2006


Hi

Why not just call the member function to change that variable instead of 
changing its default value and recompiling?

Most of the time we don't want values in metaIO files to be written to 
12 decimal places.   We felt 6 was a good compromise and valid for most 
situations - and by providing the m_DoublePrecision variable and its 
associated member function (SetDoublePrecision) to change the default 
when necessary for a particular application.

Stephen

Kent Williams wrote:
> Vamsi ran into something rather nasty in writing out vectors with 
> MetaImageIO.  In Insight/Utilities/MetaImageIO/metaObject.cxx, floating 
> point values in the MHD file were only written out with 6 digits of 
> precision, which wasn't close enough to support the registration 
> algorithm he's using.
> 
> This patch will fix the problem, and given that the MHDs are free-form 
> text files I can't see what it would harm. Should I just check this into 
> Insight? Do the MetaImageIO mavens at UNC want to consider the idea?
> 
> *** iplFreeware/unpackdir/Insight/Utilities/MetaIO/metaObject.cxx    12 
> Dec 2005 09:00:00 -0600    1.44
> --- iplFreeware/unpackdir/Insight/Utilities/MetaIO/metaObject.cxx    09 
> Mar 2006 09:46:03 -0600   ***************
> *** 24,30 ****
>    m_WriteStream = NULL;
>    m_FileName[0] = '\0';
>    m_Event = NULL;
> !   m_DoublePrecision = 6;
>    }
> 
>  MetaObject::
> --- 24,30 ----
>    m_WriteStream = NULL;
>    m_FileName[0] = '\0';
>    m_Event = NULL;
> !   m_DoublePrecision = 12;
>    }
> 
>  MetaObject::
> ***************
> *** 38,44 ****
>    m_WriteStream = NULL;
>    this->Read(_fileName);
>    m_Event = NULL;
> !   m_DoublePrecision = 6;
>    }
> 
>  MetaObject::
> --- 38,44 ----
>    m_WriteStream = NULL;
>    this->Read(_fileName);
>    m_Event = NULL;
> !   m_DoublePrecision = 12;
>    }
> 
>  MetaObject::
> ***************
> *** 53,59 ****
>    m_FileName[0] = '\0';
>    InitializeEssential(dim);
>    m_Event = NULL;
> !   m_DoublePrecision = 6;
>    }
> 
> 
> --- 53,59 ----
>    m_FileName[0] = '\0';
>    InitializeEssential(dim);
>    m_Event = NULL;
> !   m_DoublePrecision = 12;
>    }
> 
> 
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
> 

-- 
=============================================================
Stephen R. Aylward, Ph.D.
Chief Medical Scientist
Kitware, Inc.
http://www.kitware.com


More information about the Insight-developers mailing list