From 59c5464bdb7f87a063cc6d790e7499b4cd6a95fa Mon Sep 17 00:00:00 2001 From: Simon Rit Date: Fri, 27 Sep 2024 09:52:53 +0200 Subject: [PATCH] BUG: Avoid reading errors in tests by first closing the written file --- test/rtkcyclicdeformationtest.cxx | 1 + test/rtkfourdconjugategradienttest.cxx | 1 + test/rtkfourdroostertest.cxx | 1 + test/rtkfourdsarttest.cxx | 3 +-- test/rtkmotioncompensatedfdktest.cxx | 1 + test/rtkselectoneprojpercycletest.cxx | 1 + test/rtkwarpfourdtoprojectionstacktest.cxx | 1 + test/rtkwarpprojectionstacktofourdtest.cxx | 1 + 8 files changed, 8 insertions(+), 2 deletions(-) diff --git a/test/rtkcyclicdeformationtest.cxx b/test/rtkcyclicdeformationtest.cxx index 5f3c8f2b5..6b14aca52 100644 --- a/test/rtkcyclicdeformationtest.cxx +++ b/test/rtkcyclicdeformationtest.cxx @@ -132,6 +132,7 @@ main(int, char **) std::string signalFileName = "signal_CyclicDeformation.txt"; std::ofstream signalFile(signalFileName.c_str()); signalFile << "0.3" << std::endl; + signalFile.close(); // Set the forward and back projection filters to be used using CyclicDeformationType = rtk::CyclicDeformationImageFilter; diff --git a/test/rtkfourdconjugategradienttest.cxx b/test/rtkfourdconjugategradienttest.cxx index b2ed2534c..212ce5fbc 100644 --- a/test/rtkfourdconjugategradienttest.cxx +++ b/test/rtkfourdconjugategradienttest.cxx @@ -211,6 +211,7 @@ main(int, char **) // Signal signalFile << (noProj % 8) / 8. << std::endl; } + signalFile.close(); // Ground truth auto * Volumes = new VolumeType::Pointer[fourDSize[3]]; diff --git a/test/rtkfourdroostertest.cxx b/test/rtkfourdroostertest.cxx index ef3abcf18..bfdad93b6 100644 --- a/test/rtkfourdroostertest.cxx +++ b/test/rtkfourdroostertest.cxx @@ -215,6 +215,7 @@ main(int, char **) // Signal signalFile << (noProj % 8) / 8. << std::endl; } + signalFile.close(); // Create a vector field and its (very rough) inverse using IteratorType = itk::ImageRegionIteratorWithIndex; diff --git a/test/rtkfourdsarttest.cxx b/test/rtkfourdsarttest.cxx index fb47de20c..27e3aa2b9 100644 --- a/test/rtkfourdsarttest.cxx +++ b/test/rtkfourdsarttest.cxx @@ -212,8 +212,7 @@ main(int, char **) // Signal signalFile << (noProj % 8) / 8. << std::endl; } - - // pasteFilter->GetOutput()->Print(std::cout); + signalFile.close(); // Ground truth auto * Volumes = new VolumeType::Pointer[fourDSize[3]]; diff --git a/test/rtkmotioncompensatedfdktest.cxx b/test/rtkmotioncompensatedfdktest.cxx index ee44aa971..a87804a65 100644 --- a/test/rtkmotioncompensatedfdktest.cxx +++ b/test/rtkmotioncompensatedfdktest.cxx @@ -160,6 +160,7 @@ main(int, char **) // Signal signalFile << (noProj % 8) / 8. << std::endl; } + signalFile.close(); // Create vector field using DVFPixelType = itk::Vector; diff --git a/test/rtkselectoneprojpercycletest.cxx b/test/rtkselectoneprojpercycletest.cxx index d5fd0a627..11a0d1ad9 100644 --- a/test/rtkselectoneprojpercycletest.cxx +++ b/test/rtkselectoneprojpercycletest.cxx @@ -140,6 +140,7 @@ main(int, char **) // Signal signalFile << (noProj % 8) / 8. << std::endl; } + signalFile.close(); // Select using SelectionType = rtk::SelectOneProjectionPerCycleImageFilter; diff --git a/test/rtkwarpfourdtoprojectionstacktest.cxx b/test/rtkwarpfourdtoprojectionstacktest.cxx index 13d47340d..5e2f213c0 100644 --- a/test/rtkwarpfourdtoprojectionstacktest.cxx +++ b/test/rtkwarpfourdtoprojectionstacktest.cxx @@ -247,6 +247,7 @@ main(int, char **) // Signal signalFile << (noProj % 8) / 8. << std::endl; } + signalFile.close(); // Create a vector field and its (very rough) inverse using IteratorType = itk::ImageRegionIteratorWithIndex; diff --git a/test/rtkwarpprojectionstacktofourdtest.cxx b/test/rtkwarpprojectionstacktofourdtest.cxx index 0ce59e416..435ed1e87 100644 --- a/test/rtkwarpprojectionstacktofourdtest.cxx +++ b/test/rtkwarpprojectionstacktofourdtest.cxx @@ -252,6 +252,7 @@ main(int, char **) // Signal signalFile << (noProj % 8) / 8. << std::endl; } + signalFile.close(); // Create a vector field and its (very rough) inverse using IteratorType = itk::ImageRegionIteratorWithIndex;