Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VTK Examples
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VTK
VTK Examples
Commits
c1c8af1e
Commit
c1c8af1e
authored
1 year ago
by
Andrew Maclean
Browse files
Options
Downloads
Patches
Plain Diff
Remove unneeded code
parent
d8d72bba
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Python/IO/CSVReadEdit.py
+0
-68
0 additions, 68 deletions
src/Python/IO/CSVReadEdit.py
with
0 additions
and
68 deletions
src/Python/IO/CSVReadEdit.py
+
0
−
68
View file @
c1c8af1e
...
...
@@ -339,74 +339,6 @@ def get_diverging_lut1(start: str, mid: str, end: str, table_size: int = 256):
return
lut
from
vtkmodules.vtkIOImage
import
(
vtkBMPWriter
,
vtkJPEGWriter
,
vtkPNGWriter
,
vtkPNMWriter
,
vtkPostScriptWriter
,
vtkTIFFWriter
)
from
vtkmodules.vtkRenderingCore
import
vtkWindowToImageFilter
def
write_image
(
file_name
,
ren_win
,
rgba
=
True
):
"""
Write the render window view to an image file.
Image types supported are:
BMP, JPEG, PNM, PNG, PostScript, TIFF.
The default parameters are used for all writers, change as needed.
:param file_name: The file name, if no extension then PNG is assumed.
:param ren_win: The render window.
:param rgba: Used to set the buffer type.
:return:
"""
if
file_name
:
valid_suffixes
=
[
'
.bmp
'
,
'
.jpg
'
,
'
.png
'
,
'
.pnm
'
,
'
.ps
'
,
'
.tiff
'
]
# Select the writer to use.
parent
=
Path
(
file_name
).
resolve
().
parent
path
=
Path
(
parent
)
/
file_name
if
path
.
suffix
:
ext
=
path
.
suffix
.
lower
()
else
:
ext
=
'
.png
'
path
=
Path
(
str
(
path
)).
with_suffix
(
ext
)
if
path
.
suffix
not
in
valid_suffixes
:
print
(
f
'
No writer for this file suffix:
{
ext
}
'
)
return
if
ext
==
'
.bmp
'
:
writer
=
vtkBMPWriter
()
elif
ext
==
'
.jpg
'
:
writer
=
vtkJPEGWriter
()
elif
ext
==
'
.pnm
'
:
writer
=
vtkPNMWriter
()
elif
ext
==
'
.ps
'
:
if
rgba
:
rgba
=
False
writer
=
vtkPostScriptWriter
()
elif
ext
==
'
.tiff
'
:
writer
=
vtkTIFFWriter
()
else
:
writer
=
vtkPNGWriter
()
windowto_image_filter
=
vtkWindowToImageFilter
()
windowto_image_filter
.
SetInput
(
ren_win
)
windowto_image_filter
.
SetScale
(
1
)
# image quality
if
rgba
:
windowto_image_filter
.
SetInputBufferTypeToRGBA
()
else
:
windowto_image_filter
.
SetInputBufferTypeToRGB
()
# Read from the front buffer.
windowto_image_filter
.
ReadFrontBufferOff
()
windowto_image_filter
.
Update
()
writer
.
SetFileName
(
path
)
writer
.
SetInputConnection
(
windowto_image_filter
.
GetOutputPort
())
writer
.
Write
()
else
:
raise
RuntimeError
(
'
Need a filename.
'
)
if
__name__
==
'
__main__
'
:
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment