Skip to content

Commit 1815249

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 9ffc66b commit 1815249

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>
@@ -672,7 +673,8 @@ VoxBoCUBImageIO::WriteImageInformation()
672673
<< std::endl;
673674

674675
// Write the spacing
675-
header << m_VB_SPACING << ":\t" << m_Spacing[0] << '\t' << m_Spacing[1] << '\t' << m_Spacing[2] << std::endl;
676+
header << m_VB_SPACING << ":\t" << itk::ConvertNumberToString(m_Spacing[0]) << '\t'
677+
<< itk::ConvertNumberToString(m_Spacing[1]) << '\t' << itk::ConvertNumberToString(m_Spacing[2]) << std::endl;
676678

677679
// Write the origin (have to convert to bytes)
678680

0 commit comments

Comments
 (0)