ITK  5.0.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:
54  ITK_DISALLOW_COPY_AND_ASSIGN(RegionOfInterestImageFilter);
55 
64 
66  itkNewMacro( Self );
67 
70 
74  using SizeType = typename RLEImageType::SizeType;
75 
79 
81  itkSetMacro( RegionOfInterest, RegionType );
82  itkGetConstMacro( RegionOfInterest, RegionType );
84 
86  static constexpr unsigned int ImageDimension = VImageDimension;
87  static constexpr unsigned int OutputImageDimension = VImageDimension;
88 
89 #ifdef ITK_USE_CONCEPT_CHECKING
90  // Begin concept checking
92  itkConceptMacro( InputConvertibleToOutputCheck,
94 // End concept checking
95 #endif
96 
97 protected:
99  { this->DynamicMultiThreadingOn(); }
101  void
102  PrintSelf( std::ostream& os, Indent indent ) const override;
103 
104  void
105  GenerateInputRequestedRegion() override;
106 
107  void
108  EnlargeOutputRequestedRegion( DataObject* output ) override;
109 
118  void
119  GenerateOutputInformation() override;
120 
130  void
131  DynamicThreadedGenerateData( const RegionType& outputRegionForThread ) override;
132 
133 private:
135 };
136 
137 template< typename TPixelIn, typename TPixelOut, unsigned int VImageDimension,
138  typename CounterTypeIn, typename CounterTypeOut >
139 class RegionOfInterestImageFilter< RLEImage< TPixelIn, VImageDimension, CounterTypeIn >,
140  RLEImage< TPixelOut, VImageDimension, CounterTypeOut > > :
141  public ImageToImageFilter< RLEImage< TPixelIn, VImageDimension, CounterTypeIn >,
142  RLEImage< TPixelOut, VImageDimension, CounterTypeOut > >
143 {
144 public:
154 
156  itkNewMacro( Self );
157 
160 
165 
169 
171  itkSetMacro( RegionOfInterest, RegionType );
172  itkGetConstMacro( RegionOfInterest, RegionType );
174 
176  static constexpr unsigned int ImageDimension = VImageDimension;
177  static constexpr unsigned int OutputImageDimension = VImageDimension;
178 
179 #ifdef ITK_USE_CONCEPT_CHECKING
180  // Begin concept checking
182  itkConceptMacro( InputConvertibleToOutputCheck,
184 // End concept checking
185 #endif
186 
187 protected:
189  { this->DynamicMultiThreadingOn(); }
191  void
192  PrintSelf( std::ostream& os, Indent indent ) const override;
193 
194  void
195  GenerateInputRequestedRegion() override;
196 
197  void
198  EnlargeOutputRequestedRegion( DataObject* output ) override;
199 
208  void
209  GenerateOutputInformation() override;
210 
220  void
221  DynamicThreadedGenerateData( const RegionType& outputRegionForThread ) override;
222 
223 private:
224  RegionOfInterestImageFilter( const Self & ); // purposely not implemented
225  void
226  operator=( const Self & ); // purposely not implemented
227 
229 };
230 
231 // not implemented on purpose, so it will produce a meaningful error message
232 template< unsigned int VImageDimensionIn, unsigned int VImageDimensionOut >
234 
235 // input and output images must have the same dimension (e.g. both 2D or both 3D)
236 // so disallow this by inheriting from unimplemented base class
237 template< typename TPixelIn, typename TPixelOut, unsigned int VImageDimensionIn,
238  unsigned int VImageDimensionOut, typename CounterTypeIn, typename CounterTypeOut >
239 class RegionOfInterestImageFilter< RLEImage< TPixelIn, VImageDimensionIn, CounterTypeIn >,
240  RLEImage< TPixelOut, VImageDimensionOut, CounterTypeOut > > :
241  InputAndOutputImagesMustHaveSameDimension< VImageDimensionIn, VImageDimensionOut >
242 {
243 };
244 
245 template< typename TPixel, unsigned int VImageDimension, typename CounterType >
246 class RegionOfInterestImageFilter< Image< TPixel, VImageDimension >,
247  RLEImage< TPixel, VImageDimension, CounterType > > :
248  public ImageToImageFilter< Image< TPixel, VImageDimension >,
249  RLEImage< TPixel, VImageDimension, CounterType > >
250 {
251 public:
252  ITK_DISALLOW_COPY_AND_ASSIGN(RegionOfInterestImageFilter);
253 
256 
263 
265  itkNewMacro( Self );
266 
269 
274 
278 
280  itkSetMacro( RegionOfInterest, RegionType );
281  itkGetConstMacro( RegionOfInterest, RegionType );
283 
285  static constexpr unsigned int ImageDimension = VImageDimension;
286  static constexpr unsigned int OutputImageDimension = VImageDimension;
287 
288 #ifdef ITK_USE_CONCEPT_CHECKING
289  // Begin concept checking
291  itkConceptMacro( InputConvertibleToOutputCheck,
293 // End concept checking
294 #endif
295 
296 protected:
298  { this->DynamicMultiThreadingOn(); }
300  void
301  PrintSelf( std::ostream& os, Indent indent ) const override;
302 
303  void
304  GenerateInputRequestedRegion() override;
305 
306  void
307  EnlargeOutputRequestedRegion( DataObject* output ) override;
308 
317  void
318  GenerateOutputInformation() override;
319 
329  void
330  DynamicThreadedGenerateData( const RegionType& outputRegionForThread ) override;
331 
332 private:
334 };
335 
336 template< typename TPixel, unsigned int VImageDimension, typename CounterType >
337 class RegionOfInterestImageFilter< RLEImage< TPixel, VImageDimension, CounterType >,
338  Image< TPixel, VImageDimension > > :
339  public ImageToImageFilter< RLEImage< TPixel, VImageDimension, CounterType >,
340  Image< TPixel, VImageDimension > >
341 {
342 public:
343  ITK_DISALLOW_COPY_AND_ASSIGN(RegionOfInterestImageFilter);
344 
347 
354 
356  itkNewMacro( Self );
357 
360 
365 
369 
371  itkSetMacro( RegionOfInterest, RegionType );
372  itkGetConstMacro( RegionOfInterest, RegionType );
374 
376  static constexpr unsigned int ImageDimension = VImageDimension;
377  static constexpr unsigned int OutputImageDimension = VImageDimension;
378 
379 #ifdef ITK_USE_CONCEPT_CHECKING
380  // Begin concept checking
382  itkConceptMacro( InputConvertibleToOutputCheck,
384 // End concept checking
385 #endif
386 
387 protected:
389  { this->DynamicMultiThreadingOn(); }
391  void
392  PrintSelf( std::ostream& os, Indent indent ) const override;
393 
394  void
395  GenerateInputRequestedRegion() override;
396 
397  void
398  EnlargeOutputRequestedRegion( DataObject* output ) override;
399 
408  void
409  GenerateOutputInformation() override;
410 
420  void
421  DynamicThreadedGenerateData( const RegionType& outputRegionForThread ) override;
422 
423 private:
425 };
426 } // end namespace itk
427 
428 #ifndef ITK_MANUAL_INSTANTIATION
429 #include "itkRLERegionOfInterestImageFilter.hxx"
430 #endif
431 
432 #endif // itkRLERegionOfInterestImageFilter_h
Light weight base class for most itk classes.
TPixel PixelType
Definition: itkRLEImage.h:73
void PrintSelf(std::ostream &os, Indent indent) const override
typename TInputImage::RegionType RegionType
void GenerateOutputInformation() override
virtual void DynamicMultiThreadingOn()
static constexpr unsigned int ImageDimension
void DynamicThreadedGenerateData(const RegionType &outputRegionForThread) override
void GenerateInputRequestedRegion() override
Extract a region of interest from the input image.
typename InputImageType::RegionType InputImageRegionType
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
void EnlargeOutputRequestedRegion(DataObject *output) 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.
static constexpr unsigned int OutputImageDimension
Templated n-dimensional image class.
Definition: itkImage.h:75