Medical Imaging Interaction Toolkit  2018.4.99-936b789b
Medical Imaging Interaction Toolkit
mitkPAVesselProperties.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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #include "mitkPAVesselProperties.h"
14 
16 {
17  m_PositionVector = Vector::New();
18  m_DirectionVector = Vector::New();
19  m_RadiusInVoxel = 0;
20  m_AbsorptionCoefficient = 0;
21  m_ScatteringCoefficient = 0;
22  m_AnisotopyCoefficient = 0;
23  m_BifurcationFrequency = 0;
24  m_DoPartialVolume = false;
25 }
26 
28 {
29  m_PositionVector = other->GetPositionVector()->Clone();
30  m_DirectionVector = other->GetDirectionVector()->Clone();
31  m_RadiusInVoxel = other->GetRadiusInVoxel();
32  m_AbsorptionCoefficient = other->GetAbsorptionCoefficient();
33  m_ScatteringCoefficient = other->GetScatteringCoefficient();
34  m_AnisotopyCoefficient = other->GetAnisotopyCoefficient();
35  m_BifurcationFrequency = other->GetBifurcationFrequency();
36  m_DoPartialVolume = other->GetDoPartialVolume();
37 }
38 
40 {
41  m_PositionVector = nullptr;
42  m_DirectionVector = nullptr;
43 }
44 
45 bool mitk::pa::Equal(const VesselProperties::Pointer leftHandSide, const VesselProperties::Pointer rightHandSide,
46  double eps, bool verbose)
47 {
48  MITK_INFO(verbose) << "=== mitk::pa::VesselProperties Equal ===";
49 
50  if (rightHandSide.IsNull() || leftHandSide.IsNull())
51  {
52  MITK_INFO(verbose) << "Cannot compare nullpointers";
53  return false;
54  }
55 
56  if (leftHandSide->GetAbsorptionCoefficient() - rightHandSide->GetAbsorptionCoefficient() > eps)
57  {
58  MITK_INFO(verbose) << "Not the same AbsorptionCoefficient.";
59  return false;
60  }
61 
62  if (leftHandSide->GetAnisotopyCoefficient() - rightHandSide->GetAnisotopyCoefficient() > eps)
63  {
64  MITK_INFO(verbose) << "Not the same AnisotropyCoefficient.";
65  return false;
66  }
67 
68  if (leftHandSide->GetBifurcationFrequency() - rightHandSide->GetBifurcationFrequency() > eps)
69  {
70  MITK_INFO(verbose) << "Not the same BifurcationFrequency.";
71  return false;
72  }
73 
74  if (leftHandSide->GetRadiusInVoxel() - rightHandSide->GetRadiusInVoxel() > eps)
75  {
76  MITK_INFO(verbose) << "Not the same RadiusInVoxel.";
77  return false;
78  }
79 
80  if (leftHandSide->GetScatteringCoefficient() - rightHandSide->GetScatteringCoefficient() > eps)
81  {
82  MITK_INFO(verbose) << "Not the same ScatteringCoefficient.";
83  return false;
84  }
85 
86  if (!Equal(leftHandSide->GetPositionVector(), rightHandSide->GetPositionVector(), eps, verbose))
87  {
88  MITK_INFO(verbose) << "PositionVector not equal";
89  return false;
90  }
91 
92  if (!Equal(leftHandSide->GetDirectionVector(), rightHandSide->GetDirectionVector(), eps, verbose))
93  {
94  MITK_INFO(verbose) << "DirectionVector not equal";
95  return false;
96  }
97 
98  if (!(leftHandSide->GetDoPartialVolume() == rightHandSide->GetDoPartialVolume()))
99  {
100  MITK_INFO(verbose) << "GetDoPartialVolume not equal";
101  return false;
102  }
103 
104  return true;
105 }
#define MITK_INFO
Definition: mitkLogMacros.h:18
MITKPHOTOACOUSTICSLIB_EXPORT bool Equal(const MonteCarloThreadHandler::Pointer leftHandSide, const MonteCarloThreadHandler::Pointer rightHandSide, double eps, bool verbose)
Equal A function comparing two thread handlers for beeing equal.
bool verbose(false)
static Pointer New()
MITKCORE_EXPORT const ScalarType eps