1 #include "bbTransform3DdicomNewDicomImaPosPat.h"
2 #include "bbTransform3DdicomPackage.h"
4 #include "matrixRotation.h"
7 namespace bbTransform3Ddicom
10 BBTK_ADD_BLACK_BOX_TO_PACKAGE(Transform3Ddicom,NewDicomImaPosPat)
11 BBTK_BLACK_BOX_IMPLEMENTATION(NewDicomImaPosPat,bbtk::AtomicBlackBox);
12 void NewDicomImaPosPat::Process()
14 if (!((bbGetInputIPP().size()!=3) || (bbGetInputIOP().size()!=6) || (bbGetInputPixelSpacing().size()!=3) ))
16 matrixRotation matrixrotation;
17 matrixrotation.SetOrigin( bbGetInputIPP()[0] , bbGetInputIPP()[1] , bbGetInputIPP()[2] );
18 matrixrotation.SetVector1( bbGetInputIOP()[0] , bbGetInputIOP()[1] , bbGetInputIOP()[2] );
19 matrixrotation.SetVector2( bbGetInputIOP()[3] , bbGetInputIOP()[4] , bbGetInputIOP()[5] );
20 matrixrotation.SetSpacing( bbGetInputPixelSpacing()[0] , bbGetInputPixelSpacing()[1], bbGetInputPixelSpacing()[2]);
21 vtkTransform *transform = vtkTransform::New();
22 matrixrotation.GetTransformation(transform);
23 bbSetOutputTransform( transform );
25 if ( (bbGetInputPoint().size()==3) )
27 double ipp[3], newIPP[3];
28 ipp[0] = bbGetInputPoint()[0];
29 ipp[1] = bbGetInputPoint()[1];
30 ipp[2] = bbGetInputPoint()[2];
32 transform->TransformPoint(ipp, newIPP);
33 std::vector<double> vecOutIPP;
34 vecOutIPP.push_back( newIPP[0] );
35 vecOutIPP.push_back( newIPP[1] );
36 vecOutIPP.push_back( newIPP[2] );
37 bbSetOutputOut( vecOutIPP );
42 printf("EED Warnning! NewDicomImaPosPat::Process Size inputs are not correct. IPP(3)=%lu IOP(6)=%lu Spacing(3)=%lu Point(3)=%lu\n", bbGetInputIPP().size() , bbGetInputIOP().size() , bbGetInputPixelSpacing().size() , bbGetInputPoint().size() );
47 void NewDicomImaPosPat::bbUserConstructor()
52 void NewDicomImaPosPat::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
56 void NewDicomImaPosPat::bbUserDestructor()
63 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
65 void NewDicomImaPosPat::bbUserSetDefaultValues()
71 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
73 void NewDicomImaPosPat::bbUserInitializeProcessing()
75 // THE INITIALIZATION METHOD BODY :
77 // but this is where you should allocate the internal/output pointers
82 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
84 void NewDicomImaPosPat::bbUserFinalizeProcessing()
86 // THE FINALIZATION METHOD BODY :
88 // but this is where you should desallocate the internal/output pointers
94 // EO namespace bbTransform3Ddicom