ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkPolylineMaskImageFilter.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 __itkPolylineMaskImageFilter_h
00019 #define __itkPolylineMaskImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 #include "itkImageRegionIteratorWithIndex.h"
00023 
00024 namespace itk
00025 {
00036 template< class TInputImage, class TPolyline, class TVector,
00037           class TOutputImage >
00038 class ITK_EXPORT PolylineMaskImageFilter:public ImageToImageFilter< TInputImage, TOutputImage >
00039 {
00040 public:
00042   typedef PolylineMaskImageFilter                         Self;
00043   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00044   typedef SmartPointer< Self >                            Pointer;
00045   typedef SmartPointer< const Self >                      ConstPointer;
00046 
00048   itkNewMacro(Self);
00049 
00051   itkTypeMacro(PolylineMaskImageFilter, ImageToImageFilter);
00052 
00054   itkStaticConstMacro(NDimensions, unsigned int,
00055                       TInputImage::ImageDimension);
00056 
00057   itkStaticConstMacro(InputDimension, unsigned int, 3);
00058 
00060   typedef TInputImage                           InputImageType;
00061   typedef typename InputImageType::ConstPointer InputImagePointer;
00062   typedef typename InputImageType::RegionType   InputImageRegionType;
00063   typedef typename InputImageType::PixelType    InputImagePixelType;
00064   typedef Point< double, 3 >                    PointType;
00065   typedef Point< double, 2 >                    ProjPlanePointType;
00066 
00068   typedef Matrix< double, itkGetStaticConstMacro(InputDimension), itkGetStaticConstMacro(InputDimension) > MatrixType;
00069 
00071   typedef TVector VectorType;
00072 
00073   /* typedef for the polyline type */
00074   typedef TPolyline PolylineType;
00075 
00076   /* typedef for the output image */
00077   typedef TOutputImage                         OutputImageType;
00078   typedef typename OutputImageType::Pointer    OutputImagePointer;
00079   typedef typename OutputImageType::RegionType OutputImageRegionType;
00080   typedef typename OutputImageType::PixelType  OutputImagePixelType;
00081 
00083   void SetInput1(const InputImageType *image);
00084 
00085   void SetInput2(const PolylineType *polyline);
00086 
00088   itkSetMacro(ViewVector, VectorType);
00089   itkGetConstMacro(ViewVector, VectorType);
00091 
00093   itkSetMacro(UpVector, VectorType);
00094   itkGetConstMacro(UpVector, VectorType);
00096 
00098   itkSetMacro(CameraCenterPoint, PointType);
00099   itkGetConstMacro(CameraCenterPoint, PointType);
00101 
00103   itkSetMacro(FocalDistance, double);
00104   itkGetConstMacro(FocalDistance, double);
00106 
00108   itkSetMacro(FocalPoint, ProjPlanePointType);
00109   itkGetConstMacro(FocalPoint, ProjPlanePointType);
00111 
00112   /* Roatation matrix generation matrix */
00113   void GenerateRotationMatrix();
00114 
00115   /* 3D Point transforming and projecting function */
00116   ProjPlanePointType TransformProjectPoint(PointType inputPoint);
00117 
00118   /* Generate Data */
00119   void GenerateData(void);
00120 
00121 #ifdef ITK_USE_CONCEPT_CHECKING
00122 
00123   itkConceptMacro( VectorHasNumericTraitsCheck,
00124                    ( Concept::HasNumericTraits< typename VectorType::ValueType > ) );
00125 
00127 #endif
00128 protected:
00129   PolylineMaskImageFilter();
00130   virtual ~PolylineMaskImageFilter() {}
00131   void PrintSelf(std::ostream & os, Indent indent) const;
00133 
00134 private:
00135   PolylineMaskImageFilter(const Self &); //purposely not implemented
00136   void operator=(const Self &);          //purposely not implemented
00137 
00138   /* viewing direction and up vector */
00139   VectorType m_ViewVector;
00140   VectorType m_UpVector;
00141 
00143   MatrixType m_RotationMatrix;
00144 
00146   PointType m_CameraCenterPoint;
00147 
00149   ProjPlanePointType m_FocalPoint;
00150 
00151   /* focal distance of the camera */
00152   double m_FocalDistance;
00153 };
00154 } // end namespace itk
00155 
00156 #ifndef ITK_MANUAL_INSTANTIATION
00157 #include "itkPolylineMaskImageFilter.hxx"
00158 #endif
00159 
00160 #endif
00161