17 #ifndef __itkSpatialObjectDuplicator_txx
18 #define __itkSpatialObjectDuplicator_txx
27 template<
class TInputSpatialObject>
33 m_InternalSpatialObjectTime = 0;
38 template<
class TInputSpatialObject>
51 SOType* newSO =
dynamic_cast<SOType*
> ( i.
GetPointer() );
54 std::cout <<
"Could not create an instance of " << value << std::endl
55 <<
"The usual cause of this error is not registering the "
56 <<
"SpatialObject with SpatialFactory" << std::endl;
57 std::cout <<
"Currently registered Transforms: " << std::endl;
58 std::list<std::string> names =
60 std::list<std::string>::iterator it;
61 for ( it = names.begin(); it != names.end(); it++ )
63 std::cout <<
"\t\"" << *it <<
"\"" << std::endl;
69 newSO->CopyInformation(source);
72 typedef typename TInputSpatialObject::ChildrenListType ChildrenListType;
73 ChildrenListType* children = source->
GetChildren(0);
74 typename ChildrenListType::const_iterator it = children->begin();
75 while(it != children->end())
77 this->CopyObject(*it,newSO);
85 template<
class TInputSpatialObject>
92 itkExceptionMacro(<<
"Input SpatialObject has not been connected");
97 unsigned long t, t1, t2;
98 t1 = m_Input->GetPipelineMTime();
99 t2 = m_Input->GetMTime();
100 t = (t1 > t2 ? t1 : t2);
102 if(t == m_InternalSpatialObjectTime)
108 m_InternalSpatialObjectTime = t;
113 std::string value = m_Input->GetSpatialObjectTypeAsString();
117 if ( m_Output.IsNull() )
119 std::cout <<
"Could not create an instance of " << value << std::endl
120 <<
"The usual cause of this error is not registering the "
121 <<
"SpatialObject with SpatialFactory" << std::endl;
122 std::cout <<
"Currently registered Transforms: " << std::endl;
123 std::list<std::string> names =
125 std::list<std::string>::iterator it;
126 for ( it = names.begin(); it != names.end(); it++ )
128 std::cout <<
"\t\"" << *it <<
"\"" << std::endl;
133 m_Output->CopyInformation(m_Input);
137 typedef typename TInputSpatialObject::ChildrenListType ChildrenListType;
138 ChildrenListType* children = m_Input->GetChildren(0);
139 typename ChildrenListType::const_iterator it = children->begin();
140 while(it != children->end())
142 this->CopyObject(*it,m_Output);
148 template<
class TInputSpatialObject>
153 Superclass::PrintSelf(os,indent);
154 os << indent <<
"Input SpatialObject: " << m_Input << std::endl;
155 os << indent <<
"Output SpatialObject: " << m_Output << std::endl;
156 os << indent <<
"Internal SpatialObject Time: "
157 << m_InternalSpatialObjectTime << std::endl;