[vtkusers] vtkVolume16Reader
LIAM JAMES ATKINS
99087138 at luton.ac.uk
Wed Mar 10 16:22:19 EST 2004
i am having trouble with displaying a ct scan using the vtkVolume16Reader i have transported it from dicom format to raw format but it just shows a very faint outline of the scan it vaguely looks like it should and appears 4 times. i gather the reason for it appearing 4 times is because it is an 8 bit raw file.
so i need help on why im am not getting a decent image up and how to change it from an 8 bit file to a 16 bit file can any one help??
the code is:
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkProperty.h"
#include "vtkCamera.h"
#include "vtkContourFilter.h"
#include "vtkVolume16Reader.h"
#include "vtkPolyDataNormals.h"
int main (int argc, char **argv)
{
vtkRenderer *aRenderer = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(aRenderer);
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
vtkVolume16Reader *v16 = vtkVolume16Reader::New();
v16->SetDataDimensions(217,181);
v16->SetImageRange (1,2000);
v16->SetDataByteOrderToLittleEndian();
v16->SetFilePrefix("brainweb1e1a10f20");
v16->SetFilePattern("brainweb1e1a10f20.raw");
v16->SetDataSpacing (72, 126, 90);
v16->Update();
vtkContourFilter *skinExtractors = vtkContourFilter::New();
skinExtractors->SetInput((vtkDataSet *) v16->GetOutput());
skinExtractors->SetValue(0, 500);
vtkPolyDataNormals *skinNormals = vtkPolyDataNormals::New();
skinNormals->SetInput(skinExtractors->GetOutput());
skinNormals->SetFeatureAngle(60.0);
vtkPolyDataMapper *skinMapper = vtkPolyDataMapper::New();
skinMapper->SetInput(skinNormals->GetOutput());
skinMapper->ScalarVisibilityOff();
vtkActor *skin = vtkActor::New();
skin->SetMapper(skinMapper);
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();
skinExtractors->Delete();
skinNormals->Delete();
skinMapper->Delete();
skin->Delete();
aCamera->Delete();
iren->Delete();
renWin->Delete();
aRenderer->Delete();
return 0;
}
More information about the vtkusers
mailing list