Skip to content

Commit 99d527a

Browse files
authored
Merge pull request #119 from phcerdan/fix_test_rieszMultiply
BUG: Fix wrong expected result on test of RieszRotationMatrix
2 parents 0decdff + 9838770 commit 99d527a

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

test/itkRieszRotationMatrixTest.cxx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,24 +129,37 @@ runRieszRotationMatrixInterfaceWithRieszFrequencyFilterBankGeneratorTest()
129129
std::cout << images[i]->GetLargestPossibleRegion() << std::endl;
130130
}
131131

132+
bool multiplyWithSomethingPassed = true;
132133
std::vector<PixelType> inputVector(M, 0);
133134
inputVector[0] = 1;
134135
inputVector[1] = 2;
135136
inputVector[2] = 3;
136137
auto vectorRotated = S.MultiplyWithVector(inputVector);
138+
std::vector<PixelType> expectedMultiplyResult(M, 0);
139+
expectedMultiplyResult[0] = 3;
140+
expectedMultiplyResult[1] = -2;
141+
expectedMultiplyResult[2] = 1;
142+
for (unsigned int i = 0; i < M; ++i)
143+
{
144+
if(!itk::Math::FloatAlmostEqual(vectorRotated[i], expectedMultiplyResult[i]))
145+
{
146+
std::cout << "vectorRotated not equal!: ";
147+
std::cout << vectorRotated[i] << " != " << expectedMultiplyResult[i] << std::endl;
148+
multiplyWithSomethingPassed = false;
149+
}
150+
}
137151

138152
itk::VariableSizeMatrix<PixelType> inputColumnMatrix(M, 1);
139153
inputColumnMatrix.GetVnlMatrix()(0,0) = 1;
140154
inputColumnMatrix.GetVnlMatrix()(1,0) = 2;
141155
inputColumnMatrix.GetVnlMatrix()(2,0) = 3;
142156
auto columnMatrixRotated = S.MultiplyWithColumnMatrix(inputColumnMatrix);
143-
bool multiplyWithSomethingPassed = true;
144157
for (unsigned int i = 0; i < M; ++i)
145158
{
146-
if(!itk::Math::FloatAlmostEqual(inputVector[i], columnMatrixRotated.GetVnlMatrix()(i, 0)))
159+
if(!itk::Math::FloatAlmostEqual(columnMatrixRotated.GetVnlMatrix()(i, 0), expectedMultiplyResult[i]))
147160
{
148-
std::cout << "Not Equal!: ";
149-
std::cout << inputVector[i] << " != " << columnMatrixRotated.GetVnlMatrix()(i,0) << std::endl;
161+
std::cout << "columnMatrixRotated not Equal!: ";
162+
std::cout << columnMatrixRotated.GetVnlMatrix()(i,0) << " != " << expectedMultiplyResult[i] << std::endl;
150163
multiplyWithSomethingPassed = false;
151164
}
152165
}

0 commit comments

Comments
 (0)