]> Creatis software - bbtk.git/blob - packages/vtk/src/bbvtkVecImageGaussianSmooth.cxx
Convert bbtk from GDCM to GDCM2 (cmakefiles and cxx files).
[bbtk.git] / packages / vtk / src / bbvtkVecImageGaussianSmooth.cxx
1 #include "bbvtkVecImageGaussianSmooth.h"
2 #include "bbvtkPackage.h"
3
4 #include "vtkImageGaussianSmooth.h"
5
6
7 namespace bbvtk
8 {
9
10 BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,VecImageGaussianSmooth)
11 BBTK_BLACK_BOX_IMPLEMENTATION(VecImageGaussianSmooth,bbtk::AtomicBlackBox);
12
13         
14         
15         //---------------------------------------------------------------------
16         void VecImageGaussianSmooth::bbUserSetDefaultValues()
17         {
18                 bbSetInputStdDevX(2); 
19                 bbSetInputStdDevY(2); 
20                 bbSetInputStdDevZ(2);  
21                 bbSetInputiImage(0);
22         }
23         
24         void VecImageGaussianSmooth::bbUserInitializeProcessing()
25         {
26         }
27         
28         //---------------------------------------------------------------------
29         void VecImageGaussianSmooth::bbUserFinalizeProcessing()
30         { 
31                 int i,size = (int)VecVtkimagegaussiansmooth.size();
32                 for (i=0 ;  i<size ; i++)
33                 {               
34                         VecVtkimagegaussiansmooth[i]->Delete();
35                 }
36                 VecVtkimagegaussiansmooth.clear();
37         }
38         
39         
40         
41         //---------------------------------------------------------------------
42         
43         void VecImageGaussianSmooth::Process()
44         {
45                 bbUserFinalizeProcessing();
46                 
47                 vtkImageGaussianSmooth *vtkimagegaussiansmooth;
48                 VecResult.clear();
49
50                 double stdvX=bbGetInputStdDevX();
51                 double stdvY=bbGetInputStdDevY();
52                 double stdvZ=bbGetInputStdDevZ();
53                 
54                 int i,size=(int)bbGetInputIn().size();
55                 for (i=0 ;  i<size ; i++)
56                 {       
57                         vtkimagegaussiansmooth = vtkImageGaussianSmooth::New();
58                         vtkimagegaussiansmooth->SetInput( bbGetInputIn()[i] );
59                         vtkimagegaussiansmooth->SetStandardDeviation( stdvX,stdvY, stdvZ ); 
60                         vtkimagegaussiansmooth->Update();
61                         VecResult.push_back( vtkimagegaussiansmooth->GetOutput() );
62                         VecVtkimagegaussiansmooth.push_back(vtkimagegaussiansmooth);
63                 } //for i
64                 
65                 bbSetOutputOut(VecResult);
66                 if (bbGetInputiImage() < (int)VecResult.size())
67                 {
68                         bbSetOutputOutImage(VecResult[bbGetInputiImage()]);
69                 } //if
70                 
71         }
72
73
74 }
75 // EO namespace bbvtk
76
77