ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkTubeSpatialObject_h 00019 #define __itkTubeSpatialObject_h 00020 00021 #include <list> 00022 00023 #include "itkPointBasedSpatialObject.h" 00024 #include "itkTubeSpatialObjectPoint.h" 00025 00026 namespace itk 00027 { 00041 template< unsigned int TDimension = 3, 00042 typename TTubePointType = TubeSpatialObjectPoint< TDimension > > 00043 class ITK_EXPORT TubeSpatialObject: 00044 public PointBasedSpatialObject< TDimension > 00045 { 00046 public: 00047 00048 typedef TubeSpatialObject Self; 00049 typedef PointBasedSpatialObject< TDimension > Superclass; 00050 typedef SmartPointer< Self > Pointer; 00051 typedef SmartPointer< const Self > ConstPointer; 00052 typedef double ScalarType; 00053 typedef TTubePointType TubePointType; 00054 typedef std::vector< TubePointType > PointListType; 00055 typedef PointListType * PointListPointer; 00056 typedef typename Superclass::PointType PointType; 00057 typedef typename Superclass::TransformType TransformType; 00058 typedef typename Superclass::SpatialObjectPointType SpatialObjectPointType; 00059 typedef VectorContainer< IdentifierType, PointType > PointContainerType; 00060 typedef SmartPointer< PointContainerType > PointContainerPointer; 00061 typedef typename Superclass::VectorType VectorType; 00062 typedef typename Superclass::CovariantVectorType CovariantVectorType; 00063 typedef typename Superclass::BoundingBoxType BoundingBoxType; 00064 00066 itkNewMacro(Self); 00067 00069 itkTypeMacro(TubeSpatialObject, PointBasedSpatialObject); 00070 00072 virtual PointListType & GetPoints(void); 00073 00075 virtual const PointListType & GetPoints(void) const; 00076 00078 virtual void SetPoints(PointListType & newPoints); 00079 00081 virtual const SpatialObjectPointType * GetPoint(IdentifierType ind) const 00082 { return &( m_Points[ind] ); } 00083 00085 virtual SpatialObjectPointType * GetPoint(IdentifierType ind) 00086 { return &( m_Points[ind] ); } 00087 00089 virtual void SetPoint(IdentifierType ind, const TubePointType & pnt) 00090 { m_Points[ind] = pnt; } 00091 00093 virtual void RemovePoint(IdentifierType ind) 00094 { m_Points.erase(m_Points.begin() + ind); } 00095 00097 virtual SizeValueType GetNumberOfPoints(void) const 00098 { return m_Points.size(); } 00099 00101 itkSetMacro(EndType, unsigned int); 00102 itkGetConstMacro(EndType, unsigned int); 00104 00106 void Clear(void); 00107 00109 bool ComputeTangentAndNormals(void); 00110 00112 unsigned int RemoveDuplicatePoints(unsigned int step = 1); 00113 00116 bool IsEvaluableAt(const PointType & point, 00117 unsigned int depth = 0, char *name = NULL) const; 00118 00123 bool ValueAt(const PointType & point, double & value, 00124 unsigned int depth = 0, char *name = NULL) const; 00125 00127 bool IsInside(const PointType & point, 00128 unsigned int depth, char *name) const; 00129 00133 virtual bool IsInside(const PointType & point) const; 00134 00136 bool ComputeLocalBoundingBox() const; 00137 00140 itkSetMacro(ParentPoint, int); 00141 itkGetConstMacro(ParentPoint, int); 00143 00146 itkSetMacro(Root, bool); 00147 itkGetConstMacro(Root, bool); 00149 00151 itkSetMacro(Artery, bool); 00152 itkGetConstMacro(Artery, bool); 00154 00156 void CopyInformation(const DataObject *data); 00157 00158 protected: 00159 PointListType m_Points; 00160 00161 int m_ParentPoint; 00162 00163 unsigned int m_EndType; 00164 00165 bool m_Root; 00166 bool m_Artery; 00167 00168 TubeSpatialObject(); 00169 virtual ~TubeSpatialObject(); 00170 00172 virtual void PrintSelf(std::ostream & os, Indent indent) const; 00173 00175 mutable unsigned long m_OldMTime; 00176 mutable unsigned long m_IndexToWorldTransformMTime; 00177 private: 00178 TubeSpatialObject(const Self &); //purposely not implemented 00179 void operator=(const Self &); //purposely not implemented 00180 }; 00181 } // end namespace itk 00183 00184 #ifndef ITK_MANUAL_INSTANTIATION 00185 #include "itkTubeSpatialObject.hxx" 00186 #endif 00187 00188 #endif // __itkTubeSpatialObject_h 00189