[vtkusers]Have some troubles in Creating 3D visualisation from a series of TIF images
陈矛
chenmao47 at 163.com
Sun Apr 29 23:47:10 EDT 2007
Hi, all I am having some trouble in creating a visualisation from aseries of tif images.
I took the Medical1.cxx script as a template and edited it.
basically changing the image reader to a TIFFReader.
but when i run the whole thing i always get the folloeing error:
vtkPolyDataNormals (0x0221FC48): No data to generate normals for!
There is 60 images named 001.tif through 060.tif.
they are monochrome 1760x1024 tif images
Can anyone help me?
Thanks a lot, -- Jerry
Here is the script:
vtkRenderer *aRenderer = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(aRenderer);
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin); vtkTIFFReader *v16 = vtkTIFFReader::New();
v16->SetFilePrefix ("");
v16->SetFilePattern("%s%03d.TIF");
v16->SetDataExtent(0,1760,0,1024,1,60); v16->SetDataSpacing(0.8,0.8,4.0);
v16->SetDataByteOrderToLittleEndian ();
v16->Update();
vtkContourFilter *skinExtractor = vtkContourFilter::New();
skinExtractor->SetInput( (vtkDataSet *) ( v16->GetOutput() ) );
skinExtractor->SetValue(0, 500);
vtkPolyDataNormals *skinNormals = vtkPolyDataNormals::New();
skinNormals->SetInput(skinExtractor->GetOutput());
skinNormals->SetFeatureAngle(60.0);
vtkPolyDataMapper *skinMapper = vtkPolyDataMapper::New();
skinMapper->SetInput(skinNormals->GetOutput());
skinMapper->ScalarVisibilityOff();
vtkActor *skin = vtkActor::New();
skin->SetMapper(skinMapper); vtkOutlineFilter *outlineData = vtkOutlineFilter::New();
outlineData->SetInput( (vtkDataSet *) ( v16->GetOutput() ) );
vtkPolyDataMapper *mapOutline = vtkPolyDataMapper::New();
mapOutline->SetInput(outlineData->GetOutput());
vtkActor *outline = vtkActor::New();
outline->SetMapper(mapOutline);
outline->GetProperty()->SetColor(0,0,0); vtkCamera *aCamera = vtkCamera::New();
aCamera->SetViewUp (0, 0, -1);
aCamera->SetPosition (0, 1, 0);
aCamera->SetFocalPoint (0, 0, 0);
aCamera->ComputeViewPlaneNormal(); 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();
iren->Start();
v16->Delete();
skinExtractor->Delete();
skinNormals->Delete();
skinMapper->Delete();
skin->Delete();
outlineData->Delete();
mapOutline->Delete();
outline->Delete();
aCamera->Delete();
iren->Delete();
renWin->Delete();
aRenderer->Delete();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070430/8b5155f3/attachment.htm>
More information about the vtkusers
mailing list