Exemple #1
0
void mitk::Image::Initialize(const mitk::PixelType& type, const mitk::BaseGeometry& geometry, unsigned int channels, int tDim )
{
  mitk::ProportionalTimeGeometry::Pointer timeGeometry = ProportionalTimeGeometry::New();
  itk::LightObject::Pointer lopointer = geometry.Clone();
  timeGeometry->Initialize(dynamic_cast<BaseGeometry*>(lopointer.GetPointer()), tDim);
  this->Initialize(type, *timeGeometry, channels, tDim);
}
bool mitk::Equal(const mitk::BaseGeometry &leftHandSide,
                 const mitk::BaseGeometry &rightHandSide,
                 ScalarType eps,
                 bool verbose)
{
  bool result = true;

  // Compare spacings
  if (!mitk::Equal(leftHandSide.GetSpacing(), rightHandSide.GetSpacing(), eps))
  {
    if (verbose)
    {
      MITK_INFO << "[( Geometry3D )] Spacing differs.";
      MITK_INFO << "rightHandSide is " << setprecision(12) << rightHandSide.GetSpacing() << " : leftHandSide is "
                << leftHandSide.GetSpacing() << " and tolerance is " << eps;
    }
    result = false;
  }

  // Compare Origins
  if (!mitk::Equal(leftHandSide.GetOrigin(), rightHandSide.GetOrigin(), eps))
  {
    if (verbose)
    {
      MITK_INFO << "[( Geometry3D )] Origin differs.";
      MITK_INFO << "rightHandSide is " << setprecision(12) << rightHandSide.GetOrigin() << " : leftHandSide is "
                << leftHandSide.GetOrigin() << " and tolerance is " << eps;
    }
    result = false;
  }

  // Compare Axis and Extents
  for (unsigned int i = 0; i < 3; ++i)
  {
    if (!mitk::Equal(leftHandSide.GetAxisVector(i), rightHandSide.GetAxisVector(i), eps))
    {
      if (verbose)
      {
        MITK_INFO << "[( Geometry3D )] AxisVector #" << i << " differ";
        MITK_INFO << "rightHandSide is " << setprecision(12) << rightHandSide.GetAxisVector(i) << " : leftHandSide is "
                  << leftHandSide.GetAxisVector(i) << " and tolerance is " << eps;
      }
      result = false;
    }

    if (!mitk::Equal(leftHandSide.GetExtent(i), rightHandSide.GetExtent(i), eps))
    {
      if (verbose)
      {
        MITK_INFO << "[( Geometry3D )] Extent #" << i << " differ";
        MITK_INFO << "rightHandSide is " << setprecision(12) << rightHandSide.GetExtent(i) << " : leftHandSide is "
                  << leftHandSide.GetExtent(i) << " and tolerance is " << eps;
      }
      result = false;
    }
  }

  // Compare ImageGeometry Flag
  if (rightHandSide.GetImageGeometry() != leftHandSide.GetImageGeometry())
  {
    if (verbose)
    {
      MITK_INFO << "[( Geometry3D )] GetImageGeometry is different.";
      MITK_INFO << "rightHandSide is " << rightHandSide.GetImageGeometry() << " : leftHandSide is "
                << leftHandSide.GetImageGeometry();
    }
    result = false;
  }

  // Compare FrameOfReference ID
  if (rightHandSide.GetFrameOfReferenceID() != leftHandSide.GetFrameOfReferenceID())
  {
    if (verbose)
    {
      MITK_INFO << "[( Geometry3D )] GetFrameOfReferenceID is different.";
      MITK_INFO << "rightHandSide is " << rightHandSide.GetFrameOfReferenceID() << " : leftHandSide is "
                << leftHandSide.GetFrameOfReferenceID();
    }
    result = false;
  }

  // Compare BoundingBoxes
  if (!mitk::Equal(*leftHandSide.GetBoundingBox(), *rightHandSide.GetBoundingBox(), eps, verbose))
  {
    result = false;
  }

  // Compare IndexToWorldTransform Matrix
  if (!mitk::Equal(*leftHandSide.GetIndexToWorldTransform(), *rightHandSide.GetIndexToWorldTransform(), eps, verbose))
  {
    result = false;
  }
  return result;
}
Exemple #3
0
void mitk::Image::Initialize(const mitk::PixelType& type, const mitk::BaseGeometry& geometry, unsigned int channels, int tDim )
{
  mitk::ProportionalTimeGeometry::Pointer timeGeometry = ProportionalTimeGeometry::New();
  timeGeometry->Initialize(geometry.Clone(), tDim);
  this->Initialize(type, *timeGeometry, channels, tDim);
}