This tutorial teaches you how to create a 3D object, which then can be converted to a mesh and saved.
' Change the volume type of the rendered object to SSD control3D.ObjectsContainer.VolumeType = Medical3DVolumeType.SSD[C#]
// Change the volume type of the rendered object to SSD control3D.ObjectsContainer.VolumeType = Medical3DVolumeType.SSD;
this.Show() this.Update()[C#]
this.Show(); this.Update();
// Save the mesh under the name TestMesh. control3D.ObjectsContainer.Objects[0].SSD.SaveMesh("C:\TestMesh.x")[C#]
// Save the mesh to a file control3D.ObjectsContainer.Objects[0].SSD.SaveMesh(@"C:\TestMesh.x");Note: If you open C:\ through Windows Explorer, you will notice the mesh was saved as “TestMesh.x”.
Private Sub InitClass() RasterSupport.SetLicense(RasterSupportType.Dicom, " Your Dicom Key") RasterSupport.SetLicense(RasterSupportType.Medical, "Your Medical Key") RasterSupport.SetLicense(RasterSupportType.Medical3d, "Your Medical 3D 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) Me.Show() Me.Update() ' Change the volume type of the rendered object to SSD control3D.ObjectsContainer.VolumeType = Medical3DVolumeType.SSD ' Save the mesh to a file control3D.ObjectsContainer.Objects(0).SSD.SaveMesh("C:\TestMesh.x") End Sub[C#]
void InitClass() { RasterSupport.SetLicense(RasterSupportType.Dicom, " Your Dicom Key"); RasterSupport.SetLicense(RasterSupportType.Medical, "Your Medical Key"); RasterSupport.SetLicense(RasterSupportType.Medical3d, "Your Medical 3D 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); this.Show(); this.Update(); // Change the volume type of the rendered object to SSD control3D.ObjectsContainer.VolumeType = Medical3DVolumeType.SSD; // Save the mesh to a file control3D.ObjectsContainer.Objects[0].SSD.SaveMesh(@"C:\TestMesh.x"); }
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.