Commit 53e22801 authored by Andrew Maclean's avatar Andrew Maclean
Browse files

Removing random in regression tests.



It was noticed in skinOrder.tcl that when run under ctest,
math.Random() produces different results to that when run
interactively.
These are the rgb values when skinOrder.tcl is run as a test:
 0.87595 0.598302 0.656878
 0.641134 0.536594 0.537889 ...

When we run the tcl version as as standalone:
 0.504606 0.909988 0.673732
 0.915603 0.533519 0.857481 ...

In the case of Python code the standalone values are the same
as when it is run under ctest.

To resolve this discrepancy, preset values are used.

TestParametricFunctions.tcl has been moved to
Common/ComputationalGeometry/Testing/Tcl but not activated
as a test because the Python one should be sufficient.

Change-Id: I1a35ff34ba139ce5afd15ad3f3c81b4fe444c4aa
Signed-off-by: Andrew Maclean's avatarAndrew Maclean <andrew.amaclean@gmail.com>
parent 1ecd8f83
......@@ -207,13 +207,19 @@ class TestParametricFunctions(vtk.test.Testing.vtkTest):
# ------------------------------------------------------------
# Create an open 1D spline
# ------------------------------------------------------------
math = vtk.vtkMath()
splinePoints = [[ -0.981576726763 , 0.639953289013 , -0.305071552892 ],
[ 0.6624105478 , -0.865923131754 , 0.429924616325 ],
[ -0.2569734311 , -0.952456491977 , 0.0637393393851 ],
[ -0.732922955292 , -0.236109588871 , -0.293860152035 ],
[ -0.907575251492 , 0.382748181644 , 0.848688894812 ],
[ -0.0857448890273 , 0.885650117828 , -0.878469658959 ],
[ -0.439558122977 , 0.346627118693 , -0.238016126323 ],
[ -0.337035103392 , -0.548982715024 , -0.752491410706 ],
[ 0.876860257181 , -0.609657562156 , -0.514647156705 ],
[ 0.325237251504 , 0.26248602721 , -0.397340677398 ]]
inputPoints = vtk.vtkPoints()
for i in range(0, 10):
x = math.Random(-1, 1)
y = math.Random(-1, 1)
z = math.Random(-1, 1)
inputPoints.InsertPoint(i,x,y,z)
inputPoints.InsertPoint(i, splinePoints[i])
spline = vtk.vtkParametricSpline()
spline.SetPoints(inputPoints)
......@@ -552,9 +558,9 @@ class TestParametricFunctions(vtk.test.Testing.vtkTest):
iren.Initialize()
renWin.Render()
#iren.Start()
img_file = "TestParametricFunctions.png"
vtk.test.Testing.compareImage(iren.GetRenderWindow(),vtk.test.Testing.getAbsImagePath(img_file),threshold=25)
vtk.test.Testing.compareImage(iren.GetRenderWindow(), vtk.test.Testing.getAbsImagePath(img_file), threshold=25)
vtk.test.Testing.interact()
if __name__ == "__main__":
......
# ------------------------------------------------------------
# Purpose: Test the paraemtric functions.
# Purpose: Test the parametric functions.
# ------------------------------------------------------------
# ------------------------------------------------------------
......@@ -199,13 +199,21 @@ vtkActor2D superEllipsoidTextActor
# ------------------------------------------------------------
# Create an open 1D spline
# ------------------------------------------------------------
vtkMath math
set p0 "-0.981576726763 0.639953289013 -0.305071552892"
set p1 "0.6624105478 -0.865923131754 0.429924616325"
set p2 "-0.2569734311 -0.952456491977 0.0637393393851"
set p3 "-0.732922955292 -0.236109588871 -0.293860152035"
set p4 "-0.907575251492 0.382748181644 0.848688894812"
set p5 "-0.0857448890273 0.885650117828 -0.878469658959"
set p6 "-0.439558122977 0.346627118693 -0.238016126323"
set p7 "-0.337035103392 -0.548982715024 -0.752491410706"
set p8 "0.876860257181 -0.609657562156 -0.514647156705"
set p9 "0.325237251504 0.26248602721 -0.397340677398"
vtkPoints inputPoints
for {set i 0} {$i < 10} {incr i 1} {
set x [math Random -1 1]
set y [math Random -1 1]
set z [math Random -1 1]
inputPoints InsertPoint $i $x $y $z
set p [set p${i}]
inputPoints InsertPoint $i [lindex $p 0] [lindex $p 1] [lindex $p 2]
}
vtkParametricSpline spline
spline SetPoints inputPoints
......@@ -546,5 +554,3 @@ renWin Render
# prevent the tk window from showing up then start the event loop
wm withdraw .
......@@ -28,6 +28,13 @@ vtkMath math
set orders "ap pa si is lr rl"
set skinColor_ap "0.875950 0.598302 0.656878"
set skinColor_pa "0.641134 0.536594 0.537889"
set skinColor_si "0.804079 0.650506 0.558249"
set skinColor_is "0.992896 0.603716 0.660385"
set skinColor_lr "0.589101 0.513448 0.523095"
set skinColor_rl "0.650247 0.700527 0.752458"
foreach order $orders {
vtkVolume16Reader reader$order
eval reader$order SetDataDimensions $RESOLUTION $RESOLUTION
......@@ -53,7 +60,8 @@ foreach order $orders {
vtkActor actor$order
actor$order SetMapper mapper$order
[actor$order GetProperty] SetDiffuseColor [math Random .5 1] [math Random .5 1] [math Random .5 1]
set skinColor [set skinColor_${order}]
[actor$order GetProperty] SetDiffuseColor [lindex $skinColor 0] [lindex $skinColor 1] [lindex $skinColor 2]
ren1 AddActor actor$order
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment