ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkSharedMorphologyUtilities.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 __itkSharedMorphologyUtilities_h
00019 #define __itkSharedMorphologyUtilities_h
00020 
00021 #include <list>
00022 #include <vector>
00023 
00024 namespace itk
00025 {
00026 template< class TRegion, class TLine >
00027 bool NeedToDoFace(const TRegion AllImage,
00028                   const TRegion face,
00029                   const TLine line);
00030 
00031 template< class TImage, class TBres, class TLine >
00032 int ComputeStartEnd(const typename TImage::IndexType StartIndex,
00033                     const TLine line,
00034                     const float tol,
00035                     const typename TBres::OffsetArray LineOffsets,
00036                     const typename TImage::RegionType AllImage,
00037                     unsigned & start,
00038                     unsigned & end);
00039 
00040 template< class TImage, class TBres, class TLine >
00041 int FillLineBuffer(typename TImage::ConstPointer input,
00042                    const typename TImage::IndexType StartIndex,
00043                    const TLine line,
00044                    const float tol,
00045                    const typename TBres::OffsetArray LineOffsets,
00046                    const typename TImage::RegionType AllImage,
00047                    std::vector<typename TImage::PixelType> & inbuffer,
00048                    unsigned int &start,
00049                    unsigned int &end);
00050 
00051 template< class TImage, class TBres >
00052 void CopyLineToImage(const typename TImage::Pointer output,
00053                      const typename TImage::IndexType StartIndex,
00054                      const typename TBres::OffsetArray LineOffsets,
00055                      std::vector<typename TImage::PixelType> & outbuffer,
00056                      const unsigned start,
00057                      const unsigned end);
00058 
00059 // This returns a face with a normal between +/- 45 degrees of the
00060 // line. The face is enlarged so that AllImage is entirely filled by
00061 // lines starting from every pixel in the face. This means that some
00062 // of the region will not touch the image. This approach is necessary
00063 // because we want to be able to sweep the lines in a fashion that
00064 // does not have overlap between them.
00065 template< class TInputImage, class TLine >
00066 typename TInputImage::RegionType
00067 MakeEnlargedFace(const TInputImage *input,
00068                  const typename TInputImage::RegionType AllImage,
00069                  const TLine line);
00070 
00071 // figure out the correction factor for length->pixel count based on
00072 // line angle
00073 template< class TLine >
00074 unsigned int GetLinePixels(const TLine line);
00075 
00076 } // namespace itk
00077 
00078 #ifndef ITK_MANUAL_INSTANTIATION
00079 #include "itkSharedMorphologyUtilities.hxx"
00080 #endif
00081 
00082 #endif
00083