Commit 9414d605 authored by Alexis Girault's avatar Alexis Girault

vtkMarchingCubes: Update tests to account for orientation

parent 4e8b769f
a91672e8647abac2f800f3817df97de2b40b28d2a16d2831fef3a4ad26802e970dc06cd9d05d0198ed48c941e0edcca6e6dede5071ce5ed3a7ce52fabae18c4c
79a8682a5f9541014662bb7cca944b1e44b0e2312d203522eaa5399651727d23121aad785f441894ac52382d224603c9f198e49250d0eecfec794d754ded2116
#!/usr/bin/env python
import vtk
from math import cos, sin, pi
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
......@@ -72,6 +73,14 @@ while i < n:
i += 1
angle = pi/6
orientation = [
-cos(angle), 0, sin(angle),
0, 1, 0,
sin(angle), 0, cos(angle),
]
blobImage.SetDirectionMatrix(orientation)
discrete = vtk.vtkDiscreteMarchingCubes()
discrete.SetInputData(blobImage)
discrete.GenerateValues(n, 1, n)
......
#!/usr/bin/env python
import vtk
from math import cos, sin, pi
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
......@@ -13,12 +14,20 @@ iren.SetRenderWindow(renWin)
# create pipeline
#
angle = pi/2
orientation = [
-1, 0, 0,
0, cos(angle), -sin(angle),
0, -sin(angle), -cos(angle)
]
v16 = vtk.vtkVolume16Reader()
v16.SetDataDimensions(64, 64)
v16.SetDataByteOrderToLittleEndian()
v16.SetFilePrefix(VTK_DATA_ROOT + "/Data/headsq/quarter")
v16.SetImageRange(1, 93)
v16.SetDataSpacing(3.2, 3.2, 1.5)
v16.SetDataOrigin(0.1, 10, 1000)
v16.GetOutput().SetDirectionMatrix(orientation)
v16.Update()
iso = vtk.vtkMarchingCubes()
......@@ -39,13 +48,7 @@ ren1.AddActor(isoActor)
ren1.SetBackground(0.2, 0.3, 0.4)
renWin.SetSize(200, 200)
ren1.ResetCamera()
ren1.GetActiveCamera().Elevation(90)
ren1.GetActiveCamera().SetViewUp(0, 0, -1)
ren1.GetActiveCamera().Azimuth(180)
ren1.ResetCameraClippingRange()
renWin.Render()
# render the image
......
#!/usr/bin/env python
import vtk
from math import cos, sin, pi
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
......@@ -22,12 +23,19 @@ iren.SetRenderWindow(renWin)
# create pipeline
#
angle = pi/2
orientation = [
-1, 0, 0,
0, cos(angle), -sin(angle),
0, -sin(angle), -cos(angle)
]
reader = vtk.vtkImageReader2()
reader.SetDataScalarTypeToUnsignedShort()
reader.SetFilePrefix(VTK_DATA_ROOT + "/Data/headsq/quarter")
reader.SetDataExtent(0, 63, 0, 63, 1, 93)
reader.SetDataSpacing(3.2, 3.2, 1.5)
reader.SetDataOrigin(0.0, 0.0, 0.0)
reader.GetOutput().SetDirectionMatrix(orientation)
iso = vtk.vtkImageMarchingCubes()
iso.SetInputConnection(reader.GetOutputPort())
......@@ -59,13 +67,7 @@ ren1.AddActor(isoActor)
ren1.SetBackground(0.2, 0.3, 0.4)
renWin.SetSize(200, 200)
ren1.ResetCamera()
ren1.GetActiveCamera().Elevation(90)
ren1.GetActiveCamera().SetViewUp(0, 0, -1)
ren1.GetActiveCamera().Azimuth(180)
ren1.ResetCameraClippingRange()
renWin.Render()
# render the image
......
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