Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
VTK
VTK
Commits
9414d605
Commit
9414d605
authored
May 22, 2019
by
Alexis Girault
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vtkMarchingCubes: Update tests to account for orientation
parent
4e8b769f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
13 deletions
+27
-13
Filters/General/Testing/Data/Baseline/TestDiscreteMarchingCubes.png.sha512
...esting/Data/Baseline/TestDiscreteMarchingCubes.png.sha512
+1
-1
Filters/General/Testing/Python/TestDiscreteMarchingCubes.py
Filters/General/Testing/Python/TestDiscreteMarchingCubes.py
+9
-0
Filters/General/Testing/Python/TestMarchingCubes.py
Filters/General/Testing/Python/TestMarchingCubes.py
+9
-6
Filters/Modeling/Testing/Python/TestImageMarchingCubes.py
Filters/Modeling/Testing/Python/TestImageMarchingCubes.py
+8
-6
No files found.
Filters/General/Testing/Data/Baseline/TestDiscreteMarchingCubes.png.sha512
View file @
9414d605
a91672e8647abac2f800f3817df97de2b40b28d2a16
d2
8
31
fef3a4ad26802e970dc06cd9d05d0198ed48c941e0edcca6e6dede5071ce5ed3a7ce52fabae18c4c
79a8682a5f9541014662bb7cca944b1e44b0e2312d203522eaa5399651727
d231
21aad785f441894ac52382d224603c9f198e49250d0eecfec794d754ded2116
Filters/General/Testing/Python/TestDiscreteMarchingCubes.py
View file @
9414d605
#!/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
)
...
...
Filters/General/Testing/Python/TestMarchingCubes.py
View file @
9414d605
#!/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
...
...
Filters/Modeling/Testing/Python/TestImageMarchingCubes.py
View file @
9414d605
#!/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
...
...
Alexis Girault
@alexis-girault
mentioned in commit
0a9fb2bd
·
Jun 04, 2019
mentioned in commit
0a9fb2bd
mentioned in commit 0a9fb2bdfb17dff392e11a05e2e35220a78b160b
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment