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 <mitkMesh.h>
00020 #include <mitkVector.h>
00021 #include <mitkPointOperation.h>
00022 #include <mitkInteractionConst.h>
00023 #include <fstream>
00024
00025 int mitkMeshTest(int , char* [])
00026 {
00027
00028 mitk::Mesh::Pointer mesh;
00029 mesh = mitk::Mesh::New();
00030
00031
00032 std::cout << "Create a mesh and try to get the itkMesh";
00033 mitk::Mesh::DataType::Pointer itkdata = NULL;
00034 itkdata = mesh->GetMesh();
00035 if (itkdata.IsNull())
00036 {
00037 std::cout<<"[FAILED]"<<std::endl;
00038 return EXIT_FAILURE;
00039 }
00040
00041
00042 std::cout << "Is the mesh empty?";
00043 if (mesh->GetSize() != 0)
00044 {
00045 std::cout<<"[FAILED]"<<std::endl;
00046 return EXIT_FAILURE;
00047 }
00048
00049
00050 int position = 0;
00051 mitk::Point3D point;
00052 point.Fill(1);
00053 mitk::PointOperation* doOp = new mitk::PointOperation(mitk::OpINSERT, point, position);
00054 mesh->ExecuteOperation(doOp);
00055
00056
00057 if ( (mesh->GetSize()!=1) ||
00058 (!mesh->IndexExists(position)))
00059 {
00060 std::cout<<"[FAILED]"<<std::endl;
00061 return EXIT_FAILURE;
00062 }
00063 delete doOp;
00064
00065
00066 std::cout << "Create an operation and add a point. Then try to get that point.";
00067 mitk::Point3D tempPoint;
00068 tempPoint.Fill(0);
00069 tempPoint = mesh->GetPoint(position);
00070 if (tempPoint != point)
00071 {
00072 std::cout<<"[FAILED]"<<std::endl;
00073 return EXIT_FAILURE;
00074 }
00075
00076
00077
00078 std::cout<<"[PASSED]"<<std::endl;
00079
00080 std::cout<<"[TEST DONE]"<<std::endl;
00081 return EXIT_SUCCESS;
00082 }