go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkGenericMultiResolutionPyramidImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright UMC Utrecht and contributors
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 __itkGenericMultiResolutionPyramidImageFilter_h
19 #define __itkGenericMultiResolutionPyramidImageFilter_h
20 
21 #include "itkMultiResolutionPyramidImageFilter.h"
22 #include "itkSmoothingRecursiveGaussianImageFilter.h"
23 
24 namespace itk
25 {
116 template< class TInputImage, class TOutputImage, class TPrecisionType = double >
118  public MultiResolutionPyramidImageFilter< TInputImage, TOutputImage >
119 {
120 public:
121 
124  typedef MultiResolutionPyramidImageFilter<
125  TInputImage, TOutputImage > Superclass;
126  typedef typename Superclass::Superclass SuperSuperclass;
128  typedef SmartPointer< const Self > ConstPointer;
129 
131  itkNewMacro( Self );
132 
135  MultiResolutionPyramidImageFilter );
136 
138  itkStaticConstMacro( ImageDimension, unsigned int,
139  TInputImage::ImageDimension );
140  itkStaticConstMacro( OutputImageDimension, unsigned int,
141  TOutputImage::ImageDimension );
142 
144  typedef typename Superclass::ScheduleType ScheduleType;
145  typedef typename Superclass::InputImageType InputImageType;
146  typedef typename Superclass::OutputImageType OutputImageType;
147  typedef typename Superclass::InputImagePointer InputImagePointer;
148  typedef typename Superclass::OutputImagePointer OutputImagePointer;
149  typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
150  typedef typename Superclass::InputImageType::SpacingType SpacingType;
151  typedef typename InputImageType::PixelType PixelType;
152  typedef typename NumericTraits< PixelType >::ScalarRealType ScalarRealType;
153 
156  typedef ScheduleType RescaleScheduleType;
157 
159  typedef FixedArray< ScalarRealType,
160  itkGetStaticConstMacro( ImageDimension ) > SigmaArrayType;
162 
170  virtual void SetSchedule( const ScheduleType & schedule );
171 
179  virtual void SetRescaleSchedule( const RescaleScheduleType & schedule );
180 
182  virtual void SetRescaleScheduleToUnity( void );
183 
185  const RescaleScheduleType & GetRescaleSchedule( void ) const
186  {
187  return this->m_Schedule;
188  }
189 
190 
195  virtual void SetSmoothingSchedule( const SmoothingScheduleType & schedule );
196 
198  virtual void SetSmoothingScheduleToZero( void );
199 
201  itkGetConstReferenceMacro( SmoothingSchedule, SmoothingScheduleType );
202 
207  virtual void SetNumberOfLevels( unsigned int num );
208 
212  virtual void SetCurrentLevel( unsigned int level );
213 
215  itkGetConstReferenceMacro( CurrentLevel, unsigned int );
216 
218  virtual void SetComputeOnlyForCurrentLevel( const bool _arg );
219 
220  itkGetConstMacro( ComputeOnlyForCurrentLevel, bool );
221  itkBooleanMacro( ComputeOnlyForCurrentLevel );
222 
223 #ifdef ITK_USE_CONCEPT_CHECKING
224 
225  itkConceptMacro( SameDimensionCheck,
226  ( Concept::SameDimension< ImageDimension, OutputImageDimension > ) );
227  itkConceptMacro( OutputHasNumericTraitsCheck,
228  ( Concept::HasNumericTraits< typename TOutputImage::PixelType > ) );
230 #endif
231 
232 protected:
233 
236 
238  void PrintSelf( std::ostream & os, Indent indent ) const;
239 
247  virtual void GenerateOutputInformation( void );
248 
254  virtual void GenerateOutputRequestedRegion( DataObject * output );
255 
257  virtual void GenerateInputRequestedRegion( void );
258 
260  virtual void GenerateData( void );
261 
263  void ReleaseOutputs( void );
264 
265  SmoothingScheduleType m_SmoothingSchedule;
266  unsigned int m_CurrentLevel;
269 
270 private:
271 
275  typedef SmoothingRecursiveGaussianImageFilter<
276  InputImageType, OutputImageType > SmootherType;
277 
282  typedef ImageToImageFilter< OutputImageType, OutputImageType >
284  typedef ImageToImageFilter< InputImageType, OutputImageType >
286 
290  bool SetupSmoother( const unsigned int level,
291  typename SmootherType::Pointer & smoother,
292  const InputImageConstPointer & input );
293 
297  int SetupShrinkerOrResampler( const unsigned int level,
298  typename SmootherType::Pointer & smoother,
299  const bool sameType,
300  const InputImageConstPointer & input,
301  const OutputImagePointer & outputPtr,
302  typename ImageToImageFilterSameTypes::Pointer & rescaleSameTypes,
303  typename ImageToImageFilterDifferentTypes::Pointer & rescaleDifferentTypes );
304 
307  const bool sameType,
308  const RescaleFactorArrayType & shrinkFactors,
309  const OutputImagePointer & outputPtr,
310  typename ImageToImageFilterSameTypes::Pointer & rescaleSameTypes,
311  typename ImageToImageFilterDifferentTypes::Pointer & rescaleDifferentTypes );
312 
314  void SetSmoothingScheduleToDefault( void );
315 
319  bool ComputeForCurrentLevel( const unsigned int level ) const;
320 
322  double GetDefaultSigma( const unsigned int level,
323  const unsigned int dim,
324  const unsigned int * factors,
325  const SpacingType & spacing ) const;
326 
328  void GetSigma( const unsigned int level,
329  SigmaArrayType & sigmaArray ) const;
330 
332  void GetShrinkFactors( const unsigned int level,
333  RescaleFactorArrayType & shrinkFactors ) const;
334 
338  bool AreSigmasAllZeros( const SigmaArrayType & sigmaArray ) const;
339 
343  bool AreRescaleFactorsAllOnes( const RescaleFactorArrayType & rescaleFactorArray ) const;
344 
346  bool IsSmoothingUsed( void ) const;
347 
349  bool IsRescaleUsed( void ) const;
350 
351 private:
352 
353  GenericMultiResolutionPyramidImageFilter( const Self & ); // purposely not implemented
354  void operator=( const Self & ); // purposely not implemented
355 
356 };
357 
358 } // namespace itk
359 
360 #ifndef ITK_MANUAL_INSTANTIATION
361 #include "itkGenericMultiResolutionPyramidImageFilter.hxx"
362 #endif
363 
364 #endif
virtual void SetSchedule(const ScheduleType &schedule)
void GetSigma(const unsigned int level, SigmaArrayType &sigmaArray) const
bool SetupSmoother(const unsigned int level, typename SmootherType::Pointer &smoother, const InputImageConstPointer &input)
bool AreSigmasAllZeros(const SigmaArrayType &sigmaArray) const
Framework for creating images in a multi-resolution pyramid.
virtual void GenerateOutputRequestedRegion(DataObject *output)
SmoothingRecursiveGaussianImageFilter< InputImageType, OutputImageType > SmootherType
bool ComputeForCurrentLevel(const unsigned int level) const
virtual void SetSmoothingSchedule(const SmoothingScheduleType &schedule)
itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension)
bool AreRescaleFactorsAllOnes(const RescaleFactorArrayType &rescaleFactorArray) const
int SetupShrinkerOrResampler(const unsigned int level, typename SmootherType::Pointer &smoother, const bool sameType, const InputImageConstPointer &input, const OutputImagePointer &outputPtr, typename ImageToImageFilterSameTypes::Pointer &rescaleSameTypes, typename ImageToImageFilterDifferentTypes::Pointer &rescaleDifferentTypes)
void DefineShrinkerOrResampler(const bool sameType, const RescaleFactorArrayType &shrinkFactors, const OutputImagePointer &outputPtr, typename ImageToImageFilterSameTypes::Pointer &rescaleSameTypes, typename ImageToImageFilterDifferentTypes::Pointer &rescaleDifferentTypes)
virtual void SetCurrentLevel(unsigned int level)
double GetDefaultSigma(const unsigned int level, const unsigned int dim, const unsigned int *factors, const SpacingType &spacing) const
ImageToImageFilter< OutputImageType, OutputImageType > ImageToImageFilterSameTypes
virtual void SetComputeOnlyForCurrentLevel(const bool _arg)
void GetShrinkFactors(const unsigned int level, RescaleFactorArrayType &shrinkFactors) const
void PrintSelf(std::ostream &os, Indent indent) const
virtual void SetRescaleSchedule(const RescaleScheduleType &schedule)
ImageToImageFilter< InputImageType, OutputImageType > ImageToImageFilterDifferentTypes
MultiResolutionPyramidImageFilter< TInputImage, TOutputImage > Superclass
virtual void SetNumberOfLevels(unsigned int num)
FixedArray< ScalarRealType, itkGetStaticConstMacro(ImageDimension) > SigmaArrayType


Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo