1 #include "bbPackRecalageReSlicerBox.h"
2 #include "bbPackRecalagePackage.h"
4 namespace bbPackRecalage
7 BBTK_ADD_BLACK_BOX_TO_PACKAGE(PackRecalage,ReSlicerBox)
8 BBTK_BLACK_BOX_IMPLEMENTATION(ReSlicerBox,bbtk::AtomicBlackBox);
9 void ReSlicerBox::Process()
12 if(!bbGetInputOrigin().empty())
14 image = vtkImageChangeInformation::New();
15 image->SetInput( bbGetInputIn() );
16 image->SetOutputSpacing( 1,1,1 );
17 if(bbGetInputCentered())
19 image->CenterImageOn();
22 slicer =vtkImageReslice::New();
23 slicer->SetInput( image->GetOutput() );
24 slicer->SetInformationInput( image->GetOutput() );
25 slicer->SetResliceTransform(bbGetInputTransform());
26 slicer->SetOutputOrigin( -(bbGetInputOrigin()[0]) , -(bbGetInputOrigin()[1]) , -(bbGetInputOrigin()[2]) );
27 if(bbGetInputInterpolate())
29 slicer->InterpolateOn();
33 imageResult = vtkImageChangeInformation::New();
34 imageResult->SetInput( slicer->GetOutput() );
36 bbGetInputIn()->GetSpacing(spc);
37 imageResult->SetOutputSpacing( spc );
38 imageResult->SetOutputOrigin( 0,0,0 );
40 bbSetOutputOut( imageResult->GetOutput() );
44 bbSetOutputOut( bbGetInputIn() );
48 void ReSlicerBox::bbUserSetDefaultValues()
50 std::vector<int> empty;
51 bbSetInputOrigin(empty);
53 bbSetInputTransform(vtkTransform::New());
55 bbSetInputCentered(false);
56 bbSetInputInterpolate(false);
59 void ReSlicerBox::bbUserInitializeProcessing()
62 // THE INITIALIZATION METHOD BODY :
64 // but this is where you should allocate the internal/output pointers
66 image = vtkImageChangeInformation::New();
67 slicer =vtkImageReslice::New();
68 imageResult = vtkImageChangeInformation::New();
70 void ReSlicerBox::bbUserFinalizeProcessing()
73 // THE FINALIZATION METHOD BODY :
75 // but this is where you should desallocate the internal/output pointers
79 imageResult->Delete();
82 // EO namespace bbPackRecalage