[vtkusers] Cannot open Dicom images
Hongsongyang
hongsongyang at 163.com
Thu May 23 23:48:20 EDT 2013
If you want to read only one DICOM image, you can use texture to display it,
and SetFileName in vtkDICOMImageReader is OK.
If you want to construct 3D volume according to one series DICOM images,
SetDirectoryName should be used instead of SetFileName.
But if you want to browse the DICOM iamges one after another, only use
SetDirectoryName is not correct.
You should write some logical code to caculate the file path for each DICOM
iamge you want to display.
And only use SetFileName, but not SetDirectoryName.
In sum, SetDirectoryName will load a volume information, wherea SetFileName
will only load one image at a time.
> -----Original Message-----
> From: vtkusers-bounces at vtk.org
> [mailto:vtkusers-bounces at vtk.org] On Behalf Of David Cole
> Sent: Friday, May 24, 2013 12:49 AM
> To: smapersmaper at gmail.com; vtkusers at vtk.org
> Subject: Re: [vtkusers] Cannot open Dicom images
>
> -----Original Message-----
> From: Max <smapersmaper at gmail.com>
> To: vtkusers <vtkusers at vtk.org>
> Sent: Thu, May 23, 2013 7:27 am
> Subject: Re: [vtkusers] Cannot open Dicom images
>
>
> I succeeded in showing one image with SetFileName function.
> But when i'm trying to use SetDirectoryName function to show
> all the files in current directory, it shows nothing. the code is:
>
> using System;
> using System.Collections.Generic;
> using System.ComponentModel;
> using System.Data;
> using System.Drawing;
> using System.Linq;
> using System.Text;
> using System.Windows.Forms;
> using Kitware.VTK;
>
> namespace AAASimpleDicomReader
> {
> public partial class Form1 : Form
> {
> public Form1()
> {
> InitializeComponent();
> }
>
> private void renderWindowControl1_Load(object
> sender, EventArgs
> e)
> {
>
> string folder = @"c:\\DicomPhantom\\A\\";
> string file = "20121203135029687";
> //string folder =
> @"c:\DicomImages\VTK_Examples_StandardFormats_Input_DicomTestI
> mages\matla
> b\examples\sample_data\DICOM\digest_article\";//Path.Combine(root,
> @"Data\DicomTestImages");
> vtkDICOMImageReader reader1 = vtkDICOMImageReader.New();
> //reader1.SetFileName(folder + file);
> reader1.SetDirectoryName(folder);
> reader1.Update();
>
>
> vtkLookupTable VTKtable = vtkLookupTable.New();
> //VTKtable.SetNumberOfTableValues(1000);
> //VTKtable.SetTableRange(0,1000);
> //VTKtable.SetSaturationRange(0,1);
> //VTKtable.SetHueRange(0,1);
> //VTKtable.SetValueRange(0,1);
> //VTKtable.SetAlphaRange(0,1);
> //VTKtable.Build();
>
> vtkTexture VTKtexture = vtkTexture.New();
> VTKtexture.SetInput(reader1.GetOutput());
> // VTKtexture.InterpolateOn();
> //VTKtexture.SetLookupTable(VTKtable);
>
> vtkPlaneSource VTKplane = vtkPlaneSource.New();
> //VTKplane.SetOrigin( -0.5, -0.5, 0.0);
> //VTKplane.SetPoint1( 0.5, -0.5, 0.0);
> //VTKplane.SetPoint2(-0.5, 0.5, 0.0);
>
> vtkPolyDataMapper VTKplaneMapper =
> vtkPolyDataMapper.New();
> VTKplaneMapper.SetInput(VTKplane.GetOutput());
>
> vtkActor VTKplaneActor = vtkActor.New();
> VTKplaneActor.SetTexture(VTKtexture);
> VTKplaneActor.SetMapper(VTKplaneMapper);
> //VTKplaneActor.PickableOn();
>
> vtkRenderer ren = vtkRenderer.New();
> vtkRenderWindow renwin = renderWindowControl1.RenderWindow;
> renwin.AddRenderer(ren);
> vtkRenderWindowInteractor iren =
> vtkRenderWindowInteractor.New();
> iren.SetRenderWindow(renwin);
> ren.AddActor(VTKplaneActor);
> //ren.SetBackground(0,0,0.5);
>
> ren.ResetCamera();
> ren.Render();
> // iren.Start();
>
> //reader.Delete();
> //VTKtable.Delete();
> //VTKtexture.Delete();
> //VTKplane.Delete();
> //VTKplaneMapper.Delete();
> //VTKplaneActor.Delete();
> //ren.Delete();
> //renwin.Delete();
> //iren.Delete();
>
>
>
> }
>
>
> }
> }
>
> Do you know maybe what might be the problem?
>
> Thank you,
> Max
>
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Cannot-open-Dicom-images-tp57
> 20907p5720915.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
>
> Hi Max,
>
> When you use the vtkDICOMImageReader to read a single slice
> file, the result is a 2D vtkImageData object. When you use it
> to read a whole directory of slices, the result is a 3D
> vtkImageData object.
>
> You can't use a 3D image data as input to a vtkTexture like that.
> You'll have to use just a slice of the 3D image if you want
> to use it as input to a texture.
>
> Or you can render it as a volume, or an iso-surface, or
> perhaps as three 2-D slice planes that slice into it along
> the main axes...
>
> The Qt-based C++ example in
> VTK/Examples/GUI/Qt/FourPaneViewer actually gives you a
> little four-views-in-one-window app that displays a DICOM
> directory using vtkResliceImageViewer and vtkImagePlaneWidget
> classes.
> (May not be the best example for a beginner, but it does show
> one way to view a 3D DICOM...)
>
>
> Hope this helps,
> David C.
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK 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