2 // 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)
4 #include "bbvtkMeasureLength.h"
5 #include "bbvtkPackage.h"
9 BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,MeasureLength)
10 BBTK_BLACK_BOX_IMPLEMENTATION(MeasureLength,bbtk::AtomicBlackBox);
12 // 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)
14 void MeasureLength::Process()
16 //std::cout << "RaC MeasureLength::Process START"<< std::endl;
18 _points = bbGetInputPoints();
19 _image = bbGetInputImageData();
22 if(_image != NULL && _points->GetNumberOfPoints()>1)
28 _image->GetSpacing(spc);
29 _image->GetOrigin(origin);
32 first = _points->GetPoint(0);
35 firstWorld[0] = first[0]*spc[0] + origin[0];
36 firstWorld[1] = first[1]*spc[1] + origin[1];
37 firstWorld[2] = first[2]*spc[2] + origin[2];
41 for(int i = 1; i<_points->GetNumberOfPoints();i++)
44 second = _points->GetPoint(i);
45 double secondWorld[3];
46 secondWorld[0] = second[0]*spc[0] + origin[0];
47 secondWorld[1] = second[1]*spc[1] + origin[1];
48 secondWorld[2] = second[2]*spc[2] + origin[2];
50 double XFactor = secondWorld[0]-firstWorld[0];
51 double YFactor = secondWorld[1]-firstWorld[1];
52 double ZFactor = secondWorld[2]-firstWorld[2];
53 sumLength += XFactor*XFactor + YFactor*YFactor + ZFactor*ZFactor;
55 firstWorld[0] = secondWorld[0];
56 firstWorld[1] = secondWorld[1];
57 firstWorld[2] = secondWorld[2];
62 bbSetOutputLength(sumLength);
64 //std::cout << "RaC MeasureLength::Process END"<< std::endl;
67 // 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)
69 void MeasureLength::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 MeasureLength::bbUserInitializeProcessing()
84 // 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)
86 void MeasureLength::bbUserFinalizeProcessing()