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 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 std::vector<typename itk::Image<typename ImageType::PixelType,
51 ImageType::ImageDimension-1>::Pointer> >
55 /** Standard class typedefs. */
56 typedef itk::ImageToImageFilter<ImageType, ImageType> Superclass;
57 typedef ExtractSliceFilter Self;
58 typedef itk::SmartPointer<Self> Pointer;
59 typedef itk::SmartPointer<const Self> ConstPointer;
61 /** Method for creation through the object factory. */
64 /** Run-time type information (and related methods). */
65 itkTypeMacro(ExtractSliceFilter, ImageToImageFilter);
68 /** Some convenient typedefs. */
69 typedef typename ImageType::ConstPointer ImageConstPointer;
70 typedef typename ImageType::Pointer ImagePointer;
71 typedef typename ImageType::RegionType RegionType;
72 typedef typename ImageType::PixelType PixelType;
73 typedef typename ImageType::SpacingType SpacingType;
74 typedef typename ImageType::SizeType SizeType;
76 /** ImageDimension constants */
77 itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
79 /** Slice image type **/
80 typedef itk::Image<PixelType, ImageDimension-1> SliceType;
81 typedef typename SliceType::Pointer SliceTypePointer;
83 /** Input : initial image and object */
84 void SetInput(const ImageType * image);
87 itkGetConstMacro(Direction, int);
88 itkSetMacro(Direction, int);
92 virtual ~ExtractSliceFilter() {}
96 virtual void GenerateOutputInformation();
97 virtual void GenerateInputRequestedRegion();
98 virtual void GenerateData();
102 std::vector<SliceTypePointer> output;
105 ExtractSliceFilter(const Self&); //purposely not implemented
106 void operator=(const Self&); //purposely not implemented
109 //--------------------------------------------------------------------
111 } // end namespace clitk
112 //--------------------------------------------------------------------
114 #ifndef ITK_MANUAL_INSTANTIATION
115 #include "clitkExtractSliceFilter.txx"