[vtkusers] magnify vtkChartXY image

Bill Lorensen bill.lorensen at gmail.com
Mon Dec 17 12:18:33 EST 2012


Randy,

Have you tried vtkRenderLargeImage:
http://vtk.org/Wiki/VTK/Examples/Cxx/Visualization/RenderLargeImage

I have not tried it with a chart, but it's worth a shot.

Regards,

Bill

On Fri, Dec 14, 2012 at 4:16 PM, Randy Heiland <heiland at indiana.edu> wrote:
> Is there some way to magnify (or set the resolution of) a rendered chart, in order to generate a higher-res image from a Writer?  e.g. I attempted the following simple Python script, which did indeed generate a magnified (x 2) .png image, but it was not what I expected.
>
> thanks, Randy
>
> from vtk import *
>
> table = vtkTable()
> arrX = vtkFloatArray()
> arrX.SetName("X")
> table.AddColumn(arrX)
> arrY = vtkFloatArray()
> arrY.SetName("Y")
> table.AddColumn(arrY)
>
> table.SetNumberOfRows(2)
> table.SetValue(0, 0, 0.0)
> table.SetValue(1, 0, 1.0)
> table.SetValue(0, 1, 0.0)
> table.SetValue(1, 1, 1.0)
>
> view = vtkContextView()
>
> chart = vtkChartXY()
> view.GetScene().AddItem(chart)
> line = chart.AddPlot(vtkChart.LINE)
> line.SetInput(table, 0, 1)
>
> view.GetInteractor().Initialize()
> view.GetRenderWindow().SetSize(200,200)
>
> imgFilter = vtkWindowToImageFilter()
> imgFilter.SetInput(view.GetRenderWindow())
> imgFilter.SetMagnification(2)
>
> writer=vtkPNGWriter()
> writer.SetFileName("chart.png")
> writer.SetInputConnection(imgFilter.GetOutputPort())
> writer.Write()
>
> #view.GetInteractor().Start()
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers



-- 
Unpaid intern in BillsBasement at noware dot com



More information about the vtkusers mailing list