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 itkImageRegionSplitterDirection_h
19 #define itkImageRegionSplitterDirection_h
20 
21 #include "itkImageRegionSplitterBase.h"
22 
23 namespace itk
24 {
25 /** \class ImageRegionSplitterDirection
26  *
27  * Splits an Image region along the slowest axis not in the specified
28  * direction. This splitter can be used with image algorithms which
29  * operate in a specific direction, where the image should not be
30  * split along that dimension.
31  *
32  * \ingroup ITKCommon
33  */
34 class ITKCommon_EXPORT ImageRegionSplitterDirection
35   :public ImageRegionSplitterBase
36 {
37 public:
38   ITK_DISALLOW_COPY_AND_ASSIGN(ImageRegionSplitterDirection);
39 
40   /** Standard class type aliases. */
41   using Self = ImageRegionSplitterDirection;
42   using Superclass = ImageRegionSplitterBase;
43   using Pointer = SmartPointer< Self >;
44   using ConstPointer = SmartPointer< const Self >;
45 
46   /** Method for creation through the object factory. */
47   itkNewMacro(Self);
48 
49   /** Run-time type information (and related methods). */
50   itkTypeMacro(ImageRegionSplitterDirection, ImageRegionSplitterBase);
51 
52   /** Get the direction in which not to split the image.*
53    *
54    * Defaults to 0.
55    */
56   itkGetConstMacro(Direction, unsigned int);
57   itkSetMacro(Direction, unsigned int);
58 
59 
60 protected:
61 
62   ImageRegionSplitterDirection();
63 
64 
65   unsigned int GetNumberOfSplitsInternal(unsigned int dim,
66                                                  const IndexValueType regionIndex[],
67                                                  const SizeValueType regionSize[],
68                                                  unsigned int requestedNumber) const override;
69 
70   unsigned int GetSplitInternal(unsigned int dim,
71                                         unsigned int i,
72                                         unsigned int numberOfPieces,
73                                         IndexValueType regionIndex[],
74                                         SizeValueType regionSize[]) const override;
75 
76   void PrintSelf(std::ostream & os, Indent indent) const override;
77 
78 private:
79   unsigned int m_Direction;
80 };
81 } // end namespace itk
82 
83 #endif
84