]> Creatis software - clitk.git/blob - itk/clitkExtractSliceFilter.txx
extract a slice from a 3D image
[clitk.git] / itk / clitkExtractSliceFilter.txx
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to: 
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
8
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.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17   ======================================================================-====*/
18
19 // clitk
20 #include "clitkCommon.h"
21
22
23 //--------------------------------------------------------------------
24 template <class ImageType>
25 clitk::ExtractSliceFilter<ImageType>::
26 ExtractSliceFilter():
27   clitk::FilterBase(),
28   itk::ImageToImageFilter<ImageType, ImageType>()
29 {
30   this->SetNumberOfRequiredInputs(1);
31   SetDirection(2);
32 }
33 //--------------------------------------------------------------------
34
35
36 //--------------------------------------------------------------------
37 template <class ImageType>
38 void 
39 clitk::ExtractSliceFilter<ImageType>::
40 SetInput(const ImageType * image) {
41   // Process object is not const-correct so the const casting is required.
42   this->SetNthInput(0, const_cast<ImageType *>(image));
43 }
44 //--------------------------------------------------------------------
45   
46
47 //--------------------------------------------------------------------
48 template <class ImageType>
49 void 
50 clitk::ExtractSliceFilter<ImageType>::
51 GenerateOutputInformation() { 
52   DD("GenerateOutputInformation");
53   ImagePointer input = dynamic_cast<ImageType*>(itk::ProcessObject::GetInput(0));
54   //   ImagePointer outputImage = this->GetOutput(0);
55   //   outputImage->SetRegions(input->GetLargestPossibleRegion());
56   
57   output = this->GetOutput(0);
58   
59   // create vector
60   typename SliceType::RegionType SliceRegionType;
61   typename SliceType::SizeType SliceSizeType;
62   typename SliceType::IndexType SliceIndexType;
63   // SliceRegionType region;
64
65   // create region
66   // loop ExtractImageFilter with region updated, push_back
67
68
69 }
70 //--------------------------------------------------------------------
71
72
73 //--------------------------------------------------------------------
74 template <class ImageType>
75 void 
76 clitk::ExtractSliceFilter<ImageType>::
77 GenerateInputRequestedRegion() {
78   DD("GenerateInputRequestedRegion");
79   // Call default
80   itk::ImageToImageFilter<ImageType, ImageType>::GenerateInputRequestedRegion();
81   // Get input pointers and set requested region to common region
82   ImagePointer input = dynamic_cast<ImageType*>(itk::ProcessObject::GetInput(0));
83   input->SetRequestedRegion(input->GetLargestPossibleRegion());
84 }
85 //--------------------------------------------------------------------
86
87 //--------------------------------------------------------------------
88 template <class ImageType>
89 void 
90 clitk::ExtractSliceFilter<ImageType>::
91 GenerateData() {
92   DD("GenerateData");
93
94   // Get input pointer
95   input = dynamic_cast<ImageType*>(itk::ProcessObject::GetInput(0));
96
97
98
99   //--------------------------------------------------------------------
100   //--------------------------------------------------------------------  
101   // Final Step -> set output
102   //this->SetNthOutput(0, working_image);
103   return;
104 }
105 //--------------------------------------------------------------------
106