[vtkusers] 2D to 3D dicom image

Mark Wyszomierski markww at gmail.com
Thu Aug 30 10:53:19 EDT 2007


I think vtkImageActor displays a single image, not a 3D volume. You
need to use a volume mapper for that. If you know you want to read
DICOM images, why not use vtkDICOMReader instead of vtkVolume16Reader?
The SetDataSpacing() should represent (in your case) the pixel spacing
x,y and then spacing between slices (these are taken from the DICOM
tags of the images you're reading).

You can just download and hack the sample here (if you don't want to
use it directly in its entirety):

http://devsample.org/index.php?option=com_content&task=view&id=18&Itemid=1

If you're having problems with it let me know,

Mark


On 8/29/07, m26404030 at john.petra.ac.id <m26404030 at john.petra.ac.id> wrote:
> I am a newbie who want to read a set of DICOM images and display it as 3D
> volume..
> i dont know how to do it..
> plis help me
>
> this is my code(still wrong)
> -------------------------------------------
>
> void main()
> {
> vtkRenderer *aRenderer = vtkRenderer::New();
> vtkRenderWindow *renWin = vtkRenderWindow::New();
> renWin->AddRenderer(aRenderer);
> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
> iren->SetRenderWindow(renWin);
>
> vtkVolume16Reader *reader=vtkVolume16Reader::New();
> reader->SetDataByteOrderToLittleEndian();
> reader->SetFilePrefix("SE1/image.dcm");//i put my image in folder SE1 and named
> it image.dcm.1,image.dcm.2,...,image.dcm.58
> reader->SetImageRange(1,58);
> reader->SetDataSpacing (1,1,1);//dont really understand what data spacing means
> reader->Update();
>
> vtkImageActor *vol=vtkImageActor::New();
> vol->SetInput(reader->GetOutput());
>
> aRenderer->AddActor(vol);
>
> renWin->Render();
> iren->Start();
> }
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list