Created
September 17, 2014 23:06
-
-
Save pieper/f87c683f48747b3aaef7 to your computer and use it in GitHub Desktop.
render a smoothed image by supersampling - hack for slicer4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lm = slicer.app.layoutManager() | |
tw = lm.threeDWidget(0) | |
tv = tw.threeDView() | |
rw = tv.renderWindow() | |
ren = rw.GetRenderers().GetItemAsObject(0) | |
wti = vtk.vtkWindowToImageFilter() | |
wti.SetMagnification(4) | |
rw2 = vtk.vtkRenderWindow() | |
rw2.SetSize(500,500) | |
rens2 = rw2.GetRenderers() | |
rens2.AddItem(ren) | |
rw2.Render() | |
slicer.app.processEvents() | |
wti.SetInput(rw2) | |
pw = vtk.vtkPNGWriter() | |
pw.SetFileName('/tmp/big.png') | |
pw.SetInputConnection(wti.GetOutputPort()) | |
pw.Update() | |
pw.Write() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment