comparison UnitTestsSources/VolumeRenderingTests.cpp @ 1788:4fd065ad1fc0

more mpr rendering tests
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 15 May 2021 12:17:17 +0200
parents 42a2880d690f
children 757987cb5a68
comparison
equal deleted inserted replaced
1787:6e8105942146 1788:4fd065ad1fc0
855 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 0)); 855 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 0));
856 ASSERT_FLOAT_EQ(25, GetPixelValue(*rendered, 0, 1)); 856 ASSERT_FLOAT_EQ(25, GetPixelValue(*rendered, 0, 1));
857 ASSERT_FLOAT_EQ(50, GetPixelValue(*rendered, 0, 2)); 857 ASSERT_FLOAT_EQ(50, GetPixelValue(*rendered, 0, 2));
858 } 858 }
859 859
860 {
861 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 2),
862 OrthancStone::LinearAlgebra::CreateVector(-1, 0, 0),
863 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0));
864
865 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer(
866 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Sagittal, axial, cuttingPlane, static_cast<SlicerType>(mode)));
867
868 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 1, 3, true));
869 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 0));
870 ASSERT_FLOAT_EQ(25, GetPixelValue(*rendered, 0, 1));
871 ASSERT_FLOAT_EQ(50, GetPixelValue(*rendered, 0, 2));
872 }
873
874 {
875 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 2),
876 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0),
877 OrthancStone::LinearAlgebra::CreateVector(0, -1, 0));
878
879 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer(
880 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Sagittal, axial, cuttingPlane, static_cast<SlicerType>(mode)));
881
882 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 1, 3, true));
883 ASSERT_FLOAT_EQ(50, GetPixelValue(*rendered, 0, 0));
884 ASSERT_FLOAT_EQ(25, GetPixelValue(*rendered, 0, 1));
885 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 2));
886 }
887
888 {
889 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 2),
890 OrthancStone::LinearAlgebra::CreateVector(-1, 0, 0),
891 OrthancStone::LinearAlgebra::CreateVector(0, -1, 0));
892
893 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer(
894 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Sagittal, axial, cuttingPlane, static_cast<SlicerType>(mode)));
895
896 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 1, 3, true));
897 ASSERT_FLOAT_EQ(50, GetPixelValue(*rendered, 0, 0));
898 ASSERT_FLOAT_EQ(25, GetPixelValue(*rendered, 0, 1));
899 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 2));
900 }
901
860 for (double z = -1; z < 4; z += 4) // z in { -1, 3 }, out of volume 902 for (double z = -1; z < 4; z += 4) // z in { -1, 3 }, out of volume
861 { 903 {
862 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, z), 904 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, z),
863 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0), 905 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0),
864 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0)); 906 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0));
911 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 0)); 953 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 0));
912 ASSERT_FLOAT_EQ(25, GetPixelValue(*rendered, 1, 0)); 954 ASSERT_FLOAT_EQ(25, GetPixelValue(*rendered, 1, 0));
913 ASSERT_FLOAT_EQ(50, GetPixelValue(*rendered, 2, 0)); 955 ASSERT_FLOAT_EQ(50, GetPixelValue(*rendered, 2, 0));
914 } 956 }
915 957
958 {
959 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 2),
960 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0),
961 OrthancStone::LinearAlgebra::CreateVector(0, -1, 0));
962
963 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer(
964 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Coronal, axial, cuttingPlane, static_cast<SlicerType>(mode)));
965
966 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 3, 1, true));
967 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 0));
968 ASSERT_FLOAT_EQ(25, GetPixelValue(*rendered, 1, 0));
969 ASSERT_FLOAT_EQ(50, GetPixelValue(*rendered, 2, 0));
970 }
971
972 {
973 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 2),
974 OrthancStone::LinearAlgebra::CreateVector(-1, 0, 0),
975 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0));
976
977 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer(
978 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Coronal, axial, cuttingPlane, static_cast<SlicerType>(mode)));
979
980 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 3, 1, true));
981 ASSERT_FLOAT_EQ(50, GetPixelValue(*rendered, 0, 0));
982 ASSERT_FLOAT_EQ(25, GetPixelValue(*rendered, 1, 0));
983 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 2, 0));
984 }
985
986 {
987 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 2),
988 OrthancStone::LinearAlgebra::CreateVector(-1, 0, 0),
989 OrthancStone::LinearAlgebra::CreateVector(0, -1, 0));
990
991 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer(
992 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Coronal, axial, cuttingPlane, static_cast<SlicerType>(mode)));
993
994 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 3, 1, true));
995 ASSERT_FLOAT_EQ(50, GetPixelValue(*rendered, 0, 0));
996 ASSERT_FLOAT_EQ(25, GetPixelValue(*rendered, 1, 0));
997 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 2, 0));
998 }
999
916 for (double z = -1; z < 4; z += 4) // z in { -1, 3 }, out of volume 1000 for (double z = -1; z < 4; z += 4) // z in { -1, 3 }, out of volume
917 { 1001 {
918 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, z), 1002 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, z),
919 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0), 1003 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0),
920 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0)); 1004 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0));