00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkBresenhamLine.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-06-03 12:48:05 $ 00007 Version: $Revision: 1.2 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #ifndef __itkBresenhamLine_h 00019 #define __itkBresenhamLine_h 00020 00021 #include "itkVector.h" 00022 #include "itkOffset.h" 00023 #include "itkIndex.h" 00024 #include <vector> 00025 00026 namespace itk { 00027 00028 /* a simple class that will return an array of indexes that are 00029 * offsets along the line. The line will be described by a vector and a 00030 * length */ 00031 00032 template <unsigned int VDimension> 00033 class ITK_EXPORT BresenhamLine 00034 { 00035 public: 00036 typedef BresenhamLine Self; 00037 // This defines the line direction 00038 typedef Vector<float, VDimension> LType; 00039 typedef Offset<VDimension> OffsetType; 00040 typedef Index<VDimension> IndexType; 00041 typedef std::vector<OffsetType> OffsetArray; 00042 00043 typedef typename IndexType::IndexValueType IndexValueType; 00044 00045 // constructurs 00046 BresenhamLine(){} 00047 ~BresenhamLine(){} 00048 00049 OffsetArray BuildLine(LType Direction, unsigned int length); 00050 00051 }; 00052 00053 00054 } 00055 00056 00057 #ifndef ITK_MANUAL_INSTANTIATION 00058 #include "itkBresenhamLine.txx" 00059 #endif 00060 00061 00062 #endif 00063