Skip to content

Commit da68289

Browse files
hjmjohnsonclaude
andcommitted
ENH: Use ConvertNumberToString for voxel spacing in VoxBoCUB IO
m_Spacing[] values (double) were written to the CUB text header with default stream precision (6 significant digits), silently truncating sub-millimeter or high-precision spacing values. Replace with itk::ConvertNumberToString() for shortest-round-trip serialization. See: #3249 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f682853 commit da68289

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Modules/Nonunit/Review/src/itkVoxBoCUBImageIO.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "itkIOCommon.h"
2020
#include "itkMetaDataObject.h"
2121
#include "itkByteSwapper.h"
22+
#include "itkNumberToString.h"
2223
#include "itksys/SystemTools.hxx"
2324
#include <iostream>
2425
#include <sstream>
@@ -668,7 +669,8 @@ VoxBoCUBImageIO::WriteImageInformation()
668669
<< std::endl;
669670

670671
// Write the spacing
671-
header << m_VB_SPACING << ":\t" << m_Spacing[0] << '\t' << m_Spacing[1] << '\t' << m_Spacing[2] << std::endl;
672+
header << m_VB_SPACING << ":\t" << ConvertNumberToString(m_Spacing[0]) << '\t' << ConvertNumberToString(m_Spacing[1])
673+
<< '\t' << ConvertNumberToString(m_Spacing[2]) << std::endl;
672674

673675
// Write the origin (have to convert to bytes)
674676

0 commit comments

Comments
 (0)