ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkImageToRectilinearFEMObjectFilter.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 
00019 #ifndef __itkImageToRectilinearFEMObjectFilter_h
00020 #define __itkImageToRectilinearFEMObjectFilter_h
00021 
00022 #include "vnl/vnl_vector.h"
00023 #include "itkFEMObject.h"
00024 #include "itkProcessObject.h"
00025 
00026 namespace itk
00027 {
00028 namespace fem
00029 {
00042 template <class TInputImage>
00043 class ITK_EXPORT ImageToRectilinearFEMObjectFilter : public ProcessObject
00044 {
00045 public:
00047   typedef ImageToRectilinearFEMObjectFilter Self;
00048   typedef ProcessObject                     Superclass;
00049   typedef SmartPointer<Self>                Pointer;
00050   typedef SmartPointer<const Self>          ConstPointer;
00051 
00053   itkNewMacro(Self);
00054 
00056   itkTypeMacro(ImageToRectilinearFEMObjectFilter, ProcessObject);
00057 
00058   itkStaticConstMacro(NDimensions, unsigned int, TInputImage::ImageDimension);
00059 
00061   typedef TInputImage                           InputImageType;
00062   typedef typename InputImageType::Pointer      ImagePointer;
00063   typedef typename InputImageType::ConstPointer ImageConstPointer;
00064   typedef typename InputImageType::RegionType   ImageRegionType;
00065   typedef typename InputImageType::SizeType     ImageSizeType;
00066   typedef typename InputImageType::PointType    ImagePointType;
00067   typedef typename InputImageType::IndexType    ImageIndexType;
00068 
00070   typedef typename itk::fem::FEMObject<NDimensions> FEMObjectType;
00071   typedef typename FEMObjectType::Pointer           FEMObjectPointer;
00072   typedef typename FEMObjectType::ConstPointer      FEMObjectConstPointer;
00073   typedef typename DataObject::Pointer              DataObjectPointer;
00074 
00076   typedef itk::fem::MaterialLinearElasticity MaterialType;
00077   typedef MaterialType::Pointer              MaterialPointerType;
00078   // typedef itk::fem::Element2DC0LinearQuadrilateral  QuadElementBaseType;
00079   // typedef itk::fem::Element3DC0LinearHexahedron     HexElementBaseType;
00080   typedef itk::fem::Element               ElementBaseType;
00081   typedef itk::fem::Element::ConstPointer ElementBasePointerType;
00082 
00083 #ifdef ITK_USE_CONCEPT_CHECKING
00084 
00085 //  itkConceptMacro(SameDimensionOrMinusOne,
00086 //    (Concept::SameDimensionOrMinusOne<NDimensions, 3>));
00087 
00089 #endif
00090 
00094   itkGetMacro(PixelsPerElement, vnl_vector<unsigned int> );
00095   itkSetMacro(PixelsPerElement, vnl_vector<unsigned int> );
00096   void SetPixelsPerElement( unsigned int numPixels )
00097   {
00098     this->m_PixelsPerElement.fill( numPixels );
00099   }
00101 
00103   itkGetMacro(NumberOfElements, vnl_vector<unsigned int> );
00104 
00106   itkGetMacro(Material, MaterialPointerType);
00107   itkSetMacro(Material, MaterialPointerType);
00109 
00111   itkGetMacro(Element, ElementBasePointerType);
00112   itkSetMacro(Element, ElementBasePointerType);
00114 
00116   using Superclass::SetInput;
00117   void SetInput( InputImageType *image);
00118 
00119   void SetInput( unsigned int, InputImageType *image);
00120 
00121   InputImageType * GetInput(void);
00122 
00123   InputImageType * GetInput(unsigned int idx);
00124 
00127   typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
00128   using Superclass::MakeOutput;
00129   virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
00130 
00144   FEMObjectType * GetOutput(void);
00145 
00146   FEMObjectType * GetOutput(unsigned int idx);
00147 
00148 protected:
00149   ImageToRectilinearFEMObjectFilter();
00150   virtual ~ImageToRectilinearFEMObjectFilter() { }
00151   void PrintSelf(std::ostream& os, Indent indent) const;
00152 
00154   void  GenerateData();
00155 
00156   void Generate2DRectilinearMesh(void);
00157 
00158   void Generate3DRectilinearMesh(void);
00159 
00160 private:
00161   ImageToRectilinearFEMObjectFilter(const Self &); // purposely not implemented
00162   void operator=(const Self &);                    // purposely not implemented
00163 
00164   vnl_vector<unsigned int> m_NumberOfElements;
00165   vnl_vector<unsigned int> m_PixelsPerElement;
00166   MaterialPointerType      m_Material;
00167   ElementBasePointerType   m_Element;
00168 };
00169 
00170 }
00171 }  // end namespace itk::fem
00172 
00173 #ifndef ITK_MANUAL_INSTANTIATION
00174 #include "itkImageToRectilinearFEMObjectFilter.hxx"
00175 #endif
00176 
00177 #endif // #ifndef __itkImageToRectilinearFEMObjectFilter_h
00178