KWStyle - itkMeshSource.txx
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkMeshSource.txx.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:42 $
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 DEF #ifndef _itkMeshSource_txx
18 DEF #define _itkMeshSource_txx
19
20 #include "itkMeshSource.h"
21
22 namespace itk
23 {
24
25 /**
26  *
27  */
28 template<class TOutputMesh>
29 MeshSource<TOutputMesh>
30 ::MeshSource()
31 {
32   // Create the output. We use static_cast<> here because we know the default
33   // output must be of type TOutputMesh
34   OutputMeshPointer output
35 IND ****= static_cast<TOutputMesh*>(this->MakeOutput(0).GetPointer()); 
36
37   this->ProcessObject::SetNumberOfRequiredOutputs(1);
38   this->ProcessObject::SetNthOutput( 0, output.GetPointer() );
39
40   m_GenerateDataRegion = 0;
41   m_GenerateDataNumberOfRegions = 0;
42 }
43
44 /**
45  *
46  */
47 template<class TOutputMesh>
48 typename MeshSource<TOutputMesh>::DataObjectPointer
49 MeshSource<TOutputMesh>
50 ::MakeOutput(unsigned int)
51 {
52   return static_cast<DataObject*>(TOutputMesh::New().GetPointer());
53 }
54
55 /**
56  *
57  */
58 template<class TOutputMesh>
59 typename MeshSource<TOutputMesh>::OutputMeshType *
60 MeshSource<TOutputMesh>
61 ::GetOutput(void)
62 {
63   if (this->GetNumberOfOutputs() < 1)
64     {
65     return 0;
66     }
67   
68   return static_cast<TOutputMesh*>
69 IND ****(this->ProcessObject::GetOutput(0));
70 }
71
72   
73 /**
74  *
75  */
76 template<class TOutputMesh>
77 typename MeshSource<TOutputMesh>::OutputMeshType *
78 MeshSource<TOutputMesh>
79 ::GetOutput(unsigned int idx)
80 {
81   return static_cast<TOutputMesh*>
82 IND ****(this->ProcessObject::GetOutput(idx));
83 }
84
85
86 /**
87  *
88  */
89 template<class TOutputMesh>
90 void 
91 MeshSource<TOutputMesh>
92 ::SetOutput(OutputMeshType *output)
93 {
94 LEN   itkWarningMacro(<< "SetOutput(): This method is slated to be removed from ITK.  Please use GraftOutput() in possible combination with DisconnectPipeline() instead." );
95   this->ProcessObject::SetNthOutput(0, output);
96 }
97
98
99 /**
100  *
101  */
102 template<class TOutputMesh>
103 void 
104 MeshSource<TOutputMesh>
105 ::GenerateInputRequestedRegion()
106 {
107   Superclass::GenerateInputRequestedRegion();
108 }
109
110
111 /**
112  * 
113  */
114 template<class TOutputMesh>
115 void
116 MeshSource<TOutputMesh>
117 ::GraftOutput(DataObject *graft)
118 {
119   this->GraftNthOutput(0, graft);
120 }
121
122
123 /**
124  * 
125  */
126 template<class TOutputMesh>
127 void
128 MeshSource<TOutputMesh>
129 ::GraftNthOutput(unsigned int idx, DataObject *graft)
130 {
131   if ( idx >= this->GetNumberOfOutputs() )
132     {
133     itkExceptionMacro(<<"Requested to graft output " << idx << 
134 LEN         " but this filter only has " << this->GetNumberOfOutputs() << " Outputs.");
135     }  
136
137   if ( !graft )
138     {
139     itkExceptionMacro(<<"Requested to graft output that is a NULL pointer" );
140     }
141
142   DataObject * output = this->GetOutput( idx );
143
144   // Call Graft on the Mesh in order to copy meta-information, and containers.
145   output->Graft( graft );
146 }
147
148
149 /**
150  *
151  */
152 template<class TOutputMesh>
153 void 
154 MeshSource<TOutputMesh>
155 ::PrintSelf(std::ostream& os, Indent indent) const
156 {
157   Superclass::PrintSelf(os,indent);
158 }
159
160 // end namespace itk
161
162 #endif
163

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