Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Whitfield, Ross
wand
Commits
59fe2414
Commit
59fe2414
authored
Aug 30, 2018
by
Whitfield, Ross
Browse files
Update IPTS-21442/pv.py
parent
9f68a284
Changes
1
Hide whitespace changes
Inline
Side-by-side
IPTS-21442/pv.py
0 → 100644
View file @
59fe2414
#### import the simple module from the paraview
from
paraview.simple
import
*
# create a new 'Image Reader'
ringraw
=
ImageReader
(
FilePrefix
=
'/SNS/users/rwp/wand/IPTS-21442/ring.raw'
)
ringraw
.
DataScalarType
=
'double'
ringraw
.
DataByteOrder
=
'LittleEndian'
ringraw
.
DataExtent
=
[
0
,
40
,
0
,
40
,
0
,
24
]
ringraw
.
DataSpacing
=
[
1.0
,
1.0
,
2.0
]
# get active view
renderView1
=
GetActiveViewOrCreate
(
'RenderView'
)
# uncomment following to set a specific view size
# renderView1.ViewSize = [1106, 1633]
# show data in view
ringrawDisplay
=
Show
(
ringraw
,
renderView1
)
# reset view to fit data
# renderView1.ResetCamera()
# change representation type
ringrawDisplay
.
SetRepresentationType
(
'Volume'
)
# set scalar coloring
ColorBy
(
ringrawDisplay
,
(
'POINTS'
,
'ImageFile'
))
# get color transfer function/color map for 'ImageFile'
imageFileLUT
=
GetColorTransferFunction
(
'ImageFile'
)
# get opacity transfer function/opacity map for 'ImageFile'
imageFilePWF
=
GetOpacityTransferFunction
(
'ImageFile'
)
# show color bar/color legend
ringrawDisplay
.
SetScalarBarVisibility
(
renderView1
,
True
)
# Rescale transfer function
imageFileLUT
.
RescaleTransferFunction
(
0.0
,
10.0
)
# Rescale transfer function
imageFilePWF
.
RescaleTransferFunction
(
4.0
,
10.0
)
# Apply a preset using its name. Note this may not work as expected when presets have duplicate names.
imageFileLUT
.
ApplyPreset
(
'Inferno (matplotlib)'
,
True
)
renderView1
.
CameraViewUp
=
[
0
,
0
,
1
]
renderView1
.
CameraPosition
=
[
100
,
100
,
-
50
]
scene
=
GetAnimationScene
()
scene
.
NumberOfFrames
=
100
cameraAnimationCue1
=
GetCameraTrack
(
view
=
renderView1
)
import
vtk
p
=
vtk
.
vtkSMUtilities
.
CreateOrbit
((
0
,
0
,
0
),
(
0
,
0
,
1
),
7
,
(
100
,
100
,
-
50
))
keyFrame0
=
CameraKeyFrame
()
keyFrame0
.
PositionPathPoints
=
sum
([
list
(
p
.
GetPoint
(
n
))
for
n
in
range
(
p
.
GetNumberOfPoints
())],
[])
keyFrame0
.
ClosedPositionPath
=
1
keyFrame1
=
CameraKeyFrame
()
keyFrame1
.
KeyTime
=
1.0
cameraAnimationCue1
.
KeyFrames
=
[
keyFrame0
,
keyFrame1
]
SaveAnimation
(
'/tmp/Skyrmion.png'
,
renderView1
,
ImageResolution
=
[
600
,
600
],
FrameWindow
=
[
0
,
99
])
#### uncomment the following to render all views
# RenderAllViews()
# alternatively, if you want to write images, you can use SaveScreenshot(...).
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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