@@ -111,8 +111,35 @@ class BMTest {
111111 contentResampling3d->GetWarped (),
112112 mask3d.get ()
113113 ));
114+
115+ // Create 4D variants of the 3D reference and warped images: volume 0 holds the same data,
116+ // while the extra volumes are filled with values that must not influence the matching.
117+ // The mask stays allocated per volume, mirroring the backward content of a symmetric
118+ // registration with a 4D floating image
119+ vector<NiftiImage::dim_t > dim4d{ size, size, size, 3 };
120+ NiftiImage reference4d (dim4d, NIFTI_TYPE_FLOAT32 );
121+ NiftiImage warped4d (dim4d, NIFTI_TYPE_FLOAT32 );
122+ const size_t volumeSize = reference3d.nVoxels ();
123+ const auto warped3dPtr = contentResampling3d->GetWarped ().data ();
124+ auto ref4dPtr = reference4d.data ();
125+ auto warped4dPtr = warped4d.data ();
126+ for (size_t i = 0 ; i < volumeSize; ++i) {
127+ ref4dPtr[i] = static_cast <float >(ref3dPtr[i]);
128+ warped4dPtr[i] = static_cast <float >(warped3dPtr[i]);
129+ }
130+ for (size_t i = volumeSize; i < reference4d.nVoxels (); ++i) {
131+ ref4dPtr[i] = 1000 .f * distr (gen);
132+ warped4dPtr[i] = 1000 .f * distr (gen);
133+ }
114134 contentResampling3d.release ();
115135
136+ testData.emplace_back (TestData (
137+ " BlockMatching 4D" ,
138+ std::move (reference4d),
139+ std::move (warped4d),
140+ mask3d.get ()
141+ ));
142+
116143 for (auto && data : testData) {
117144 // Get the test data
118145 auto && [testName, reference, warped, mask] = data;
0 commit comments