Beispiel #1
0
bool mitk::pa::Equal(const Vector::Pointer leftHandSide, const Vector::Pointer rightHandSide, double eps, bool verbose)
{
  MITK_INFO(verbose) << "=== mitk::pa::Vector Equal ===";

  if (rightHandSide.IsNull() || leftHandSide.IsNull())
  {
    MITK_INFO(verbose) << "Cannot compare nullpointers";
    return false;
  }

  if (leftHandSide->GetElement(0) - rightHandSide->GetElement(0) > eps)
  {
    MITK_INFO(verbose) << "Element[0] not equal";
    return false;
  }

  if (leftHandSide->GetElement(1) - rightHandSide->GetElement(1) > eps)
  {
    MITK_INFO(verbose) << "Element[1] not equal";
    return false;
  }

  if (leftHandSide->GetElement(2) - rightHandSide->GetElement(2) > eps)
  {
    MITK_INFO(verbose) << "Element[2] not equal";
    return false;
  }

  return true;
}
Beispiel #2
0
void mitk::pa::Vessel::DrawVesselInVolume(Vector::Pointer fromPosition,
  InSilicoTissueVolume::Pointer volume)
{
  Vector::Pointer diffVector = Vector::New();
  Vector::Pointer toPosition = m_VesselProperties->GetPositionVector();
  diffVector->SetElement(0, fromPosition->GetElement(0) - toPosition->GetElement(0));
  diffVector->SetElement(1, fromPosition->GetElement(1) - toPosition->GetElement(1));
  diffVector->SetElement(2, fromPosition->GetElement(2) - toPosition->GetElement(2));

  //1/SCALING_FACTOR steps along the direction vector are taken and drawn into the image.
  Vector::Pointer stepSize = Vector::New();
  stepSize->SetValue(m_VesselProperties->GetDirectionVector());
  stepSize->Scale(SCALING_FACTOR);

  while (diffVector->GetNorm() >= SCALING_FACTOR)
  {
    m_WalkedDistance += stepSize->GetNorm();

    fromPosition->SetElement(0, fromPosition->GetElement(0) + stepSize->GetElement(0));
    fromPosition->SetElement(1, fromPosition->GetElement(1) + stepSize->GetElement(1));
    fromPosition->SetElement(2, fromPosition->GetElement(2) + stepSize->GetElement(2));

    int xPos = fromPosition->GetElement(0);
    int yPos = fromPosition->GetElement(1);
    int zPos = fromPosition->GetElement(2);

    if (!volume->IsInsideVolume(xPos, yPos, zPos))
    {
      m_VesselProperties->SetRadiusInVoxel(0);
      break;
    }

    double radius = m_VesselProperties->GetRadiusInVoxel();

    for (int x = xPos - radius; x <= xPos + radius; x++)
      for (int y = yPos - radius; y <= yPos + radius; y++)
        for (int z = zPos - radius; z <= zPos + radius; z++)
        {
          if (radius*radius >= (x - xPos)*(x - xPos) + (y - yPos)*(y - yPos) + (z - zPos)*(z - zPos))
          {
            volume->SetVolumeValues(x, y, z, m_VesselProperties->GetAbsorptionCoefficient(),
              m_VesselProperties->GetScatteringCoefficient(),
              m_VesselProperties->GetAnisotopyCoefficient(),
              mitk::pa::InSilicoTissueVolume::SegmentationType::VESSEL);
          }
        }

    diffVector->SetElement(0, fromPosition->GetElement(0) - toPosition->GetElement(0));
    diffVector->SetElement(1, fromPosition->GetElement(1) - toPosition->GetElement(1));
    diffVector->SetElement(2, fromPosition->GetElement(2) - toPosition->GetElement(2));
  }
}
Beispiel #3
0
void mitk::pa::Vector::Add(Vector::Pointer other)
{
  m_Vector.SetElement(0, m_Vector.GetElement(0) + other->GetElement(0));
  m_Vector.SetElement(1, m_Vector.GetElement(1) + other->GetElement(1));
  m_Vector.SetElement(2, m_Vector.GetElement(2) + other->GetElement(2));
}
Beispiel #4
0
void mitk::pa::Vector::Subtract(Vector::Pointer other)
{
  m_Vector.SetElement(0, m_Vector.GetElement(0) - other->GetElement(0));
  m_Vector.SetElement(1, m_Vector.GetElement(1) - other->GetElement(1));
  m_Vector.SetElement(2, m_Vector.GetElement(2) - other->GetElement(2));
}