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 itkFloodFilledImageFunctionConditionalConstIterator_h 19 #define itkFloodFilledImageFunctionConditionalConstIterator_h 20 21 #include "itkFloodFilledFunctionConditionalConstIterator.h" 22 23 namespace itk 24 { 25 /** 26 * \class FloodFilledImageFunctionConditionalConstIterator 27 * \brief Iterates over a flood-filled image function with read-only 28 * access to pixels. 29 * 30 * \ingroup ImageIterators 31 * 32 * \ingroup ITKCommon 33 */ 34 template< typename TImage, typename TFunction > 35 class ITK_TEMPLATE_EXPORT FloodFilledImageFunctionConditionalConstIterator: 36 public FloodFilledFunctionConditionalConstIterator< TImage, TFunction > 37 { 38 public: 39 /** Standard class type aliases. */ 40 using Self = FloodFilledImageFunctionConditionalConstIterator< TImage, TFunction >; 41 using Superclass = FloodFilledFunctionConditionalConstIterator< TImage, TFunction >; 42 43 /** Type of function */ 44 using FunctionType = typename Superclass::FunctionType; 45 46 /** Type of vector used to store location info in the spatial function */ 47 using FunctionInputType = typename Superclass::FunctionInputType; 48 49 /** Index type alias support. */ 50 using IndexType = typename Superclass::IndexType; 51 52 /** Index ContainerType. */ 53 using SeedsContainerType = typename Superclass::SeedsContainerType; 54 55 /** Size type alias support. */ 56 using SizeType = typename Superclass::SizeType; 57 58 /** Region type alias support */ 59 using RegionType = typename Superclass::RegionType; 60 61 /** Image type alias support. */ 62 using ImageType = typename Superclass::ImageType; 63 64 /** Internal Pixel Type */ 65 using InternalPixelType = typename Superclass::InternalPixelType; 66 67 /** External Pixel Type */ 68 using PixelType = typename Superclass::PixelType; 69 70 /** Dimension of the image the iterator walks. This constant is needed so 71 * functions that are templated over image iterator type (as opposed to 72 * being templated over pixel type and dimension) can have compile time 73 * access to the dimension of the image that the iterator walks. */ 74 static constexpr unsigned int NDimensions = Superclass::NDimensions; 75 76 /** Constructor establishes an iterator to walk a particular image and a 77 * particular region of that image. This version of the constructor uses 78 * an explicit seed pixel for the flood fill, the "startIndex" */ FloodFilledImageFunctionConditionalConstIterator(const ImageType * imagePtr,FunctionType * fnPtr,IndexType startIndex)79 FloodFilledImageFunctionConditionalConstIterator( 80 const ImageType *imagePtr, 81 FunctionType *fnPtr, 82 IndexType startIndex):Superclass(imagePtr, 83 fnPtr, 84 startIndex) {} 85 86 /** Constructor establishes an iterator to walk a particular image and a 87 * particular region of that image. This version of the constructor uses 88 * an explicit list of seed pixels for the flood fill, the "startIndex" */ FloodFilledImageFunctionConditionalConstIterator(const ImageType * imagePtr,FunctionType * fnPtr,std::vector<IndexType> & startIndex)89 FloodFilledImageFunctionConditionalConstIterator( 90 const ImageType *imagePtr, 91 FunctionType *fnPtr, 92 std::vector< IndexType > & startIndex):Superclass(imagePtr, 93 fnPtr, 94 startIndex) {} 95 96 /** Constructor establishes an iterator to walk a particular image and a 97 * particular region of that image. This version of the constructor 98 * should be used when the seed pixel is unknown. */ FloodFilledImageFunctionConditionalConstIterator(const ImageType * imagePtr,FunctionType * fnPtr)99 FloodFilledImageFunctionConditionalConstIterator( 100 const ImageType *imagePtr, 101 FunctionType *fnPtr):Superclass(imagePtr, 102 fnPtr) {} 103 /** Default Destructor. */ 104 ~FloodFilledImageFunctionConditionalConstIterator() override = default; 105 106 /** Compute whether the index of interest should be included in the flood */ 107 bool IsPixelIncluded(const IndexType & index) const override; 108 }; 109 } // end namespace itk 110 111 #ifndef ITK_MANUAL_INSTANTIATION 112 #include "itkFloodFilledImageFunctionConditionalConstIterator.hxx" 113 #endif 114 115 #endif 116