56 vtkErrorMacro(<<
"Error: no LevelSetsImage has been set!");
60 vtkDataArray* inputScalars = input->GetPointData()->GetScalars();
61 vtkDataArray* levelSetsScalars = this->
LevelSetsImage->GetPointData()->GetScalars();
62 vtkDataArray* outputScalars = output->GetPointData()->GetScalars();
65 input->GetSpacing(spacing);
67 double minSpacing = spacing[0];
68 if (spacing[1] < minSpacing)
70 minSpacing = spacing[1];
72 if (spacing[2] < minSpacing)
74 minSpacing = spacing[2];
77 double windowValue = 4.0;
78 double windowValueReal = windowValue * minSpacing;
79 double sigmaReal = this->
Sigma * minSpacing;
83 int numberOfPoints = input->GetNumberOfPoints();
89 for (i=0; i<numberOfPoints; i++)
91 scaleValue += inputScalars->GetComponent(i,0);
93 scaleValue /= numberOfPoints;
96 for (i=0; i<numberOfPoints; i++)
98 double featureValue = inputScalars->GetComponent(i,0);
99 double levelSetsValue = levelSetsScalars->GetComponent(i,0);
100 if (levelSetsValue < windowValueReal)
102 double sigmoidValue = scaleValue * 1.0 / (1.0 + std::exp((levelSetsValue-sigmaReal)/(0.5*sigmaReal)));
103 featureValue += sigmoidValue;
105 outputScalars->SetComponent(i,0,featureValue);