KWStyle - itkPathSource.txx
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkPathSource.txx.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:43 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17
18 DEF #ifndef _itkPathSource_txx
19 DEF #define _itkPathSource_txx
20 #include "itkPathSource.h"
21
22 namespace itk
23 {
24
25 /**
26  *
27  */
28 template<class TOutputPath>
29 PathSource<TOutputPath>
30 ::PathSource()
31 {
32   // Create the output. We use static_cast<> here because we know the default
33   // output must be of type TOutputPath
34   OutputPathPointer output
35 IND ****= static_cast<TOutputPath*>(this->MakeOutput(0).GetPointer()); 
36
37   this->ProcessObject::SetNumberOfRequiredOutputs(1);
38   this->ProcessObject::SetNthOutput( 0, output.GetPointer() );
39
40   // Initialize PathSource member data
41 }
42
43 /**
44  *
45  */
46 template<class TOutputPath>
47 typename PathSource<TOutputPath>::OutputPathType *
48 PathSource<TOutputPath>
49 ::GetOutput(void)
50 {
51   if (this->GetNumberOfOutputs() < 1)
52     {
53     return 0;
54     }
55   
56   return static_cast<TOutputPath*>
57 IND *********************(this->ProcessObject::GetOutput(0));
58 }
59
60   
61 /**
62  *
63  */
64 template<class TOutputPath>
65 typename PathSource<TOutputPath>::OutputPathType *
66 PathSource<TOutputPath>
67 ::GetOutput(unsigned int idx)
68 {
69   return static_cast<TOutputPath*>
70 IND *********************(this->ProcessObject::GetOutput(idx));
71 }
72
73 /**
74  * 
75  */
76 template<class TOutputPath>
77 void
78 PathSource<TOutputPath>
79 ::GraftOutput(TOutputPath *graft)
80 {
81   this->GraftNthOutput(0, graft);
82 }
83
84 /**
85  * 
86  */
87 template<class TOutputPath>
88 void
89 PathSource<TOutputPath>
90 ::GraftNthOutput(unsigned int idx, TOutputPath *graft)
91 {
92   if (idx < this->GetNumberOfOutputs())
93     {
94     OutputPathType * output = this->GetOutput(idx);
95
96     if (output && graft)
97       {
98       // Paths do not have a generic pointer to their bulk data
99       itkWarningMacro( << "Warning:  GraftNthOutput() is broken" );
100       
101       // possible VERY WRONG KLUDGE that should enable mini-pipelining:
102       // Completely copy the path to graft over the current output path,
103       // but RESTORE the original Source ivars to preserve pipeline routing.
104       // 
105       // ProcessObject *source = output->GetSource();
106       // *output = *graft;
107       // output->DisconnectSource( graft->GetSource(),
108       //                           graft->GetSourceOutputIndex() );
109       // output->ConnectSource( source, idx );
110       
111       
112       // grab a handle to the bulk data of the specified data object
113       // output->SetPixelContainer( graft->GetPixelContainer() );
114
115       // copy the region ivars of the specified data object
116       // output->SetRequestedRegion( graft->GetRequestedRegion() );
117       // output->SetLargestPossibleRegion( graft->GetLargestPossibleRegion() );
118       // output->SetBufferedRegion( graft->GetBufferedRegion() );
119
120       // copy the meta-information
121       //output->CopyInformation( graft );
122       }
123     }
124 }
125
126 /**
127  *
128  */
129 template<class TOutputPath>
130 typename PathSource<TOutputPath>::DataObjectPointer
131 PathSource<TOutputPath>
132 ::MakeOutput(unsigned int)
133 {
134   return static_cast<DataObject*>(TOutputPath::New().GetPointer());
135 }
136
137 /**
138  *
139  */
140 template<class TOutputPath>
141 void 
142 PathSource<TOutputPath>
143 ::PrintSelf(std::ostream& os, Indent indent) const
144 {
145   Superclass::PrintSelf(os,indent);
146 }
147
148 // end namespace itk
149
150 #endif
151

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:38PM
© Kitware Inc.