[vtkusers] How to draw contour over Dicom?

Andrej Gluhov realandron at gmail.com
Tue Jul 20 15:21:50 EDT 2010


I'm trying to draw a contour on the image, but displays only DICOM. What's
wrong?

public partial class Form1 : Form
    {
......................
            vtkRenderWindow m_renWin;
            vtkRenderer m_renderer = new vtkRenderer();
            vtkRenderWindowInteractor m_iren = new
vtkRenderWindowInteractor();
            vtkDICOMImageReader m_DicomReader = new vtkDICOMImageReader();
            vtkImageViewer2 m_imageViewer = new vtkImageViewer2();
            vtkInteractorStyleImage m_interactorStyle = new
vtkInteractorStyleImage();
            vtkPointPicker m_picker = new vtkPointPicker();
            vtkImageData m_ImageData = new vtkImageData();
  vtkContourFilter m_ContourFilter = new vtkContourFilter();
  vtkActor m_isoActor = new vtkActor();
  vtkActor2D m_DicomActor = new vtkActor2D();//vtkActor2D is needed for the
real size image
......................
        public Form1()
        {
//Initialize window on Form
            vtkRenderWindow.GlobalWarningDisplayOff();
            m_renWin = reWin.GetRenderWindow();
            m_renWin.AddRenderer(m_renderer);
            //m_iren.SetInteractorStyle(m_interactorStyle);
            m_iren.SetRenderWindow(m_renWin);
            m_imageViewer.SetRenderer(m_renderer);
            m_imageViewer.SetRenderWindow(m_renWin);
}
//Draw DICOM
        private void OpenFile_Click(object sender, EventArgs e)
        {
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                textBoxFile.Text = openFileDialog.FileName;
                m_strFilePath = openFileDialog.FileName;
                ShowDicom();
            }
        }
        private void ShowDicom()
        {
            m_DicomReader.SetFileName(m_strFilePath);
            m_DicomReader.Update();

            vtkImageMapper DicomMapper = new vtkImageMapper();
            DicomMapper.SetInputConnection(m_DicomReader.GetOutputPort());
            DicomMapper.SetColorWindow(255.0);
            DicomMapper.SetColorLevel(127.5);

            m_DicomActor.SetMapper(DicomMapper);

            m_imageViewer.GetRenderer().AddActor(m_DicomActor);
            m_imageViewer.GetRenderer().ResetCamera();
            m_imageViewer.Render();
         }
//Draw Contour by Button Click
        private void btnvtkContourFilter_click(object sender, EventArgs e)
        {

m_ContourFilter.SetInputConnection(m_DicomReader.GetOutputPort());
            m_ContourFilter.SetValue(0, ClickIntensivity);
            m_ContourFilter.Update();

            m_isoMapper.SetInputConnection(m_ContourFilter.GetOutputPort());
            m_isoMapper.ScalarVisibilityOff();

            m_isoActor.SetMapper(m_isoMapper);
            m_isoActor.GetProperty().SetColor(1, 0, 0);

            m_imageViewer.GetRenderer().AddActor(m_isoActor);
            m_imageViewer.GetRenderer().ResetCamera();

            m_iren.Render();

        }


-- 
С Уважением,
Андрей.
Best regards, Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100720/149ca207/attachment.htm>


More information about the vtkusers mailing list