void GetGridGeometryFromNode(const mitk::DataNode* regNode, mitk::Geometry3D::Pointer& gridDesc, unsigned int& gridFrequ)
  {

    int internalFrequ = 1;

    if(!regNode->GetIntProperty(mitk::nodeProp_RegVisGridFrequence,internalFrequ))
    {
      mitkThrow() << "Cannot configure node correctly. Node property "<<mitk::nodeProp_RegVisGridFrequence<<" is not correctly defined.";
    }

    mitk::Vector3DProperty* valueProp = NULL;
    mitk::Vector3D size;
    mitk::Vector3D spacing;

    if (regNode->GetProperty(valueProp, mitk::nodeProp_RegVisFOVSize))
    {
      size = valueProp->GetValue();
    }
    else
    {
      mitkThrow() << "Cannot configure node correctly. Node property "<<mitk::nodeProp_RegVisFOVSize<<" is not correctly defined.";
    }

    if (regNode->GetProperty(valueProp, mitk::nodeProp_RegVisFOVSpacing))
    {
      spacing = valueProp->GetValue();
    }
    else
    {
      mitkThrow() << "Cannot configure node correctly. Node property "<<mitk::nodeProp_RegVisFOVSpacing<<" is not correctly defined.";
    }

    mitk::Point3dProperty* originProp = NULL;
    mitk::Point3D origin;
    if (regNode->GetProperty(originProp, mitk::nodeProp_RegVisFOVOrigin))
    {
      origin = originProp->GetValue();
    }
    else
    {
      mitkThrow() << "Cannot configure node correctly. Node property "<<mitk::nodeProp_RegVisFOVOrigin<<" is not correctly defined.";
    }

    gridDesc = mitk::Geometry3D::New();
    mitk::Geometry3D::BoundsArrayType bounds = gridDesc->GetBounds();
    bounds[0] = 0;
    bounds[1] = size[0]/spacing[0];
    bounds[2] = 0;
    bounds[3] = size[1]/spacing[1];
    bounds[4] = 0;
    bounds[5] = size[2]/spacing[2];
    gridDesc->SetBounds(bounds);
    gridDesc->SetSpacing(spacing);
    gridDesc->SetOrigin(origin);

    gridFrequ = internalFrequ;
  }
示例#2
0
  void Equal_DifferentOrigin_ReturnsFalse()
  {
    mitk::Point3D origin;
    origin[0] = 0.0;
    origin[1] = 0.0;
    origin[2] = 1.0 + 2*mitk::eps;
    m_AnotherGeometry3D->SetOrigin(origin);

    MITK_ASSERT_NOT_EQUAL( m_Geometry3D, m_AnotherGeometry3D, "Origin was modified. Result should be false.");
  }