32 #ifndef itkOrthogonalContourExtractor2DImageFilter_h
33 #define itkOrthogonalContourExtractor2DImageFilter_h
35 #include <itkImageToPathFilter.h>
36 #include <itkNumericTraits.h>
37 #include <itkPolyLineParametricPath.h>
38 #include <itkConceptChecking.h>
39 #include <itksys/hash_map.hxx>
40 #include <vcl_deque.h>
105 template <
class TInputImage>
107 public ImageToPathFilter< TInputImage, PolyLineParametricPath<2> >
111 itkStaticConstMacro(InputImageDimension,
unsigned int,
112 TInputImage::ImageDimension);
120 typedef ImageToPathFilter<InputImageType, OutputPathType>
Superclass;
143 typedef typename VertexListType::ConstPointer
147 itkSetMacro(ReverseContourOrientation,
bool);
148 itkGetConstReferenceMacro(ReverseContourOrientation,
bool);
149 itkBooleanMacro(ReverseContourOrientation);
154 itkSetMacro(VertexConnectHighPixels,
bool);
155 itkGetConstReferenceMacro(VertexConnectHighPixels,
bool);
156 itkBooleanMacro(VertexConnectHighPixels);
160 void SetRequestedRegion(
const InputRegionType region);
161 itkGetConstReferenceMacro(RequestedRegion, InputRegionType);
162 void ClearRequestedRegion();
166 itkSetMacro(ContourValue,InputRealType);
167 itkGetConstReferenceMacro(ContourValue, InputRealType);
170 #ifdef ITK_USE_CONCEPT_CHECKING
172 itkConceptMacro(DimensionShouldBe2,
173 (Concept::SameDimension<itkGetStaticConstMacro(InputImageDimension),2>));
174 itkConceptMacro(InputPixelTypeComparable,
175 (Concept::Comparable<InputPixelType>));
176 itkConceptMacro(InputHasPixelTraitsCheck,
177 (Concept::HasPixelTraits<InputPixelType>));
178 itkConceptMacro(InputHasNumericTraitsCheck,
179 (Concept::HasNumericTraits<InputPixelType>));
187 void PrintSelf(std::ostream& os, Indent indent)
const;
194 virtual void GenerateInputRequestedRegion()
195 throw(InvalidRequestedRegionError);
198 VertexType InterpolateContourPosition(InputPixelType fromValue,
199 InputPixelType toValue,
200 InputIndexType fromIndex,
201 InputOffsetType toOffset);
202 void AddSegment(const VertexType from, const VertexType to);
205 void operator=(const Self&);
207 InputRealType m_ContourValue;
208 bool m_ReverseContourOrientation;
209 bool m_VertexConnectHighPixels;
210 bool m_UseCustomRegion;
211 InputRegionType m_RequestedRegion;
212 unsigned int m_NumberOfContoursCreated;
229 class ContourType : public vcl_deque<VertexType>
232 unsigned int m_ContourNumber;
238 typedef vcl_list<ContourType> ContourContainer;
239 typedef typename ContourContainer::iterator ContourRef;
244 typedef typename VertexType::CoordRepType CoordinateType;
245 inline size_t operator()(
const VertexType& k)
const
251 const size_t hashVertex1 = this->float_hash(k[0] * 0xbeef);
252 const size_t hashVertex2 = this->float_hash(k[1]);
253 const size_t hashValue = hashVertex1 ^ hashVertex2;
259 inline size_t float_hash(
const CoordinateType &k)
const
266 CoordinateType mantissa = vcl_frexp(k, &exponent);
267 size_t value =
static_cast<size_t>(vcl_fabs(mantissa));
268 value = ( 2 * value - 1 ) * ~0U;
285 typedef itksys::hash_map<VertexType, ContourRef, VertexHash> VertexToContourMap;
286 typedef typename VertexToContourMap::iterator VertexMapIterator;
287 typedef typename VertexToContourMap::value_type VertexContourRefPair;
290 ContourContainer m_Contours;
293 VertexToContourMap m_ContourStarts;
294 VertexToContourMap m_ContourEnds;
300 #ifndef ITK_MANUAL_INSTANTIATION
301 #include "itkOrthogonalContourExtractor2DImageFilter.txx"
Definition: niftkITKAffineResampleImage.cxx:74
ImageType::IndexType IndexType
Definition: niftkMakeLapUSProbeBasicModel.cxx:32
GLsizei const GLfloat * value
Definition: glew.h:1833
float PixelType
Definition: niftkBreastDCEandADC.cxx:88
ImageType::RegionType RegionType
Definition: niftkMakeLapUSProbeBasicModel.cxx:30