#include "bbTransform3DdicomNewDicomImaPosPat.h" #include "bbTransform3DdicomPackage.h" #include "matrixRotation.h" namespace bbTransform3Ddicom { BBTK_ADD_BLACK_BOX_TO_PACKAGE(Transform3Ddicom,NewDicomImaPosPat) BBTK_BLACK_BOX_IMPLEMENTATION(NewDicomImaPosPat,bbtk::AtomicBlackBox); void NewDicomImaPosPat::Process() { printf("NewDicomImaPosPat::Process Start\n"); if (!((bbGetInputIPP().size()!=3) || (bbGetInputIOP().size()!=6) || (bbGetInputPixelSpacing().size()!=3) )) { matrixRotation matrixrotation; matrixrotation.SetOrigin( bbGetInputIPP()[0] , bbGetInputIPP()[1] , bbGetInputIPP()[2] ); matrixrotation.SetVector1( bbGetInputIOP()[0] , bbGetInputIOP()[1] , bbGetInputIOP()[2] ); matrixrotation.SetVector2( bbGetInputIOP()[3] , bbGetInputIOP()[4] , bbGetInputIOP()[5] ); printf("EED NewDicomImaPosPat::Process spc %f %f %f \n", bbGetInputPixelSpacing()[0] , bbGetInputPixelSpacing()[1], bbGetInputPixelSpacing()[2] ); matrixrotation.SetSpacing( bbGetInputPixelSpacing()[0] , bbGetInputPixelSpacing()[1], bbGetInputPixelSpacing()[2]); vtkTransform *transform = vtkTransform::New(); matrixrotation.GetTransformation(transform); bbSetOutputTransform( transform ); if ( (bbGetInputPoint().size()==3) ) { double ipp[3], newIPP[3]; ipp[0] = bbGetInputPoint()[0]; ipp[1] = bbGetInputPoint()[1]; ipp[2] = bbGetInputPoint()[2]; transform->Update(); transform->TransformPoint(ipp, newIPP); std::vector vecOutIPP; vecOutIPP.push_back( newIPP[0] ); vecOutIPP.push_back( newIPP[1] ); vecOutIPP.push_back( newIPP[2] ); bbSetOutputOut( vecOutIPP ); } else { printf("EED NewDicomImaPosPat::Process empty vector with input Point\n"); } } else { 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() ); } printf("NewDicomImaPosPat::Process End\n"); } /* void NewDicomImaPosPat::bbUserConstructor() { } void NewDicomImaPosPat::bbUserCopyConstructor(bbtk::BlackBox::Pointer) { } void NewDicomImaPosPat::bbUserDestructor() { } */ //===== // 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) //===== void NewDicomImaPosPat::bbUserSetDefaultValues() { } //===== // 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) //===== void NewDicomImaPosPat::bbUserInitializeProcessing() { // THE INITIALIZATION METHOD BODY : // Here does nothing // but this is where you should allocate the internal/output pointers // if any } //===== // 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) //===== void NewDicomImaPosPat::bbUserFinalizeProcessing() { // THE FINALIZATION METHOD BODY : // Here does nothing // but this is where you should desallocate the internal/output pointers // if any } } // EO namespace bbTransform3Ddicom