1 /*=========================================================================
2 *
3 * Copyright Insight Software Consortium
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18 #ifndef itkImageToPathFilter_hxx
19 #define itkImageToPathFilter_hxx
20
21 #include "itkImageToPathFilter.h"
22
23 /*
24 * This code was contributed in the Insight Journal paper:
25 * "ContourExtractor2DImageFilter: A subpixel-precision image isocontour extraction filter."
26 * by Pincus Z.
27 * https://hdl.handle.net/1926/165
28 * http://www.insight-journal.org/browse/publication/72
29 *
30 */
31
32 namespace itk
33 {
34
35 template< typename TInputImage, typename TOutputPath >
36 ImageToPathFilter< TInputImage, TOutputPath >
ImageToPathFilter()37 ::ImageToPathFilter()
38 {
39 // Modify superclass default values, can be overridden by subclasses
40 this->SetNumberOfRequiredInputs(1);
41 }
42
43 template< typename TInputImage, typename TOutputPath >
44 void
45 ImageToPathFilter< TInputImage, TOutputPath >
SetInput(const InputImageType * input)46 ::SetInput(const InputImageType *input)
47 {
48 // Process object is not const-correct so the const_cast is required here
49 this->ProcessObject::SetNthInput( 0,
50 const_cast< InputImageType * >( input ) );
51 }
52
53
54 /**
55 * Connect one of the operands for pixel-wise addition
56 */
57 template< typename TInputImage, typename TOutputPath >
58 void
59 ImageToPathFilter< TInputImage, TOutputPath >
SetInput(unsigned int index,const TInputImage * image)60 ::SetInput(unsigned int index, const TInputImage *image)
61 {
62 // Process object is not const-correct so the const_cast is required here
63 this->ProcessObject::SetNthInput( index,
64 const_cast< TInputImage * >( image ) );
65 }
66
67
68 template< typename TInputImage, typename TOutputPath >
69 const typename ImageToPathFilter< TInputImage, TOutputPath >::InputImageType *
70 ImageToPathFilter< TInputImage, TOutputPath >
GetInput()71 ::GetInput()
72 {
73 return itkDynamicCastInDebugMode< const TInputImage * >( this->GetPrimaryInput() );
74 }
75
76
77 template< typename TInputImage, typename TOutputPath >
78 const typename ImageToPathFilter< TInputImage, TOutputPath >::InputImageType *
79 ImageToPathFilter< TInputImage, TOutputPath >
GetInput(unsigned int idx)80 ::GetInput(unsigned int idx)
81 {
82 return itkDynamicCastInDebugMode< const TInputImage * >( this->ProcessObject::GetInput(idx) );
83 }
84
85
86 template< typename TInputImage, typename TOutputPath >
87 void
88 ImageToPathFilter< TInputImage, TOutputPath >
PrintSelf(std::ostream & os,Indent indent) const89 ::PrintSelf(std::ostream & os, Indent indent) const
90 {
91 Superclass::PrintSelf(os, indent);
92 }
93 } // end namespace itk
94
95 #endif
96