Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "mitkContour.h"
00020 #include "mitkCommon.h"
00021
00022 #include <fstream>
00023 int mitkContourTest(int , char* [])
00024 {
00025 mitk::Contour::Pointer contour;
00026 std::cout << "Testing mitk::Contour::New(): ";
00027 contour = mitk::Contour::New();
00028 if (contour.IsNull()) {
00029 std::cout<<"[FAILED]"<<std::endl;
00030 return EXIT_FAILURE;
00031 }
00032 else {
00033 std::cout<<"[PASSED]"<<std::endl;
00034 }
00035
00036 std::cout << "Testing mitk::Contour::AddVertex(): ";
00037 mitk::Point3D p;
00038 p.Fill(0);
00039 contour->AddVertex(p);
00040 p.Fill(1);
00041 contour->AddVertex(p);
00042 p.Fill(2);
00043 contour->AddVertex(p);
00044
00045 if (contour->GetNumberOfPoints() != 3)
00046 {
00047 std::cout<<"[FAILED]"<<std::endl;
00048 return EXIT_FAILURE;
00049 }
00050 else
00051 {
00052 std::cout<<"[PASSED]"<<std::endl;
00053 }
00054
00055
00056 std::cout << "Testing mitk::Contour::GetPoints()";
00057 mitk::Contour::PointsContainerPointer points = contour->GetPoints();
00058 if ( points.IsNull() )
00059 {
00060 std::cout<<"[FAILED]"<<std::endl;
00061 return EXIT_FAILURE;
00062 }
00063 else
00064 {
00065 std::cout<<"[PASSED]"<<std::endl;
00066 }
00067
00068 std::cout << "Testing mitk::Contour::Initialize()";
00069 contour->Initialize();
00070 if (contour->GetNumberOfPoints() != 0)
00071 {
00072 std::cout<<"[FAILED]"<<std::endl;
00073 return EXIT_FAILURE;
00074 }
00075 else
00076 {
00077 std::cout<<"[PASSED]"<<std::endl;
00078 }
00079
00080 contour->SetPoints(points);
00081 if ( contour->GetNumberOfPoints() != 3)
00082 {
00083 std::cout<<"[FAILED]"<<std::endl;
00084 return EXIT_FAILURE;
00085 };
00086
00087 mitk::Contour::PathPointer path = contour->GetContourPath();
00088 if ( path.IsNull() )
00089 {
00090 return EXIT_FAILURE;
00091 }
00092
00093 contour->UpdateOutputInformation();
00094 contour->SetClosed(false);
00095
00096 if (contour->GetClosed())
00097 {
00098 std::cout<<"[FAILED] "<<std::endl;
00099 return EXIT_FAILURE;
00100 }
00101
00102 std::cout<<"[TEST DONE]"<<std::endl;
00103 return EXIT_SUCCESS;
00104 }