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://www.centreleonberard.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 CLITKEXTRACTSLICEFILTER_H
20 #define CLITKEXTRACTSLICEFILTER_H
23 #include "clitkFilterBase.h"
26 #include "itkPasteImageFilter.h"
29 #include "RelativePositionPropImageFilter.h"
33 //--------------------------------------------------------------------
35 Let A be an initial label image.
36 Let B be a label image with an object.
37 Let o be an orientation relatively to the B object (for example RightTo, AntTo, InferiorTo ...)
39 This filter removes (=set background) from A all points that are
40 not in the wanted o orientation. It uses downsampled version for
41 faster processing, and (try to) take into account discretization
42 problem. Uses [Bloch 1999].
44 //--------------------------------------------------------------------
46 template <class ImageType>
47 class ITK_EXPORT ExtractSliceFilter:
48 public clitk::FilterBase,
49 public itk::ImageToImageFilter<ImageType,
50 typename itk::Image<typename ImageType::PixelType, ImageType::ImageDimension-1> >
54 /** Some convenient typedefs. */
55 typedef typename ImageType::ConstPointer ImageConstPointer;
56 typedef typename ImageType::Pointer ImagePointer;
57 typedef typename ImageType::RegionType RegionType;
58 typedef typename ImageType::PixelType PixelType;
59 typedef typename ImageType::SpacingType SpacingType;
60 typedef typename ImageType::SizeType SizeType;
61 typedef typename ImageType::IndexType IndexType;
63 /** ImageDimension constants */
64 itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
66 /** Slice image type **/
67 typedef itk::Image<PixelType, ImageDimension-1> SliceType;
68 typedef typename SliceType::Pointer SliceTypePointer;
70 /** Standard class typedefs. */
71 typedef itk::ImageToImageFilter<ImageType, SliceType> Superclass;
72 typedef ExtractSliceFilter Self;
73 typedef itk::SmartPointer<Self> Pointer;
74 typedef itk::SmartPointer<const Self> ConstPointer;
76 /** Method for creation through the object factory. */
79 /** Run-time type information (and related methods). */
80 itkTypeMacro(ExtractSliceFilter, ImageToImageFilter);
83 /** Input : initial image and object */
84 void SetInput(const ImageType * image);
87 itkGetConstMacro(Direction, int);
88 itkSetMacro(Direction, int);
91 void GetOutputSlices(std::vector<typename SliceType::Pointer> & o);
95 virtual ~ExtractSliceFilter() {}
99 virtual void GenerateOutputInformation();
100 virtual void GenerateInputRequestedRegion();
101 virtual void GenerateData();
103 int m_NumberOfSlices;
113 ExtractSliceFilter(const Self&); //purposely not implemented
114 void operator=(const Self&); //purposely not implemented
117 //--------------------------------------------------------------------
119 } // end namespace clitk
120 //--------------------------------------------------------------------
122 #ifndef ITK_MANUAL_INSTANTIATION
123 #include "clitkExtractSliceFilter.txx"