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 printf("NewDicomImaPosPat::Process Start\n");
15 if (!((bbGetInputIPP().size()!=3) || (bbGetInputIOP().size()!=6) || (bbGetInputPixelSpacing().size()!=3) ))
17 matrixRotation matrixrotation;
18 matrixrotation.SetOrigin( bbGetInputIPP()[0] , bbGetInputIPP()[1] , bbGetInputIPP()[2] );
19 matrixrotation.SetVector1( bbGetInputIOP()[0] , bbGetInputIOP()[1] , bbGetInputIOP()[2] );
20 matrixrotation.SetVector2( bbGetInputIOP()[3] , bbGetInputIOP()[4] , bbGetInputIOP()[5] );
21 printf("EED NewDicomImaPosPat::Process spc %f %f %f \n", bbGetInputPixelSpacing()[0] , bbGetInputPixelSpacing()[1], bbGetInputPixelSpacing()[2] );
22 matrixrotation.SetSpacing( bbGetInputPixelSpacing()[0] , bbGetInputPixelSpacing()[1], bbGetInputPixelSpacing()[2]);
23 vtkTransform *transform = vtkTransform::New();
24 matrixrotation.GetTransformation(transform);
25 bbSetOutputTransform( transform );
27 if ( (bbGetInputPoint().size()==3) )
29 double ipp[3], newIPP[3];
30 ipp[0] = bbGetInputPoint()[0];
31 ipp[1] = bbGetInputPoint()[1];
32 ipp[2] = bbGetInputPoint()[2];
34 transform->TransformPoint(ipp, newIPP);
35 std::vector<double> vecOutIPP;
36 vecOutIPP.push_back( newIPP[0] );
37 vecOutIPP.push_back( newIPP[1] );
38 vecOutIPP.push_back( newIPP[2] );
39 bbSetOutputOut( vecOutIPP );
41 printf("EED NewDicomImaPosPat::Process empty vector with input Point\n");
44 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() );
46 printf("NewDicomImaPosPat::Process End\n");
50 void NewDicomImaPosPat::bbUserConstructor()
55 void NewDicomImaPosPat::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
59 void NewDicomImaPosPat::bbUserDestructor()
66 // 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)
68 void NewDicomImaPosPat::bbUserSetDefaultValues()
74 // 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)
76 void NewDicomImaPosPat::bbUserInitializeProcessing()
78 // THE INITIALIZATION METHOD BODY :
80 // but this is where you should allocate the internal/output pointers
85 // 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)
87 void NewDicomImaPosPat::bbUserFinalizeProcessing()
89 // THE FINALIZATION METHOD BODY :
91 // but this is where you should desallocate the internal/output pointers
97 // EO namespace bbTransform3Ddicom