SimpleITK  1.0.1
itkSliceImageFilter.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 itkSliceImageFilter_h
19 #define itkSliceImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 
23 namespace itk
24 {
55 template< class TInputImage, class TOutputImage >
56 class ITK_EXPORT SliceImageFilter:
57  public ImageToImageFilter< TInputImage, TOutputImage >
58 {
59 public:
61  typedef SliceImageFilter Self;
62  typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
63  typedef SmartPointer< Self > Pointer;
64  typedef SmartPointer< const Self > ConstPointer;
65 
67  itkNewMacro(Self);
68 
70  itkTypeMacro(SliceImageFilter, ImageToImageFilter);
71 
73  typedef TOutputImage OutputImageType;
74  typedef TInputImage InputImageType;
75  typedef typename OutputImageType::Pointer OutputImagePointer;
76  typedef typename InputImageType::Pointer InputImagePointer;
77  typedef typename InputImageType::ConstPointer InputImageConstPointer;
78 
79  typedef typename TOutputImage::IndexType OutputIndexType;
80  typedef typename TInputImage::IndexType InputIndexType;
81  typedef typename TOutputImage::OffsetType OutputOffsetType;
82 
84  typedef typename TOutputImage::RegionType OutputImageRegionType;
85 
87  itkStaticConstMacro(ImageDimension, unsigned int,
88  TInputImage::ImageDimension);
89  itkStaticConstMacro(OutputImageDimension, unsigned int,
90  TOutputImage::ImageDimension);
91 
92 
93  typedef typename InputImageType::IndexType IndexType;
94  typedef typename InputIndexType::IndexValueType IndexValueType;
95  typedef FixedArray< int, ImageDimension > ArrayType;
96 
98  itkSetMacro(Start, IndexType);
99  itkGetConstReferenceMacro(Start, IndexType);
100  void SetStart(IndexValueType start);
101 
103  itkSetMacro(Stop, IndexType);
104  itkGetConstReferenceMacro(Stop, IndexType);
105  void SetStop(IndexValueType stop);
106 
111  itkSetMacro(Step, ArrayType);
112  itkGetConstReferenceMacro(Step, ArrayType);
113  void SetStep( int step);
114 
119  virtual void GenerateOutputInformation() ITK_OVERRIDE;
120 
121  virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
122 
123 #ifdef ITK_USE_CONCEPT_CHECKING
124 
125  itkConceptMacro( InputConvertibleToOutputCheck,
126  ( Concept::Convertible< typename TInputImage::PixelType, typename TOutputImage::PixelType > ) );
127  itkConceptMacro( SameDimensionCheck,
128  ( Concept::SameDimension< ImageDimension, OutputImageDimension > ) );
130 #endif
131 
132 protected:
133  SliceImageFilter();
134  // ~SliceImageFilter() {} default ok
135  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
136 
147  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
148  ThreadIdType threadId) ITK_OVERRIDE;
149 
150  void VerifyInputInformation() ITK_OVERRIDE;
151 
152 private:
153  SliceImageFilter(const Self &); //purposely not implemented
154  void operator=(const Self &); //purposely not implemented
155 
156  IndexType m_Start;
157  IndexType m_Stop;
158  ArrayType m_Step;
159 };
160 } // end namespace itk
161 
162 #ifndef ITK_MANUAL_INSTANTIATION
163 #include "itkSliceImageFilter.hxx"
164 #endif
165 
166 #endif
signed long IndexValueType
unsigned int ThreadIdType
#define itkConceptMacro(name, concept)