[vtkusers] magnify vtkChartXY image

Randy Heiland heiland at indiana.edu
Mon Dec 17 18:38:00 EST 2012


Sorry for the late reply - yes, I had tried it too and also got replicated charts.  But thanks for the follow-up!

On Dec 17, 2012, at 2:42 PM, Bill Lorensen wrote:

> I just tried it also. For some reason it just replicates the chart.
> 
> 
> 
> On Mon, Dec 17, 2012 at 1:42 PM, Gerrick Bivins
> <Gerrick.Bivins at halliburton.com> wrote:
>> Just an FYI,
>> I've tried to use that in the past and it didn't capture the render properly:
>> http://vtk.1045678.n5.nabble.com/vtkRenderLargeImage-and-multiple-renders-td1240248.html
>> 
>> I remember looking into it but I don't think I figured out what was wrong, something with multiple renderers was the issue for me I think.
>> It may be fixed now because that was a couple of years and version of vtk ago
>> Gerrick
>> 
>> 
>> -----Original Message-----
>> From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf Of Bill Lorensen
>> Sent: Monday, December 17, 2012 11:19 AM
>> To: Randy Heiland
>> Cc: vtkusers at vtk.org
>> Subject: Re: [vtkusers] magnify vtkChartXY image
>> 
>> 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 _______________________________________________
>> 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