Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkGeometryData.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "mitkGeometryData.h"
18 #include "mitkBaseProcess.h"
19 #include "mitkTimeGeometry.h"
20 
22 {
23 }
24 
26 {
27 }
28 
30 {
31  Superclass::UpdateOutputInformation();
32 }
33 
35 {
36 }
37 
39 {
40  if (GetGeometry() != nullptr)
41  return true;
42 
43  return false;
44 }
45 
47 {
48  if (GetGeometry() == nullptr)
49  return false;
50 
51  return true;
52 }
53 
54 void mitk::GeometryData::SetRequestedRegion(const itk::DataObject *)
55 {
56 }
57 
58 void mitk::GeometryData::CopyInformation(const itk::DataObject *)
59 {
60 }
61 
62 bool mitk::Equal(const mitk::GeometryData &leftHandSide,
63  const mitk::GeometryData &rightHandSide,
65  bool verbose)
66 {
67  unsigned int timeStepsLeft = leftHandSide.GetTimeGeometry()->CountTimeSteps();
68  unsigned int timeStepsRight = rightHandSide.GetTimeGeometry()->CountTimeSteps();
69 
70  if (timeStepsLeft != timeStepsRight)
71  {
72  if (verbose)
73  {
74  MITK_INFO << "[( GeometryData::GetTimeGeometry )] number of time steps are not equal.";
75  MITK_INFO << "rightHandSide is " << timeStepsRight << " : leftHandSide is " << timeStepsLeft;
76  }
77  return false;
78  }
79 
80  bool allEqual = true;
81 
82  for (unsigned int t = 0; t < timeStepsLeft; ++t)
83  {
84  BaseGeometry *geomLeft = leftHandSide.GetGeometry(t);
85  BaseGeometry *geomRight = rightHandSide.GetGeometry(t);
86  allEqual &= mitk::Equal(*geomLeft, *geomRight, eps, verbose);
87  }
88 
89  return allEqual; // valid with initial true for timestep count == 0
90 }
virtual void SetRequestedRegion(const itk::DataObject *data) override
Set the requested region from this data object to match the requested region of the data object passe...
virtual void UpdateOutputInformation() override
#define MITK_INFO
Definition: mitkLogMacros.h:22
double ScalarType
virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override
Determine whether the RequestedRegion is outside of the BufferedRegion.
virtual void SetRequestedRegionToLargestPossibleRegion() override
Set the RequestedRegion to the LargestPossibleRegion.
const mitk::TimeGeometry * GetTimeGeometry() const
Return the TimeGeometry of the data as const pointer.
Definition: mitkBaseData.h:52
virtual void CopyInformation(const itk::DataObject *data) override
virtual bool VerifyRequestedRegion() override
Verify that the RequestedRegion is within the LargestPossibleRegion.
Data class only having a BaseGeometry but not containing any specific data.
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.
MITKCORE_EXPORT const ScalarType eps
mitk::BaseGeometry * GetGeometry(int t=0) const
Return the geometry, which is a TimeGeometry, of the data as non-const pointer.
Definition: mitkBaseData.h:129
BaseGeometry Describes the geometry of a data object.