ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkSharedMorphologyUtilities.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkSharedMorphologyUtilities_h
19 #define itkSharedMorphologyUtilities_h
20 
21 #include <list>
22 #include <vector>
23 
24 namespace itk
25 {
26 template< typename TRegion, typename TLine >
27 bool NeedToDoFace(const TRegion AllImage,
28  const TRegion face,
29  const TLine line);
30 
31 template< typename TImage, typename TBres, typename TLine >
32 int ComputeStartEnd(const typename TImage::IndexType StartIndex,
33  const TLine line,
34  const float tol,
35  const typename TBres::OffsetArray LineOffsets,
36  const typename TImage::RegionType AllImage,
37  unsigned & start,
38  unsigned & end);
39 
40 template< typename TImage, typename TBres, typename TLine >
41 int FillLineBuffer(typename TImage::ConstPointer input,
42  const typename TImage::IndexType StartIndex,
43  const TLine line,
44  const float tol,
45  const typename TBres::OffsetArray LineOffsets,
46  const typename TImage::RegionType AllImage,
47  std::vector<typename TImage::PixelType> & inbuffer,
48  unsigned int &start,
49  unsigned int &end);
50 
51 template< typename TImage, typename TBres >
52 void CopyLineToImage(const typename TImage::Pointer output,
53  const typename TImage::IndexType StartIndex,
54  const typename TBres::OffsetArray LineOffsets,
55  std::vector<typename TImage::PixelType> & outbuffer,
56  const unsigned start,
57  const unsigned end);
58 
59 // This returns a face with a normal between +/- 45 degrees of the
60 // line. The face is enlarged so that AllImage is entirely filled by
61 // lines starting from every pixel in the face. This means that some
62 // of the region will not touch the image. This approach is necessary
63 // because we want to be able to sweep the lines in a fashion that
64 // does not have overlap between them.
65 template< typename TInputImage, typename TLine >
66 typename TInputImage::RegionType
67 MakeEnlargedFace(const TInputImage *input,
68  const typename TInputImage::RegionType AllImage,
69  const TLine line);
70 
71 // figure out the correction factor for length->pixel count based on
72 // line angle
73 template< typename TLine >
74 unsigned int GetLinePixels(const TLine line);
75 
76 } // namespace itk
77 
78 #ifndef ITK_MANUAL_INSTANTIATION
79 #include "itkSharedMorphologyUtilities.hxx"
80 #endif
81 
82 #endif
bool NeedToDoFace(const TRegion AllImage, const TRegion face, const TLine line)
int ComputeStartEnd(const typename TImage::IndexType StartIndex, const TLine line, const float tol, const typename TBres::OffsetArray LineOffsets, const typename TImage::RegionType AllImage, unsigned &start, unsigned &end)
unsigned int GetLinePixels(const TLine line)
TInputImage::RegionType MakeEnlargedFace(const TInputImage *input, const typename TInputImage::RegionType AllImage, const TLine line)
void CopyLineToImage(const typename TImage::Pointer output, const typename TImage::IndexType StartIndex, const typename TBres::OffsetArray LineOffsets, std::vector< typename TImage::PixelType > &outbuffer, const unsigned start, const unsigned end)
int FillLineBuffer(typename TImage::ConstPointer input, const typename TImage::IndexType StartIndex, const TLine line, const float tol, const typename TBres::OffsetArray LineOffsets, const typename TImage::RegionType AllImage, std::vector< typename TImage::PixelType > &inbuffer, unsigned int &start, unsigned int &end)