anyway, out of curiosity just checked if one would crash fc by doing a vkt-interactor through fc - it did not crash - so in that sense you have hope if you're ok with an external vtk window, you will have to code all the interaction, but that is needed regardless if it is inside or outside of fc.
is vtk alive in the python world of fc?
Code: Select all
>>> import vtk
>>> vtk.vtkColor3f(.5, 5, 5)
(vtkCommonDataModelPython.vtkColor3f)[0.5, 5.0, 5.0]
>>>
let's read an image
Code: Select all
>>> img = vtk.vtkPNGReader('/home/abc/Pictures/alarm bell.png')
Traceback (most recent call last):
File "<input>", line 1, in <module>
ValueError: could not extract hexadecimal address from argument string
>>> ## oops - forgot that getting anything done in vtk is really cumbersome...
>>>
>>> img = vtk.vtkPNGReader()
>>> img.SetFileName('/home/abc/Pictures/alarm bell.png')
>>> img.Update()
>>> ## no errors, so seemingly it works
>>> img
(vtkIOImagePython.vtkPNGReader)0x7f0fc34b8160
>>> img.GetDataExtent()
(0, 140, 0, 143, 0, 0)
now, can we crash fc with a scene and interactor?
Code: Select all
>>> actor = vtk.vtkImageActor()
>>> actor.GetMapper().SetInputConnection(img.GetOutputPort())
>>> renderer = vtk.vtkRenderer()
>>> renderer.AddActor(actor)
>>> window = vtk.vtkRenderWindow()
>>> window.AddRenderer(renderer)
>>> interactor = vtk.vtkRenderWindowInteractor()
>>> interactor.SetRenderWindow(window)
>>> interactor.Initialize()
>>> interactor.Start()
of course it is blocking, close-icon on window does release the blocking, but it does not actually close the window - all that should be possible to make with proper clean-up code - this was just a test to see if there was any hope at all - and there was .
it all depends on you dedication to get something like this done, but embedding a vtk-app in fc is something that sounds like it would take a while to get it done.
first I would really evaluate if it is possible to live with only using the data crunching powers of vtk in fc, just guessing that it would make life a lot easier.
if not, I would make what I wanted (scene & interaction) in pure vtk, (i.e. not using fc at all to begin with, getting to know the vtk api is enough to cope with)
once that is done it is time to figure out how to get that into fc, can one live with a blocking process and an external window? how to write the clean-up code? etc?
or is the starting code of wmayer enough to get it embedded?
good luck.