[vtkusers] Cannot open Dicom images

Max smapersmaper at gmail.com
Thu May 23 07:27:12 EDT 2013


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_DicomTestImages\matlab\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-tp5720907p5720915.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list