Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.4.5
|
This tutorial teaches you how to create a 3D object.
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.MedicalViewer
Imports Leadtools.Medical3D
Imports Leadtools.Dicom
Imports Leadtools.Annotations.Core
[C#]
using Leadtools;
using Leadtools.Codecs;
using Leadtools.MedicalViewer;
using Leadtools.Medical3D;
using Leadtools.Dicom;
using Leadtools.Annotations.Core
Private Sub InitClass()
' Unlock LEADTOOLS features
Dim MY_LICENSE_FILE As String = "d:\temp\TestLic.lic"
Dim MY_DicomDEVELOPER_KEY As String = "xyz123abc"
RasterSupport.SetLicense(MY_LICENSE_FILE, MY_DicomDEVELOPER_KEY)
' Create a new instance of the Codecs class, which will be used to load the images.
Dim _codecs As RasterCodecs = New RasterCodecs()
' Load all frames from file
_codecs.Options.Load.AllPages = True
' 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\Public Documents\LEADTOOLS Images\image1.dcm");
' Add the cell above to the MedicalViewer.
viewer.Cells.Add(control3D)
Controls.Add(viewer)
End Sub
[C#]
void InitClass()
{
// Unlock LEADTOOLS features
string MY_LICENSE_FILE = "d:\\temp\\TestLic.lic";
string MY_DicomDEVELOPER_KEY = "xyz123abc";
RasterSupport.SetLicense(MY_LICENSE_FILE, MY_DicomDEVELOPER_KEY);
// Create a new instance of the Codecs class, which will be used to load the images.
RasterCodecs _codecs = new RasterCodecs();
// Load all frames from file
_codecs.Options.Load.AllPages = true;
// 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\\Public Documents\\LEADTOOLS Images\\image1.dcm");
// Add the cell above to the MedicalViewer.
viewer.Cells.Add(control3D);
Controls.Add(viewer);
}
Note: You may need to change the above path to point to "image1.dcm" located in the LEADTOOLS images directory.
Note: For more information on how to acquire the above unlock keys, please contact LEAD Technologies support.
Note: Now you will need to have DICOMDIR files for the next step. You can download a sample from our site. Download the file from here (Download chest_ct_compressed_subset_for_3d_tutorial.zip), and extract the file to "C:\Leadtools_DICOMDIR". For more information on building 3D objects from a DICOMDIR, please see Loading a DICOMDIR To Create a 3D Object.
Note: If you encounter an "Invalid File Format" or "Feature Not Supported" exception, please refer to the topic Invalid File Format/Feature Not Supported.