X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk_creaVtk_PKG%2Fsrc%2FbbcreaVtkApplyTransformToPoint3D.cxx;fp=bbtk_creaVtk_PKG%2Fsrc%2FbbcreaVtkApplyTransformToPoint3D.cxx;h=ae0477251888541add8eb0eb6613bbd5c5e7adc8;hb=c4879112fd85619dc824d3ae163d65fd0b59ecf9;hp=0000000000000000000000000000000000000000;hpb=fc7c81774c8e057eb6d9a2ed428bccd35bd9633c;p=creaVtk.git diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkApplyTransformToPoint3D.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkApplyTransformToPoint3D.cxx new file mode 100644 index 0000000..ae04772 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkApplyTransformToPoint3D.cxx @@ -0,0 +1,111 @@ +//===== +// 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) +//===== +#include "bbcreaVtkApplyTransformToPoint3D.h" +#include "bbcreaVtkPackage.h" +#include "vtkTransform.h" + +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ApplyTransformToPoint3D) +BBTK_BLACK_BOX_IMPLEMENTATION(ApplyTransformToPoint3D,bbtk::AtomicBlackBox); +//===== +// 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 ApplyTransformToPoint3D::Process() +{ + +// THE MAIN PROCESSING METHOD BODY +// Here we simply set the input 'In' value to the output 'Out' +// And print out the output value +// INPUT/OUTPUT ACCESSORS ARE OF THE FORM : +// void bbSet{Input|Output}NAME(const TYPE&) +// const TYPE& bbGet{Input|Output}NAME() const +// Where : +// * NAME is the name of the input/output +// (the one provided in the attribute 'name' of the tag 'input') +// * TYPE is the C++ type of the input/output +// (the one provided in the attribute 'type' of the tag 'input') +// bbSetOutputOut( bbGetInputIn() ); +// std::cout << "Output value = " <TransformPoint( point,newPoint ); + std::vector out; + out.push_back( newPoint[0] ); + out.push_back( newPoint[1] ); + out.push_back( newPoint[2] ); + bbSetOutputOut( out ); + + double pointDir[3] , newPointDir[3]; + pointDir[0] = bbGetInputPoint()[0]+bbGetInputDirectionInPoint()[0]; + pointDir[1] = bbGetInputPoint()[1]+bbGetInputDirectionInPoint()[1]; + pointDir[2] = bbGetInputPoint()[2]+bbGetInputDirectionInPoint()[2]; + bbGetInputTransform()->TransformPoint( pointDir,newPointDir ); + std::vector outDir; + outDir.push_back( newPointDir[0]-newPoint[0] ); + outDir.push_back( newPointDir[1]-newPoint[1] ); + outDir.push_back( newPointDir[2]-newPoint[2] ); + bbSetOutputOutDirection( outDir ); + } else { + printf("EED Warning! ApplyTransformToPoint3D::Process Incoherent sizes Point(3)=%d DirectionInPoint(3)=%d\n", bbGetInputPoint().size(),bbGetInputDirectionInPoint().size() ); + }// if Point size + printf("EED ApplyTransformToPoint3D::Process End\n "); + +} + +//===== +// 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 ApplyTransformToPoint3D::bbUserSetDefaultValues() +{ +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + + std::vector point; + point.push_back(0); + point.push_back(0); + point.push_back(0); + bbSetInputPoint( point ); + std::vector dir; + dir.push_back(0); + dir.push_back(0); + dir.push_back(1); + bbSetInputDirectionInPoint( dir ); + bbSetInputTransform(NULL); +} + +//===== +// 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 ApplyTransformToPoint3D::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 ApplyTransformToPoint3D::bbUserFinalizeProcessing() +{ +// THE FINALIZATION METHOD BODY : +// Here does nothing +// but this is where you should desallocate the internal/output pointers +// if any +} + +} // EO namespace bbcreaVtk + +