Hi there,
I am using ITK as a library in my code and I experience a different rounding behaviour in debug and release when writing an image to disk.
Basically I create a 3D image by converting it from vtk
…
ImageType::Pointer image = VTKITKUtils::toITk (vtkVolume);
// at this point ‘image’ has spacing (1.32812500000, 1.32812500000, 1.00000000000)
// some processing
// Add the MetaImage format to the writer
itk::MetaImageIO::Pointer metaWriter = itk::MetaImageIO::New ();
metaWriter->SetDoublePrecision (6); // write with lower precision to make output backwards compatible
WriterType::Pointer writer = WriterType::New ();
writer->SetImageIO (metaWriter);
writer->SetInput (caster->GetOutput ());
writer->SetFileName (inputFileName.toStdString ());
// … other preprocessing steps, but I never change the spacing
writer->Update (); # write down to disk
// in debug mode the spacing of the written image is: (1.32813, 1.32813, 1.00000)
// in release mode the spacing of the written image is: (1.32812, 1.32812, 1.00000)
// of course any post-processing at this point will differ in debug and release
Thank you for any help in explaining this behaviour.
My development environment
OS: Windows 10 Enterprise
IDE: Microsoft Visual Studio Enterprise 2019 Version 16.4.2
ITK: itk-5.1.0
platform x64
Regards,
Marco