]> Creatis software - creaRigidRegistration.git/blob - PackRecalage/src/bbPackRecalageResampleBox.cxx
3a5a7b8af0d792f6ed5119233185703e40052501
[creaRigidRegistration.git] / PackRecalage / src / bbPackRecalageResampleBox.cxx
1 #include "bbPackRecalageResampleBox.h"
2 #include "bbPackRecalagePackage.h"
3 namespace bbPackRecalage
4 {
5
6 BBTK_ADD_BLACK_BOX_TO_PACKAGE(PackRecalage,ResampleBox)
7 BBTK_BLACK_BOX_IMPLEMENTATION(ResampleBox,bbtk::AtomicBlackBox);
8 void ResampleBox::Process()
9 {
10     if(bbGetInputIn() != NULL && bbGetInputFactor() != 0)
11         {
12                 double factor = bbGetInputFactor();
13                 resample->SetInput(bbGetInputIn());
14                 resample->SetAxisMagnificationFactor(0, factor);
15                 resample->SetAxisMagnificationFactor(1, factor);
16                 resample->SetAxisMagnificationFactor(2, factor);
17                 resample->Update();
18                 vtkImageData *image = resample->GetOutput();
19                 std::cout << "NTU: new spacing!" << image->GetExtent()[1] << " " << image->GetExtent()[3] << " " << image->GetExtent()[5] << " " << image->GetSpacing()[0] << " " << image->GetSpacing()[1] << " " << image->GetSpacing()[2] << std::endl;
20                 bbSetOutputOut(resample->GetOutput());
21         }
22         else
23         {
24                 bbSetOutputOut(NULL);
25         }
26 }
27 void ResampleBox::bbUserSetDefaultValues()
28 {
29     bbSetInputIn(NULL);
30         bbSetInputFactor(0);
31         bbSetOutputOut(NULL);
32 }
33 void ResampleBox::bbUserInitializeProcessing()
34 {
35         resample = vtkImageResample::New();
36 }
37 void ResampleBox::bbUserFinalizeProcessing()
38 {
39         resample->Delete(); 
40 }
41 }
42 // EO namespace bbPackRecalage
43
44