ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkRLERegionOfInterestImageFilter.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 itkRLERegionOfInterestImageFilter_h
19 #define itkRLERegionOfInterestImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 #include "itkRLEImage.h"
24 #include "itkSmartPointer.h"
25 
26 namespace itk
27 {
47 template< typename TPixel, unsigned int VImageDimension, typename CounterType >
48 class RegionOfInterestImageFilter< RLEImage< TPixel, VImageDimension, CounterType >,
49  RLEImage< TPixel, VImageDimension, CounterType > > :
50  public ImageToImageFilter< RLEImage< TPixel, VImageDimension, CounterType >,
51  RLEImage< TPixel, VImageDimension, CounterType > >
52 {
53 public:
62 
64  itkNewMacro( Self );
65 
68 
70  typedef typename RLEImageType::RegionType RegionType;
72  typedef typename RLEImageType::SizeType SizeType;
73 
77 
79  itkSetMacro( RegionOfInterest, RegionType );
80  itkGetConstMacro( RegionOfInterest, RegionType );
82 
84  itkStaticConstMacro( ImageDimension, unsigned int, VImageDimension );
85  itkStaticConstMacro( OutputImageDimension, unsigned int, VImageDimension );
87 
88 #ifdef ITK_USE_CONCEPT_CHECKING
89  // Begin concept checking
91  itkConceptMacro( InputConvertibleToOutputCheck,
93 // End concept checking
94 #endif
95 
96 protected:
99  void
100  PrintSelf( std::ostream& os, Indent indent ) const;
101 
102  virtual void
104 
105  virtual void
107 
116  virtual void
118 
128  void
129  ThreadedGenerateData( const RegionType& outputRegionForThread, ThreadIdType threadId );
130 
131 private:
132  RegionOfInterestImageFilter( const Self & ); // purposely not implemented
133  void
134  operator=( const Self & ); // purposely not implemented
135 
137 };
138 
139 template< typename TPixelIn, typename TPixelOut, unsigned int VImageDimension,
140  typename CounterTypeIn, typename CounterTypeOut >
141 class RegionOfInterestImageFilter< RLEImage< TPixelIn, VImageDimension, CounterTypeIn >,
142  RLEImage< TPixelOut, VImageDimension, CounterTypeOut > > :
143  public ImageToImageFilter< RLEImage< TPixelIn, VImageDimension, CounterTypeIn >,
144  RLEImage< TPixelOut, VImageDimension, CounterTypeOut > >
145 {
146 public:
156 
158  itkNewMacro( Self );
159 
162 
164  typedef typename RLEImageTypeIn::RegionType RegionType;
167 
171 
173  itkSetMacro( RegionOfInterest, RegionType );
174  itkGetConstMacro( RegionOfInterest, RegionType );
176 
178  itkStaticConstMacro( ImageDimension, unsigned int, VImageDimension );
179  itkStaticConstMacro( OutputImageDimension, unsigned int, VImageDimension );
181 
182 #ifdef ITK_USE_CONCEPT_CHECKING
183  // Begin concept checking
185  itkConceptMacro( InputConvertibleToOutputCheck,
187 // End concept checking
188 #endif
189 
190 protected:
193  void
194  PrintSelf( std::ostream& os, Indent indent ) const;
195 
196  virtual void
198 
199  virtual void
201 
210  virtual void
212 
222  void
223  ThreadedGenerateData( const RegionType& outputRegionForThread, ThreadIdType threadId );
224 
225 private:
226  RegionOfInterestImageFilter( const Self & ); // purposely not implemented
227  void
228  operator=( const Self & ); // purposely not implemented
229 
231 };
232 
233 // not implemented on purpose, so it will produce a meaningful error message
234 template< unsigned int VImageDimensionIn, unsigned int VImageDimensionOut >
236 
237 // input and output images must have the same dimension (e.g. both 2D or both 3D)
238 // so disallow this by inheriting from unimplemented base class
239 template< typename TPixelIn, typename TPixelOut, unsigned int VImageDimensionIn,
240  unsigned int VImageDimensionOut, typename CounterTypeIn, typename CounterTypeOut >
241 class RegionOfInterestImageFilter< RLEImage< TPixelIn, VImageDimensionIn, CounterTypeIn >,
242  RLEImage< TPixelOut, VImageDimensionOut, CounterTypeOut > > :
243  InputAndOutputImagesMustHaveSameDimension< VImageDimensionIn, VImageDimensionOut >
244 {
245 };
246 
247 template< typename TPixel, unsigned int VImageDimension, typename CounterType >
248 class RegionOfInterestImageFilter< Image< TPixel, VImageDimension >,
249  RLEImage< TPixel, VImageDimension, CounterType > > :
250  public ImageToImageFilter< Image< TPixel, VImageDimension >,
251  RLEImage< TPixel, VImageDimension, CounterType > >
252 {
253 public:
256 
263 
265  itkNewMacro( Self );
266 
269 
271  typedef typename RLEImageType::RegionType RegionType;
274 
278 
280  itkSetMacro( RegionOfInterest, RegionType );
281  itkGetConstMacro( RegionOfInterest, RegionType );
283 
285  itkStaticConstMacro( ImageDimension, unsigned int, VImageDimension );
286  itkStaticConstMacro( OutputImageDimension, unsigned int, VImageDimension );
288 
289 #ifdef ITK_USE_CONCEPT_CHECKING
290  // Begin concept checking
292  itkConceptMacro( InputConvertibleToOutputCheck,
294 // End concept checking
295 #endif
296 
297 protected:
300  void
301  PrintSelf( std::ostream& os, Indent indent ) const;
302 
303  virtual void
305 
306  virtual void
308 
317  virtual void
319 
329  void
330  ThreadedGenerateData( const RegionType& outputRegionForThread, ThreadIdType threadId );
331 
332 private:
333  RegionOfInterestImageFilter( const Self & ); // purposely not implemented
334  void
335  operator=( const Self & ); // purposely not implemented
336 
338 };
339 
340 template< typename TPixel, unsigned int VImageDimension, typename CounterType >
341 class RegionOfInterestImageFilter< RLEImage< TPixel, VImageDimension, CounterType >,
342  Image< TPixel, VImageDimension > > :
343  public ImageToImageFilter< RLEImage< TPixel, VImageDimension, CounterType >,
344  Image< TPixel, VImageDimension > >
345 {
346 public:
349 
356 
358  itkNewMacro( Self );
359 
362 
364  typedef typename RLEImageType::RegionType RegionType;
367 
371 
373  itkSetMacro( RegionOfInterest, RegionType );
374  itkGetConstMacro( RegionOfInterest, RegionType );
376 
378  itkStaticConstMacro( ImageDimension, unsigned int, VImageDimension );
379  itkStaticConstMacro( OutputImageDimension, unsigned int, VImageDimension );
381 
382 #ifdef ITK_USE_CONCEPT_CHECKING
383  // Begin concept checking
385  itkConceptMacro( InputConvertibleToOutputCheck,
387 // End concept checking
388 #endif
389 
390 protected:
393  void
394  PrintSelf( std::ostream& os, Indent indent ) const;
395 
396  virtual void
398 
399  virtual void
401 
410  virtual void
412 
422  void
423  ThreadedGenerateData( const RegionType& outputRegionForThread, ThreadIdType threadId );
424 
425 private:
426  RegionOfInterestImageFilter( const Self & ); // purposely not implemented
427  void
428  operator=( const Self & ); // purposely not implemented
429 
431 };
432 } // end namespace itk
433 
434 #ifndef ITK_MANUAL_INSTANTIATION
435 #include "itkRLERegionOfInterestImageFilter.hxx"
436 #endif
437 
438 #endif // itkRLERegionOfInterestImageFilter_h
Light weight base class for most itk classes.
void ThreadedGenerateData(const RegionType &outputRegionForThread, ThreadIdType threadId) override
void PrintSelf(std::ostream &os, Indent indent) const override
virtual void GenerateOutputInformation() override
An image region represents a structured region of data.
virtual void EnlargeOutputRequestedRegion(DataObject *output) override
Superclass::SizeType SizeType
Definition: itkRLEImage.h:107
TPixel PixelType
Definition: itkRLEImage.h:67
Superclass::IndexType IndexType
Definition: itkRLEImage.h:100
InputImageType::RegionType InputImageRegionType
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
Extract a region of interest from the input image.
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void GenerateInputRequestedRegion() override
Run-Length Encoded image. It saves memory for label images at the expense of processing times...
Definition: itkRLEImage.h:52
#define itkConceptMacro(name, concept)
Base class for all data objects in ITK.
Templated n-dimensional image class.
Definition: itkImage.h:75