Using The Slab to Adjust The 3D Object Tutorial

Show in webframe

This tutorial teaches you how to to use the slab feature with a 3D object and three MPR orthogonal slices (Axial, Sagittal and Coronal).

  1. Start with the project you created in Creating a 3D object with MPR view.
  2. Run the program and you should see four cells: One for the 3D object and the other three for Axial, Sagittal and Coronal cells.
  3. This tutorial attains similar results to Creating a 3D object with MPR view but without the cross-hair. To remove the cross-hair, we need to edit the InitClass() method to set the ShowMPRCrossHair Property of all cells to false.


    [Visual Basic]
    
                axialCell.ShowMPRCrossHair = false
                coronalCell.ShowMPRCrossHair = false
                sagittalCell.ShowMPRCrossHair = false
                                    
    
    [C#]
    
                axialCell.ShowMPRCrossHair = false;
                coronalCell.ShowMPRCrossHair = false;
                sagittalCell.ShowMPRCrossHair = false;
                                            
    
  4. Enable the slab property by adding the following line at the end of the method InitClass()


    [Visual Basic]
    
                control3D.ObjectsContainer.Objects(0).Slab.Enabled = True
                                            
    
    [C#]
    
                control3D.ObjectsContainer.Objects[0].Slab.Enabled = true;
                                            
    
  5. The InitClass() method should look as follows:
    [Visual Basic]

    
                Private Sub InitClass()
                     Dim MY_LICENSE_FILE As String = "d:\temp\TestLic.lic"
                     
                     ' Unlock DICOM support
                     Dim MY_DicomDEVELOPER_KEY As String = "xyz123abc"
                     RasterSupport.SetLicense(MY_LICENSE_FILE, MY_DicomDEVELOPER_KEY);
                     
                     ' Unlock Medical support
                     Dim MY_MedicalDEVELOPER_KEY As String = "abc123xyz"
                     RasterSupport.SetLicense(MY_LICENSE_FILE, MY_MedicalDEVELOPER_KEY);
                     
                     ' Unlock Medical 3D support
                     Dim MY_3DDEVELOPER_KEY As String = "123xyzabc"
                     RasterSupport.SetLicense(MY_LICENSE_FILE, MY_3DDEVELOPER_KEY);
                     
                     ' Create a new instance of the Codecs class, which will be used to load the images.
                     Dim _codecs As RasterCodecs = New RasterCodecs()
                     ' Create a new instance of the Medical Viewer. The layout will be divided to 2X2.
                     Dim viewer As MedicalViewer = New MedicalViewer(2, 2)
                     ' Fit the view to the whole form
                     viewer.Dock = DockStyle.Fill
                     ' Create the 3D control that will hold the 3D object.
                     Dim control3D As Medical3DControl = New Medical3DControl()
                     control3D.AddAction(MedicalViewerActionType.WindowLevel)
                     control3D.SetAction(MedicalViewerActionType.WindowLevel, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active)
                     Dim object3D As Medical3DObject = New Medical3DObject()
                     ' Add the newly created 3D object to the control.
                     control3D.ObjectsContainer.Objects.Add(object3D)
                     object3D.Image = _codecs.Load("C:\Users\Public\Documents\LEADTOOLS Images\image1.dcm")
                     ' Add the cell above to the MedicalViewer.
                     viewer.Cells.Add(control3D)
                     Controls.Add(viewer)
                     
                     ' Create a new cell that will hold the axial frame.
                     Dim axialCell As MedicalViewerMPRCell = New MedicalViewerMPRCell()
                     ' adjust some properties to view the cross hair.
                     axialCell.ShowMPRCrossHair = False
                     axialCell.DistinguishMPRByColor = True
                     
                     ' Assign this cell (axialCell) to the AxialFrame property of the Medical 3D control
                     control3D.AxialFrame = axialCell
                     
                     ' add the axial cell to the viewer
                     viewer.Cells.Add(axialCell)
                     
                     ' Create a new cell that will hold the coronal frame.
                     Dim coronalCell As MedicalViewerMPRCell = New MedicalViewerMPRCell()
                     
                     ' adjust some properties to view the cross hair.
                     coronalCell.ShowMPRCrossHair = False
                     coronalCell.DistinguishMPRByColor = True
                     
                     ' Assign this cell (coronalCell) to the CoronalFrame property of the Medical 3D control
                     control3D.CoronalFrame = coronalCell
                     
                     viewer.Cells.Add(coronalCell)
                     
                     ' Create a new cell that will hold the sagittal frame.
                     Dim sagittalCell As MedicalViewerMPRCell = New MedicalViewerMPRCell()
                     
                     ' adjust some properties to view the cross hair.
                     sagittalCell.ShowMPRCrossHair = False
                     sagittalCell.DistinguishMPRByColor = True
                     
                     ' Assign this cell (sagittalCell) to the SagittalFrame property of the Medical 3D control
                     control3D.SagittalFrame = sagittalCell
                     
                     viewer.Cells.Add(sagittalCell)
                     
                     ' Add the viewer as a child to the form.
                     Me.Controls.Add(viewer)
                     
                     control3D.ObjectsContainer.Objects(0).Slab.Enabled = True
                
    
    [C#]
    
                void InitClass()
                {
                     string MY_LICENSE_FILE = "d:\\temp\\TestLic.lic";
                   
                     // Unlock DICOM support
                     string MY_DicomDEVELOPER_KEY = "xyz123abc";
                     RasterSupport.SetLicense(MY_LICENSE_FILE, MY_DicomDEVELOPER_KEY);
                     
                     // Unlock Medical support
                     string MY_MedicalDEVELOPER_KEY = "abc123xyz";
                     RasterSupport.SetLicense(MY_LICENSE_FILE, MY_MedicalDEVELOPER_KEY);
                     
                     // Unlock Medical 3D support
                     string MY_3DDEVELOPER_KEY = "123xyzabc";
                     RasterSupport.SetLicense(MY_LICENSE_FILE, MY_3DDEVELOPER_KEY);
                     
                     // Create a new instance of the Codecs class, which will be used to load the images.
                     RasterCodecs _codecs = new RasterCodecs();
                     // Create a new instance of the Medical Viewer. The layout will be divided to 2X2.
                     MedicalViewer viewer = new MedicalViewer(2, 2);
                     // Fit the view to the whole form
                     viewer.Dock = DockStyle.Fill;
                     // Create the 3D control that will hold the 3D object.
                     Medical3DControl control3D = new Medical3DControl();
                     control3D.AddAction(MedicalViewerActionType.WindowLevel);
                     control3D.SetAction(MedicalViewerActionType.WindowLevel, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active);
                     Medical3DObject object3D = new Medical3DObject();
                     // Add the newly created 3D object to the control.
                     control3D.ObjectsContainer.Objects.Add(object3D);
                     object3D.Image = _codecs.Load(@"C:\Users\Public\Documents\LEADTOOLS Images\image1.dcm");
                     // Add the cell above to the MedicalViewer.
                     viewer.Cells.Add(control3D);
                     Controls.Add(viewer);
                     
                     // Create a new cell that will hold the axial frame.
                     MedicalViewerMPRCell axialCell = new MedicalViewerMPRCell();
                     // adjust some properties to view the cross hair.
                     axialCell.ShowMPRCrossHair = false;
                     axialCell.DistinguishMPRByColor = true;
                     
                     // Assign this cell (axialCell) to the AxialFrame property of the Medical 3D control
                     control3D.AxialFrame = axialCell;
                     
                     // add the axial cell to the viewer
                     viewer.Cells.Add(axialCell);
                     
                     // Create a new cell that will hold the coronal frame.
                     MedicalViewerMPRCell coronalCell = new MedicalViewerMPRCell();
                     
                     // adjust some properties to view the cross hair.
                     coronalCell.ShowMPRCrossHair = false;
                     coronalCell.DistinguishMPRByColor = true;
                     
                     // Assign this cell (coronalCell) to the CoronalFrame property of the Medical 3D control
                     control3D.CoronalFrame = coronalCell;
                     
                     viewer.Cells.Add(coronalCell);
                     
                     // Create a new cell that will hold the sagittal frame.
                     MedicalViewerMPRCell sagittalCell = new MedicalViewerMPRCell();
                     
                     // adjust some properties to view the cross hair.
                     sagittalCell.ShowMPRCrossHair = false;
                     sagittalCell.DistinguishMPRByColor = true;
                     
                     // Assign this cell (sagittalCell) to the SagittalFrame property of the Medical 3D control
                     control3D.SagittalFrame = sagittalCell;
                     
                     viewer.Cells.Add(sagittalCell);
                     
                     // Add the viewer as a child to the form.
                     this.Controls.Add(viewer);
                     
                     control3D.ObjectsContainer.Objects[0].Slab.Enabled = true;
                }
                
    
  6. Run the program and you should see four windows: One for the 3D object and the other three for the orthogonal frames. There should be a green dotted line surrounding the three orthogonal plane cells. Resize the rectangle by clicking-and- dragging the green border.

    Note: To view higher quality images, we provide DICOMDIR sample files which can be downloaded from here. For more information on building 3D objects from a DICOMDIR, please see Loading a DICOMDIR To Create a 3D Object.

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.