Skip to content
Snippets Groups Projects
Commit 8216b8fe authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

TEST: Test that interp/extrap settings are propagated to shadowvolume instances

parent 30cc62f9
No related branches found
No related tags found
1 merge request!42RF: Improve thread-safety of `NEWIMAGE::volume` class
Pipeline #26666 skipped
#define EXPOSE_TREACHEROUS
#include "newimage/newimageall.h" #include "newimage/newimageall.h"
#include "utils/threading.h" #include "utils/threading.h"
#include <stdlib.h> #include <stdlib.h>
...@@ -132,3 +133,56 @@ BOOST_FIXTURE_TEST_CASE(test_splinterp, F) ...@@ -132,3 +133,56 @@ BOOST_FIXTURE_TEST_CASE(test_splinterp, F)
testvol[t].interpolate(5, 5, 5)); testvol[t].interpolate(5, 5, 5));
} }
} }
// test that changes to interp/extrap settings on a
// 4D volume are propagated to its ShadowVolume instances
BOOST_FIXTURE_TEST_CASE(test_interp_settings_delegated, F)
{
testvol.setinterpolationmethod(nearestneighbour);
testvol.setextrapolationmethod(mirror);
testvol.setpadvalue(12345);
testvol.setsplineorder(5);
testvol.setextrapolationvalidity(false, true, false);
for (int i = 0; i < tsz; i++) {
BOOST_CHECK(testvol[i].getinterpolationmethod() == nearestneighbour);
BOOST_CHECK(testvol[i].getextrapolationmethod() == mirror);
BOOST_CHECK(testvol[i].getpadvalue() == 12345);
BOOST_CHECK(testvol[i].getsplineorder() == 5);
std::vector<bool> expvalidity = {false, true, false};
BOOST_CHECK(testvol[i].getextrapolationvalidity() == expvalidity);
}
testvol.setinterpolationmethod(sinc);
testvol.setextrapolationmethod(periodic);
testvol.setpadvalue(54321);
testvol.setsplineorder(2);
testvol.setextrapolationvalidity(true, false, true);
for (int i = 0; i < tsz; i++) {
BOOST_CHECK(testvol[i].getinterpolationmethod() == sinc);
BOOST_CHECK(testvol[i].getextrapolationmethod() == periodic);
BOOST_CHECK(testvol[i].getpadvalue() == 54321);
BOOST_CHECK(testvol[i].getsplineorder() == 2);
std::vector<bool> expvalidity = {true, false, true};
BOOST_CHECK(testvol[i].getextrapolationvalidity() == expvalidity);
}
// Force the ShadowVolume cache to be cleared
testvol.setinterpolationmethod(spline);
testvol.invalidateSplines();
// make sure settings still the same
for (int i = 0; i < tsz; i++) {
BOOST_CHECK(testvol[i].getinterpolationmethod() == spline);
BOOST_CHECK(testvol[i].getextrapolationmethod() == periodic);
BOOST_CHECK(testvol[i].getpadvalue() == 54321);
BOOST_CHECK(testvol[i].getsplineorder() == 2);
std::vector<bool> expvalidity = {true, false, true};
BOOST_CHECK(testvol[i].getextrapolationvalidity() == expvalidity);
}
// Attempting to change settings
// on a SV should error
BOOST_CHECK_THROW(
testvol[0].setinterpolationmethod(trilinear),
NEWMAT::Exception);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment