ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkSpatialObjectToPointSetFilter.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 __itkSpatialObjectToPointSetFilter_h
00019 #define __itkSpatialObjectToPointSetFilter_h
00020 
00021 #include "itkPointSet.h"
00022 #include "itkMeshSource.h"
00023 #include "itkPointBasedSpatialObject.h"
00024 
00025 namespace itk
00026 {
00033 template< class TInputSpatialObject, class TOutputPointSet >
00034 class ITK_EXPORT SpatialObjectToPointSetFilter:public MeshSource< TOutputPointSet >
00035 {
00036 public:
00038   typedef SpatialObjectToPointSetFilter Self;
00039   typedef MeshSource< TOutputPointSet > Superclass;
00040   typedef SmartPointer< Self >          Pointer;
00041   typedef SmartPointer< const Self >    ConstPointer;
00042 
00043   typedef TOutputPointSet                      OutputPointSetType;
00044   typedef typename OutputPointSetType::Pointer OutputPointSetPointer;
00045 
00047   typedef DataObject::Pointer DataObjectPointer;
00048 
00050   itkNewMacro(Self);
00051 
00053   itkTypeMacro(SpatialObjectToPointSetFilter, ProcessObject);
00054 
00056   typedef TInputSpatialObject                            InputSpatialObjectType;
00057   typedef typename InputSpatialObjectType::Pointer       InputSpatialObjectPointer;
00058   typedef typename InputSpatialObjectType::ConstPointer  InputSpatialObjectConstPointer;
00059   typedef typename TInputSpatialObject::ChildrenListType ChildrenListType;
00060 
00062   itkStaticConstMacro(ObjectDimension, unsigned int,
00063                       InputSpatialObjectType::ObjectDimension);
00064 
00065   typedef itk::SpatialObjectPoint< itkGetStaticConstMacro(ObjectDimension) >      PointType;
00066   typedef itk::PointBasedSpatialObject< itkGetStaticConstMacro(ObjectDimension) > PointBasedSpatialObjectType;
00067 
00069   using Superclass::SetInput;
00070   virtual void SetInput(const InputSpatialObjectType *object);
00071 
00072   virtual void SetInput(unsigned int, const InputSpatialObjectType *object);
00073 
00074   const InputSpatialObjectType * GetInput(void);
00075 
00076   const InputSpatialObjectType * GetInput(unsigned int idx);
00077 
00082   itkSetMacro(ChildrenDepth, unsigned int);
00083   itkGetConstMacro(ChildrenDepth, unsigned int);
00085 
00086   /* Set the sampling factor of the object. The resulting pointset will have a size
00087    * inversely proportional to the sampling factor.*/
00088   itkSetMacro(SamplingFactor, unsigned int);
00089   itkGetConstMacro(SamplingFactor, unsigned int);
00090 protected:
00091   SpatialObjectToPointSetFilter();
00092   ~SpatialObjectToPointSetFilter();
00093 
00094   virtual void GenerateOutputInformation(){}  // do nothing
00095   virtual void GenerateData();
00096 
00097   unsigned int m_ChildrenDepth;
00098 
00099   virtual void PrintSelf(std::ostream & os, Indent indent) const;
00100 
00101 private:
00102   SpatialObjectToPointSetFilter(const Self &); //purposely not implemented
00103   void operator=(const Self &);                //purposely not implemented
00104 
00105   unsigned int m_SamplingFactor; //default 1
00106 };
00107 } // end namespace itk
00108 
00109 #ifndef ITK_MANUAL_INSTANTIATION
00110 #include "itkSpatialObjectToPointSetFilter.hxx"
00111 #endif
00112 
00113 #endif
00114