Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
itkImageToPathFilter.txx
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 /*===================================================================
14 
15 This file is based heavily on a corresponding ITK filter.
16 
17 ===================================================================*/
18 
19 #ifndef __itkImageToPathFilter_txx
20 #define __itkImageToPathFilter_txx
21 
22 #include "itkImageToPathFilter.h"
23 
24 namespace itk
25 {
26  /**
27  *
28  */
29  template <class TInputImage, class TOutputPath>
30  ImageToPathFilter<TInputImage, TOutputPath>::ImageToPathFilter()
31  {
32  // Modify superclass default values, can be overridden by subclasses
33  this->SetNumberOfRequiredInputs(1);
34  }
35 
36  /**
37  *
38  */
39  template <class TInputImage, class TOutputPath>
40  ImageToPathFilter<TInputImage, TOutputPath>::~ImageToPathFilter()
41  {
42  }
43 
44  /**
45  *
46  */
47  template <class TInputImage, class TOutputPath>
48  void ImageToPathFilter<TInputImage, TOutputPath>::SetInput(const InputImageType *input)
49  {
50  // Process object is not const-correct so the const_cast is required here
51  this->ProcessObject::SetNthInput(0, const_cast<InputImageType *>(input));
52  }
53 
54  /**
55  * Connect one of the operands for pixel-wise addition
56  */
57  template <class TInputImage, class TOutputPath>
58  void ImageToPathFilter<TInputImage, TOutputPath>::SetInput(unsigned int index, const TInputImage *image)
59  {
60  // Process object is not const-correct so the const_cast is required here
61  this->ProcessObject::SetNthInput(index, const_cast<TInputImage *>(image));
62  }
63 
64  /**
65  *
66  */
67  template <class TInputImage, class TOutputPath>
68  const typename ImageToPathFilter<TInputImage, TOutputPath>::InputImageType *
69  ImageToPathFilter<TInputImage, TOutputPath>::GetInput(void)
70  {
71  if (this->GetNumberOfInputs() < 1)
72  {
73  return nullptr;
74  }
75 
76  return static_cast<const TInputImage *>(this->ProcessObject::GetInput(0));
77  }
78 
79  /**
80  *
81  */
82  template <class TInputImage, class TOutputPath>
83  const typename ImageToPathFilter<TInputImage, TOutputPath>::InputImageType *
84  ImageToPathFilter<TInputImage, TOutputPath>::GetInput(unsigned int idx)
85  {
86  return static_cast<const TInputImage *>(this->ProcessObject::GetInput(idx));
87  }
88 
89  template <class TInputImage, class TOutputPath>
90  void ImageToPathFilter<TInputImage, TOutputPath>::PrintSelf(std::ostream &os, Indent indent) const
91  {
92  Superclass::PrintSelf(os, indent);
93  }
94 
95 } // end namespace itk
96 
97 #endif