[vtkusers] Creating 3D visualisation from a series of TIF images
Thomas Hansen
thomas.hansen at gmail.com
Tue Jul 12 22:01:03 EDT 2005
I am having some troublecreating a visualisation from aseries of tif images.
I took the Medical1.py script as a template and edited it.
basically changing the image reader to a TIFFReader (is tif != tiff).
but when irun teh whole thing i always get the folloeing error:
vtkPolyDataNormals (0x815ceb0): No data to generate normals for!
I suspect from looking at other posts and internet resources it has something
to do with setting the correct value for teh contourfilter ???
There is 88 images named 000.tif through 088.tif.
they are 8bpp bitdepth monochrome 1024x1024 tif images
Can anyone help me?
Thanks,
Thomas Hansen
Here is the script:
aRenderer = vtkRenderer()
renWin = vtkRenderWindow()
renWin.AddRenderer(aRenderer)
iren = vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
v16 = vtkTIFFReader()
v16.SetFilePrefix("")
v16.SetFilePattern("%s%03i.tif")
v16.SetDataExtent(0,1024,0,1024,0,88)
v16.SetDataSpacing(0.8,0.8,4.0)
v16.Update()
.
skinExtractor = vtkContourFilter()
skinExtractor.SetInput(v16.GetOutput())
skinExtractor.SetValue(100, 1000)
# for some reason i cant create any normals
skinNormals = vtkPolyDataNormals()
skinNormals.SetInput(skinExtractor.GetOutput())
skinNormals.SetFeatureAngle(60.0)
skinMapper = vtkPolyDataMapper()
skinMapper.SetInput(skinNormals.GetOutput())
skinMapper.ScalarVisibilityOff()
skin = vtkActor()
skin.SetMapper(skinMapper)
outlineData = vtkOutlineFilter()
outlineData.SetInput(v16.GetOutput())
mapOutline = vtkPolyDataMapper()
mapOutline.SetInput(outlineData.GetOutput())
outline = vtkActor()
outline.SetMapper(mapOutline)
outline.GetProperty().SetColor(0, 0, 0)
.
aCamera = vtkCamera()
aCamera.SetViewUp(0, 0, -1)
aCamera.SetPosition(0, 1, 0)
aCamera.SetFocalPoint(0, 0, 0)
aCamera.ComputeViewPlaneNormal()
aRenderer.AddActor(outline)
aRenderer.AddActor(skin)
aRenderer.SetActiveCamera(aCamera)
aRenderer.ResetCamera()
aCamera.Dolly(1.5)
aRenderer.SetBackground(1, 1, 1)
renWin.SetSize(640, 480)
aRenderer.ResetCameraClippingRange()
iren.Initialize()
renWin.Render()
iren.Start()
More information about the vtkusers
mailing list