<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello:<br>
I use vtk 4 before, last week, i install vtk 6, it's looks like
some class and function changed. I write a simple code, read dicom
and display, it's can run success before i update the vtk to 6:<br>
<br>
//read dicom<br>
vtkDICOMImageReader *reader = vtkDICOMImageReader::New();<br>
reader->SetDataByteOrderToLittleEndian();<br>
reader->SetDirectoryName(path.c_str());<br>
reader->SetDataOrigin(0.0, 0.0, 0.0);<br>
<br>
//store in the vtkImageData<br>
vtkSmartPointer<vtkImageData> imageData =
vtkSmartPointer<vtkImageData>::New();<br>
imageData = reader->GetOutput();<br>
<br>
//i think here has problem, because gdb show bug here<br>
vtkImageCast *cast = vtkImageCast::New();<br>
cast->SetInputData(imageData);<br>
cast->ClampOverflowOn();<br>
cast->SetOutputScalarTypeToUnsignedShort();<br>
<br>
vtkPiecewiseFunction *opacityTransferFunction =
vtkPiecewiseFunction::New();<br>
opacityTransferFunction->RemoveAllPoints();<br>
opacityTransferFunction->AddPoint(0, 0.0);<br>
opacityTransferFunction->AddPoint(255, 1);<br>
<br>
vtkColorTransferFunction *colorTransferFunction =
vtkColorTransferFunction::New();<br>
colorTransferFunction->RemoveAllPoints();<br>
colorTransferFunction->AddRGBPoint(0.0, 0.0, 0.0, 0.0);<br>
colorTransferFunction->AddRGBPoint(255, 1.0, 1.0, 1.0);<br>
<br>
vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();<br>
volumeProperty->SetColor(colorTransferFunction);<br>
volumeProperty->SetScalarOpacity(opacityTransferFunction);<br>
volumeProperty->ShadeOn();<br>
volumeProperty->SetInterpolationTypeToLinear();<br>
<br>
vtkVolumeRayCastCompositeFunction *compositeFunction =
vtkVolumeRayCastCompositeFunction::New();<br>
vtkVolumeRayCastMapper *volumeMapper =
vtkVolumeRayCastMapper::New();<br>
volumeMapper->SetVolumeRayCastFunction(compositeFunction);<br>
volumeMapper->SetInputData(cast->GetOutput());<br>
<br>
vtkVolume *volume = vtkVolume::New();<br>
volume->SetMapper(volumeMapper); <br>
volume->SetProperty(volumeProperty);<br>
<br>
vtkCamera *aCamera = vtkCamera::New();<br>
aCamera->SetViewUp (0, 0, -1);<br>
aCamera->SetPosition (0, 1, 0);<br>
aCamera->SetFocalPoint (0, 0, 0);<br>
aCamera->ComputeViewPlaneNormal();<br>
aCamera->Dolly(1.0);<br>
<br>
vtkRenderer *renderer = vtkRenderer::New(); <br>
renderer->RemoveAllViewProps();<br>
renderer->AddVolume(volume);<br>
renderer->SetActiveCamera(aCamera);<br>
renderer->SetBackground( 0,0,0 );<br>
renderer->ResetCamera ();<br>
//renderer->Render();<br>
<br>
vtkRenderWindow *renWin = vtkRenderWindow::New();<br>
renWin->AddRenderer(renderer);<br>
renWin->SetSize(500, 500);<br>
renWin->Start();<br>
renWin->Render(); // gdb show the bug occur<br>
<br>
vtkRenderWindowInteractor *iren =
vtkRenderWindowInteractor::New();<br>
iren->SetRenderWindow(renWin);<br>
iren->Initialize();<br>
iren->Start();<br>
<br>
<u><big>the gdb show:</big></u><br>
[New Thread 0x7fffe1385700 (LWP 4012)]<br>
[Thread 0x7fffe1385700 (LWP 4012) exited]<br>
[New Thread 0x7fffe1385700 (LWP 4013)]<br>
[Thread 0x7fffe1385700 (LWP 4013) exited]<br>
[New Thread 0x7fffe1385700 (LWP 4014)]<br>
[Thread 0x7fffe1385700 (LWP 4014) exited]<br>
<br>
X Error of failed request: BadMatch (invalid parameter attributes)<br>
Major opcode of failed request: 156 (GLX)<br>
Minor opcode of failed request: 11 (X_GLXSwapBuffers)<br>
Serial number of failed request: 687<br>
Current serial number in output stream: 687<br>
[Inferior 1 (process 4006) exited with code 01]<br>
<br>
<br>
<br>
I dont kown what the difference between the vtk 6 and vtk 4, greate
appreciates for anyone's reply!<br>
<br>
<br>
<br>
</body>
</html>