[vtkusers] Dicom Image reader
JOHN ATKINSON
johnimager at gmail.com
Sat Apr 4 07:16:18 EDT 2009
Hi all,
I have a CT Dicom data set of brain .I want view the volume data set in VTK
.I used DICOM Image Reader but there is a error stating that
vtkDicomImageReader.cxx line 284 No memory allocated to image data .Please
Help
My code:
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkOutlineFilter.h"
#include "vtkCamera.h"
#include "vtkProperty.h"
#include "vtkPolyDataNormals.h"
#include "vtkContourFilter.h"
#include "vtkDICOMImageReader.h"
#include "vtkImageCast.h"
#include "vtkImageActor.h"
int main (int argc, char **argv)
{
// if (argc < 2)
// {
// cout << "Usage: " << argv[0] << " DATADIR/headsq/quarter" << endl;
// return 1;
// }
///*Renderer and Render Window*/
//vtkRenderer *aRenderer = vtkRenderer::New();
// vtkRenderWindow *renWin = vtkRenderWindow::New();
// renWin->AddRenderer(aRenderer);
// vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
// iren->SetRenderWindow(renWin
vtkDICOMImageReader *reader = vtkDICOMImageReader::New();
reader->SetFileName(argv[1]);
vtkImageCast *cast = vtkImageCast::New();
cast->SetInputConnection(reader->GetOutputPort());
cast->SetOutputScalarTypeToUnsignedChar();
vtkImageActor *actor = vtkImageActor::New();
actor->SetInput(cast->GetOutput());
vtkRenderer *render = vtkRenderer::New();
render->AddActor(actor);
render->ResetCamera();
vtkRenderWindow *window = vtkRenderWindow::New();
window->AddRenderer(render);
window->Render();
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090404/60fc7d6d/attachment.htm>
More information about the vtkusers
mailing list