Mercurial > hg > orthanc-stone
comparison UnitTestsSources/UnitTestsMain.cpp @ 1167:ad4e21df4e40 broker
enriching OrthancStone::StoneInitialize()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 20 Nov 2019 10:55:44 +0100 |
parents | 2d69b8bee484 |
children | 1644de437a7b |
comparison
equal
deleted
inserted
replaced
1165:4d97f532f1e0 | 1167:ad4e21df4e40 |
---|---|
23 | 23 |
24 #include "../Framework/Deprecated/Layers/FrameRenderer.h" | 24 #include "../Framework/Deprecated/Layers/FrameRenderer.h" |
25 #include "../Framework/Deprecated/Toolbox/DownloadStack.h" | 25 #include "../Framework/Deprecated/Toolbox/DownloadStack.h" |
26 #include "../Framework/Deprecated/Toolbox/MessagingToolbox.h" | 26 #include "../Framework/Deprecated/Toolbox/MessagingToolbox.h" |
27 #include "../Framework/Deprecated/Toolbox/OrthancSlicesLoader.h" | 27 #include "../Framework/Deprecated/Toolbox/OrthancSlicesLoader.h" |
28 #include "../Framework/StoneInitialization.h" | |
28 #include "../Framework/Toolbox/FiniteProjectiveCamera.h" | 29 #include "../Framework/Toolbox/FiniteProjectiveCamera.h" |
29 #include "../Framework/Toolbox/GeometryToolbox.h" | 30 #include "../Framework/Toolbox/GeometryToolbox.h" |
30 #include "../Framework/Volumes/ImageBuffer3D.h" | 31 #include "../Framework/Volumes/ImageBuffer3D.h" |
31 #include "../Platforms/Generic/OracleWebService.h" | 32 #include "../Platforms/Generic/OracleWebService.h" |
32 | 33 |
694 ASSERT_EQ(1, (int) OrthancStone::VolumeProjection_Coronal); | 695 ASSERT_EQ(1, (int) OrthancStone::VolumeProjection_Coronal); |
695 ASSERT_EQ(2, (int) OrthancStone::VolumeProjection_Sagittal); | 696 ASSERT_EQ(2, (int) OrthancStone::VolumeProjection_Sagittal); |
696 | 697 |
697 for (int p = 0; p < 3; p++) | 698 for (int p = 0; p < 3; p++) |
698 { | 699 { |
700 printf("=========== %d\n", p); | |
701 | |
699 OrthancStone::VolumeProjection projection = (OrthancStone::VolumeProjection) p; | 702 OrthancStone::VolumeProjection projection = (OrthancStone::VolumeProjection) p; |
700 const OrthancStone::CoordinateSystem3D& s = g.GetProjectionGeometry(projection); | 703 const OrthancStone::CoordinateSystem3D& s = g.GetProjectionGeometry(projection); |
701 | 704 |
702 ASSERT_THROW(g.GetProjectionSlice(projection, g.GetProjectionDepth(projection)), Orthanc::OrthancException); | 705 ASSERT_THROW(g.GetProjectionSlice(projection, g.GetProjectionDepth(projection)), Orthanc::OrthancException); |
703 | 706 |
704 for (unsigned int i = 0; i < g.GetProjectionDepth(projection); i++) | 707 for (unsigned int i = 0; i < g.GetProjectionDepth(projection); i++) |
705 { | 708 { |
709 printf("------------- %d\n", i); | |
710 | |
706 OrthancStone::CoordinateSystem3D plane = g.GetProjectionSlice(projection, i); | 711 OrthancStone::CoordinateSystem3D plane = g.GetProjectionSlice(projection, i); |
707 | 712 |
708 ASSERT_TRUE(IsEqualVector(plane.GetOrigin(), s.GetOrigin() + static_cast<double>(i) * | 713 ASSERT_TRUE(IsEqualVector(plane.GetOrigin(), s.GetOrigin() + static_cast<double>(i) * |
709 s.GetNormal() * g.GetVoxelDimensions(projection)[2])); | 714 s.GetNormal() * g.GetVoxelDimensions(projection)[2])); |
710 ASSERT_TRUE(IsEqualVector(plane.GetAxisX(), s.GetAxisX())); | 715 ASSERT_TRUE(IsEqualVector(plane.GetAxisX(), s.GetAxisX())); |
712 | 717 |
713 unsigned int slice; | 718 unsigned int slice; |
714 OrthancStone::VolumeProjection q; | 719 OrthancStone::VolumeProjection q; |
715 ASSERT_TRUE(g.DetectSlice(q, slice, plane)); | 720 ASSERT_TRUE(g.DetectSlice(q, slice, plane)); |
716 ASSERT_EQ(projection, q); | 721 ASSERT_EQ(projection, q); |
717 ASSERT_EQ(i, slice); | 722 ASSERT_EQ(i, slice); |
718 } | 723 } |
719 } | 724 } |
720 } | 725 } |
721 | 726 |
727 | |
728 TEST(LinearAlgebra, ParseVectorLocale) | |
729 { | |
730 OrthancStone::Vector v; | |
731 | |
732 ASSERT_TRUE(OrthancStone::LinearAlgebra::ParseVector(v, "1.2")); | |
733 ASSERT_EQ(1u, v.size()); | |
734 ASSERT_FLOAT_EQ(1.2f, v[0]); | |
735 | |
736 ASSERT_TRUE(OrthancStone::LinearAlgebra::ParseVector(v, "-1.2e+2")); | |
737 ASSERT_EQ(1u, v.size()); | |
738 ASSERT_FLOAT_EQ(-120.0f, v[0]); | |
739 | |
740 ASSERT_TRUE(OrthancStone::LinearAlgebra::ParseVector(v, "-1e-2\\2")); | |
741 ASSERT_EQ(2u, v.size()); | |
742 ASSERT_FLOAT_EQ(-0.01f, v[0]); | |
743 ASSERT_FLOAT_EQ(2.0f, v[1]); | |
744 | |
745 ASSERT_TRUE(OrthancStone::LinearAlgebra::ParseVector(v, "1.3671875\\1.3671875")); | |
746 ASSERT_EQ(2u, v.size()); | |
747 ASSERT_FLOAT_EQ(1.3671875, v[0]); | |
748 ASSERT_FLOAT_EQ(1.3671875, v[1]); | |
749 } | |
750 | |
751 | |
722 int main(int argc, char **argv) | 752 int main(int argc, char **argv) |
723 { | 753 { |
724 Orthanc::Logging::Initialize(); | 754 OrthancStone::StoneInitialize(); |
725 Orthanc::Logging::EnableInfoLevel(true); | |
726 | 755 |
727 ::testing::InitGoogleTest(&argc, argv); | 756 ::testing::InitGoogleTest(&argc, argv); |
728 int result = RUN_ALL_TESTS(); | 757 int result = RUN_ALL_TESTS(); |
729 | 758 |
730 Orthanc::Logging::Finalize(); | 759 OrthancStone::StoneFinalize(); |
731 | 760 |
732 return result; | 761 return result; |
733 } | 762 } |