1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
19 #ifndef CLITKAUTOCROPFILTER_H
20 #define CLITKAUTOCROPFILTER_H
22 #include <itkImageToImageFilter.h>
26 //--------------------------------------------------------------------
28 Perform auto crop on a Label Image (with Background defined)
30 //--------------------------------------------------------------------
32 template <class TImageType>
33 class ITK_EXPORT AutoCropFilter:
34 public itk::ImageToImageFilter<TImageType, TImageType> {
37 /** Standard class typedefs. */
38 typedef AutoCropFilter Self;
39 typedef itk::ImageToImageFilter<TImageType, TImageType> Superclass;
40 typedef itk::SmartPointer<Self> Pointer;
41 typedef itk::SmartPointer<const Self> ConstPointer;
43 /** Method for creation through the object factory. */
46 /** Run-time type information (and related methods). */
47 itkTypeMacro(AutoCropFilter, ImageToImageFilter);
49 /** Some convenient typedefs. */
50 typedef TImageType ImageType;
51 typedef typename ImageType::ConstPointer ImageConstPointer;
52 typedef typename ImageType::Pointer ImagePointer;
53 typedef typename ImageType::PixelType ImagePixelType;
54 typedef typename ImageType::RegionType ImageRegionType;
55 typedef long LabelType;
57 /** Connect one of the operands for pixel-wise addition */
58 void SetInput( const ImageType * image);
60 // LabelImage information (BG)
61 void SetBackgroundValue(ImagePixelType p);
63 /** ImageDimension constants */
64 itkStaticConstMacro(ImageDimension, unsigned int, TImageType::ImageDimension);
68 virtual ~AutoCropFilter() {}
70 virtual void GenerateOutputInformation();
71 virtual void GenerateData();
73 ImagePixelType m_BackgroundValue;
74 ImageRegionType m_Region;
75 ImagePointer m_labeImage;
78 AutoCropFilter(const Self&); //purposely not implemented
79 void operator=(const Self&); //purposely not implemented
82 //--------------------------------------------------------------------
84 } // end namespace clitk
85 //--------------------------------------------------------------------
87 #ifndef ITK_MANUAL_INSTANTIATION
88 #include "clitkAutoCropFilter.txx"