Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkBValueMapProperty.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 "mitkBValueMapProperty.h"
18 
20  : m_BValueMap()
21 {
22 }
23 
25  : mitk::BaseProperty(other)
26 {
27  m_BValueMap = other.GetBValueMap();
28 }
29 
31 {
32  m_BValueMap = bValueMap;
33 }
34 
36 {
37 }
38 
40 {
41  return m_BValueMap;
42 }
43 
45 {
46  this->m_BValueMap = map;
47 }
48 
50 {
51  return this->m_BValueMap == static_cast<const Self&>(property).m_BValueMap;
52 }
53 
55 {
56  this->m_BValueMap = static_cast<const Self&>(property).m_BValueMap;
57  return true;
58 }
59 
61 {
63 
64  mitk::BValueMapProperty::GradientDirectionsContainerType::ConstIterator gdcit;
65  for( gdcit = gdc->Begin(); gdcit != gdc->End(); ++gdcit)
66  {
67  float keyBValue = mitk::BValueMapProperty::GetBValueOfGradientDirection(gdcit.Index(),referenceBValue, gdc);
68  map[keyBValue].push_back(gdcit.Index());
69  }
70 
71  return map;
72 }
73 
74 
76 {
77  if(i > gdc->Size()-1)
78  return -1;
79 
80  if(gdc->ElementAt(i).one_norm() <= 0.0)
81  {
82  return 0;
83  }
84  else
85  {
86  double twonorm = gdc->ElementAt(i).two_norm();
87  double bval = referenceBValue*twonorm*twonorm;
88 
89  if (bval<0)
90  bval = ceil(bval - 0.5);
91  else
92  bval = floor(bval + 0.5);
93 
94  return bval;
95  }
96 }
97 
99 {
100  itk::LightObject::Pointer result(new Self(*this));
101  result->UnRegister();
102  return result;
103 }
itk::SmartPointer< Self > Pointer
std::map< unsigned int, std::vector< unsigned int > > BValueMap
The BValueMap contains seperated IndicesVectors for each b value (index for GradientDirectionContaine...
static BValueMap CreateBValueMap(const GradientDirectionsContainerType *gdc, float referenceBValue)
DataCollection - Class to facilitate loading/accessing structured data.
const BValueMap &const BValueMap & GetBValueMap() const
itk::VectorContainer< IndexType, GradientDirectionType > GradientDirectionsContainerType
virtual bool IsEqual(const BaseProperty &property) const override
Abstract base class for properties.
static float GetBValueOfGradientDirection(unsigned int i, float referenceBValue, const GradientDirectionsContainerType *gdc)
virtual bool Assign(const BaseProperty &property) override
virtual itk::LightObject::Pointer InternalClone() const override
MITKMATCHPOINTREGISTRATION_EXPORT ResultImageType::Pointer map(const InputImageType *input, const RegistrationType *registration, bool throwOnOutOfInputAreaError=false, const double &paddingValue=0, const ResultImageGeometryType *resultGeometry=NULL, bool throwOnMappingError=true, const double &errorValue=0, mitk::ImageMappingInterpolator::Type interpolatorType=mitk::ImageMappingInterpolator::Linear)
void SetBValueMap(const BValueMap &map)