コード例 #1
0
  void TestInsertPointWithPointSpecification()
  {
    //check InsertPoint with PointSpecification
    mitk::Point3D point5;
    mitk::Point3D tempPoint;
    point5.Fill(7);

    pointSet->SetPoint(5, point5, mitk::PTEDGE );
    tempPoint = pointSet->GetPoint(5);

    CPPUNIT_ASSERT_EQUAL_MESSAGE("check InsertPoint with PointSpecification" ,
        true, tempPoint == point5);
    /*
      if (tempPoint != point5)
      {
      std::cout<<"[FAILED]"<<std::endl;
      return EXIT_FAILURE;
      }
      std::cout<<"[PASSED]"<<std::endl;
     */
  }
コード例 #2
0
mitk::PointSet::Pointer mitk::PointSetReaderService::ReadPoints(mitk::PointSet::Pointer newPointSet,
        TiXmlElement *currentTimeSeries,
        unsigned int currentTimeStep)
{
    if (currentTimeSeries->FirstChildElement("point") != NULL)
    {
        for (TiXmlElement *currentPoint = currentTimeSeries->FirstChildElement("point")->ToElement(); currentPoint != NULL;
                currentPoint = currentPoint->NextSiblingElement())
        {
            unsigned int id(0);
            mitk::PointSpecificationType spec((mitk::PointSpecificationType)0);
            double x(0.0);
            double y(0.0);
            double z(0.0);

            id = atoi(currentPoint->FirstChildElement("id")->GetText());
            if (currentPoint->FirstChildElement("specification") != NULL)
            {
                spec = (mitk::PointSpecificationType)atoi(currentPoint->FirstChildElement("specification")->GetText());
            }
            x = atof(currentPoint->FirstChildElement("x")->GetText());
            y = atof(currentPoint->FirstChildElement("y")->GetText());
            z = atof(currentPoint->FirstChildElement("z")->GetText());

            mitk::Point3D point;
            mitk::FillVector3D(point, x, y, z);
            newPointSet->SetPoint(id, point, spec, currentTimeStep);
        }
    }
    else
    {
        if (currentTimeStep != newPointSet->GetTimeSteps() + 1)
        {
            newPointSet->Expand(currentTimeStep + 1); // expand time step series with empty time step
        }
    }
    return newPointSet;
}