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 __itkSpatialObjectToImageFilter_h 00019 #define __itkSpatialObjectToImageFilter_h 00020 00021 #include "itkImageSource.h" 00022 #include "itkConceptChecking.h" 00023 00024 namespace itk 00025 { 00039 template< class TInputSpatialObject, class TOutputImage > 00040 class ITK_EXPORT SpatialObjectToImageFilter:public ImageSource< TOutputImage > 00041 { 00042 public: 00044 typedef SpatialObjectToImageFilter Self; 00045 typedef ImageSource< TOutputImage > Superclass; 00046 typedef SmartPointer< Self > Pointer; 00047 typedef SmartPointer< const Self > ConstPointer; 00048 00049 typedef TOutputImage OutputImageType; 00050 typedef typename OutputImageType::SizeType SizeType; 00051 typedef typename OutputImageType::PointType PointType; 00052 typedef typename OutputImageType::Pointer OutputImagePointer; 00053 typedef typename OutputImageType::ValueType ValueType; 00054 typedef typename OutputImageType::SpacingType SpacingType; 00055 typedef typename OutputImageType::DirectionType DirectionType; 00056 00058 itkNewMacro(Self); 00059 00061 itkTypeMacro(SpatialObjectToImageFilter, ImageSource); 00062 00064 typedef typename Superclass::OutputImageRegionType OutputImageRegionType; 00065 00067 typedef TInputSpatialObject InputSpatialObjectType; 00068 typedef typename InputSpatialObjectType::Pointer InputSpatialObjectPointer; 00069 typedef typename InputSpatialObjectType::ConstPointer InputSpatialObjectConstPointer; 00070 typedef typename TInputSpatialObject::ChildrenListType ChildrenListType; 00071 00073 itkStaticConstMacro(ObjectDimension, unsigned int, 00074 InputSpatialObjectType::ObjectDimension); 00075 00076 itkStaticConstMacro(OutputImageDimension, unsigned int, 00077 TOutputImage::ImageDimension); 00078 00080 using Superclass::SetInput; 00081 virtual void SetInput(const InputSpatialObjectType *object); 00082 00083 virtual void SetInput(unsigned int, const InputSpatialObjectType *object); 00084 00085 const InputSpatialObjectType * GetInput(void); 00086 00087 const InputSpatialObjectType * GetInput(unsigned int idx); 00088 00093 virtual void SetSpacing(const SpacingType & spacing); 00094 00095 virtual void SetSpacing(const double *spacing); 00096 00097 virtual void SetSpacing(const float *spacing); 00098 00099 virtual const double * GetSpacing(void) const; 00100 00103 virtual void SetDirection(const DirectionType & direction); 00104 00105 virtual const DirectionType & GetDirection(void) const; 00106 00113 itkSetMacro(InsideValue, ValueType); 00114 itkGetConstMacro(InsideValue, ValueType); 00116 00123 itkSetMacro(OutsideValue, ValueType); 00124 itkGetConstMacro(OutsideValue, ValueType); 00126 00131 virtual void SetOrigin(const PointType & origin); 00132 00133 virtual void SetOrigin(const double *origin); 00134 00135 virtual void SetOrigin(const float *origin); 00136 00137 virtual const double * GetOrigin(void) const; 00138 00143 itkSetMacro(ChildrenDepth, unsigned int); 00144 itkGetConstMacro(ChildrenDepth, unsigned int); 00146 00148 itkSetMacro(Size, SizeType); 00149 itkGetConstMacro(Size, SizeType); 00151 00154 itkSetMacro(UseObjectValue, bool); 00155 itkGetConstMacro(UseObjectValue, bool); 00156 protected: 00157 SpatialObjectToImageFilter(); 00158 ~SpatialObjectToImageFilter(); 00160 00161 virtual void GenerateOutputInformation(){} // do nothing 00162 virtual void GenerateData(); 00163 00164 SizeType m_Size; 00165 double m_Spacing[OutputImageDimension]; 00166 double m_Origin[OutputImageDimension]; 00167 DirectionType m_Direction; 00168 00169 unsigned int m_ChildrenDepth; 00170 00171 ValueType m_InsideValue; 00172 ValueType m_OutsideValue; 00173 00174 bool m_UseObjectValue; 00175 00176 virtual void PrintSelf(std::ostream & os, Indent indent) const; 00177 00178 private: 00179 00180 SpatialObjectToImageFilter(const Self &); //purposely not implemented 00181 void operator=(const Self &); //purposely not implemented 00182 }; 00183 } // end namespace itk 00184 00185 #ifndef ITK_MANUAL_INSTANTIATION 00186 #include "itkSpatialObjectToImageFilter.hxx" 00187 #endif 00188 00189 #endif 00190