Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkImageBasedParameterizationDelegate.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 
14 
16 #include "mitkPixelTypeMultiplex.h"
17 
19 {
20 }
21 
23 {
24 }
25 
27 {
28  itk::Index<3> index = {{0, 0, 0}};
29  return GetInitialParameterization(index);
30 }
31 
32 template <typename TPixel>
34 {
36  val = access.GetPixelByIndex(currentPosition);
37 }
38 
40 {
41  ParametersType initialParameters = this->m_Parameterization;
42 
43  for (const auto& pos : this->m_ParameterImageMap)
44  {
45  ParametersType::ValueType value = 0.0;
46  mitkPixelTypeMultiplex3(AccessPixel, pos.second->GetChannelDescriptor().GetPixelType(), pos.second, currentPosition, value);
47 
48  initialParameters[pos.first] = value;
49  }
50 
51  return initialParameters;
52 }
53 
54 void
56 {
57  if (paramIndex >= this->m_Parameterization.Size())
58  {
59  mitkThrow() << "Initial value image is set for invalid parameter index. Number of parameter: " << this->m_Parameterization.Size() << "; invalid index: " << paramIndex;
60  }
61 
62  m_ParameterImageMap.insert(std::make_pair(paramIndex, image));
63 };
Gives locked and index-based read access for a particular image part. The class provides several set-...
const TPixel & GetPixelByIndex(const itk::Index< VDimension > &idx) const
#define mitkPixelTypeMultiplex3(function, ptype, param1, param2, param3)
ValueType
Type of the value held by a Value object.
Definition: jsoncpp.h:345
#define mitkThrow()
Image class for storing images.
Definition: mitkImage.h:72
mitk::Image::Pointer image
static void AccessPixel(mitk::PixelType, mitk::Image::ConstPointer im, const mitk::ImageBasedParameterizationDelegate::IndexType &currentPosition, mitk::ImageBasedParameterizationDelegate::ParametersType::ValueType &val)
Class for defining the data type of pixels.
Definition: mitkPixelType.h:51
void AddInitialParameterImage(const mitk::Image *image, ParametersType::size_type paramIndex)