ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkBlobSpatialObject.h
Go to the documentation of this file.
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 __itkBlobSpatialObject_h
00019 #define __itkBlobSpatialObject_h
00020 
00021 #include <list>
00022 
00023 #include "itkPointBasedSpatialObject.h"
00024 
00025 namespace itk
00026 {
00045 template< unsigned int TDimension = 3 >
00046 class ITK_EXPORT BlobSpatialObject:
00047   public PointBasedSpatialObject<  TDimension >
00048 {
00049 public:
00050 
00051   typedef BlobSpatialObject                            Self;
00052   typedef PointBasedSpatialObject< TDimension >        Superclass;
00053   typedef SmartPointer< Self >                         Pointer;
00054   typedef SmartPointer< const Self >                   ConstPointer;
00055   typedef double                                       ScalarType;
00056   typedef SpatialObjectPoint< TDimension >             BlobPointType;
00057   typedef std::vector< BlobPointType >                 PointListType;
00058   typedef typename Superclass::PointType               PointType;
00059   typedef typename Superclass::SpatialObjectPointType  SpatialObjectPointType;
00060   typedef typename Superclass::TransformType           TransformType;
00061   typedef typename Superclass::BoundingBoxType         BoundingBoxType;
00062   typedef VectorContainer< IdentifierType, PointType > PointContainerType;
00063   typedef SmartPointer< PointContainerType >           PointContainerPointer;
00064 
00066   itkNewMacro(Self);
00067 
00069   itkTypeMacro(BlobSpatialObject, SpatialObject);
00070 
00072   PointListType & GetPoints(void);
00073 
00075   const PointListType & GetPoints(void) const;
00076 
00078   void SetPoints(PointListType & newPoints);
00079 
00081   const SpatialObjectPointType * GetPoint(IdentifierType id) const
00082   {
00083     return &( m_Points[id] );
00084   }
00085 
00087   SpatialObjectPointType * GetPoint(IdentifierType id) { return &( m_Points[id] ); }
00088 
00090   SizeValueType GetNumberOfPoints(void) const { return m_Points.size(); }
00091 
00094   bool IsEvaluableAt(const PointType & point,
00095                      unsigned int depth = 0, char *name = NULL) const;
00096 
00101   bool ValueAt(const PointType & point, double & value,
00102                unsigned int depth = 0, char *name = NULL) const;
00103 
00105   bool IsInside(const PointType & point,
00106                 unsigned int depth, char *name) const;
00107 
00111   bool IsInside(const PointType & point) const;
00112 
00114   bool ComputeLocalBoundingBox() const;
00115 
00116 protected:
00117   BlobSpatialObject(const Self &); //purposely not implemented
00118   void operator=(const Self &);    //purposely not implemented
00119 
00120   PointListType m_Points;
00121 
00122   BlobSpatialObject();
00123   virtual ~BlobSpatialObject();
00124 
00126   virtual void PrintSelf(std::ostream & os, Indent indent) const;
00127 };
00128 } // end namespace itk
00129 
00130 #ifndef ITK_MANUAL_INSTANTIATION
00131 #include "itkBlobSpatialObject.hxx"
00132 #endif
00133 
00134 #endif // __itkBlobSpatialObject_h
00135