public static RasterImage GetImage(this DicomDataSet ds,DicomElement element,int index,int bitsPerPixel,RasterByteOrder order,DicomGetImageFlags flags,OrientationConfiguration orientation)
<ExtensionAttribute()>Public Shared Function GetImage( _ByVal ds As DicomDataSet, _ByVal element As DicomElement, _ByVal index As Integer, _ByVal bitsPerPixel As Integer, _ByVal order As RasterByteOrder, _ByVal flags As DicomGetImageFlags, _ByVal orientation As OrientationConfiguration _) As RasterImage
[ExtensionAttribute()]public:static RasterImage^ GetImage(DicomDataSet^ ds,DicomElement^ element,int index,int bitsPerPixel,RasterByteOrder order,DicomGetImageFlags flags,OrientationConfiguration^ orientation)
ds
The DicomDataSet that contains the image orientation vectors
element
An item in the Data Set.
index
The zero-based index of the frame to load.
bitsPerPixel
Value that represents the resulting image pixel depth. Possible values are:
| Value | Meaning |
|---|---|
| 0 | Keep the original file's pixel depth (do not convert). |
| 1 to 8 | The specified bits per pixel in the resulting image. |
| 12 | 12 bits per pixel in the resulting image. |
| 16 | 16 bits per pixel in the resulting image. |
| 24 | 24 bits per pixel in the resulting image. |
| 32 | 32 bits per pixel in the resulting image. |
order
This value is ignored.
flags
Flags that control the behavior of this method.
orientation
An OrientationConfiguration that will be applied to the current view perspective.
The image of a Pixel Data element.
This method will load any image from ds, using element as the parent element to begin the search, where the element searched for is the PixelData element. The resulting image has its RasterViewPerspective changed accordingly from applying a PlaneOrientation to a given RasterViewPerspective.
The input view perspective is define by two values: the original RasterViewPerspective contained in ds, and a row and column orientation vector (which are read from the ds by searching for the DicomElement that has a tag of ImageOrientationPatient which contains the orientation vectors.).
Note that the orientation contains three lists of conditions (one for each 3D axis) that can be applied to the image contained in the ds if the condition is met.
This example does the following:
using Leadtools.Dicom;using Leadtools.Dicom.Common;using Leadtools.Dicom.Common.Extensions;using Leadtools;using Leadtools.Dicom.Common.Linq.BasicDirectory;using Leadtools.Dicom.Common.DataTypes;public void GetImageExample(){DicomEngine.Startup();string dicomFileCoronal = Path.Combine(LEAD_VARS.ImagesDir, "DICOM", "Image3.dcm");DicomDataSet ds = new DicomDataSet();ds.Load(dicomFileCoronal, DicomDataSetLoadFlags.None);// Create a new coronal PlaneOrientation that corresponds to a horizontal flipPlaneOrientation poCoronal = new PlaneOrientation();poCoronal.Name = "Coronal or Frontal";poCoronal.Top = OrientationAxis.Inferior;poCoronal.Right = OrientationAxis.Right;poCoronal.Condition = new TagValueOrientationCondition(DicomTag.ImageOrientationPatient, null);if (!poCoronal.IsValid(Plane.Coronal)){Console.WriteLine("Invalid PlaneOrientation for Coronal");return;}// Create a new sagittal PlaneOrientation that corresponds to a Rotate90PlaneOrientation poSagittal = new PlaneOrientation();poSagittal.Name = "Sagittal";poSagittal.Top = OrientationAxis.Anterior;poSagittal.Right = OrientationAxis.Inferior;poSagittal.Condition = new TagValueOrientationCondition(0, null);if (!poSagittal.IsValid(Plane.Sagittal)){Console.WriteLine("Invalid PlaneOrientation for Sagittal");return;}// Create a new Axial that corresponds to a Rotate180PlaneOrientation poAxial = new PlaneOrientation();poAxial.Name = "Axial";poAxial.Top = OrientationAxis.Posterior;poAxial.Right = OrientationAxis.Left;poAxial.Condition = new TagValueOrientationCondition(0, null);if (!poAxial.IsValid(Plane.Axial)){Console.WriteLine("Invalid PlaneOrientation for Axial");return;}// Setup the OrientationConfigurationOrientationConfiguration oc = new OrientationConfiguration();oc.Coronal.Add(poCoronal);oc.Sagittal.Add(poSagittal);oc.Axial.Add(poAxial);if (!oc.IsValid()){Console.WriteLine("Invalid OrientationConfiguration");return;}// Find the image from the dataset with the new view perspective// RasterViewPerspective newViewPerspective = ds.GetNewViewPerspective(RasterViewPerspective.TopLeft, oc);RasterImage image = ds.GetImage(null, 0, 0, RasterByteOrder.Gray, DicomGetImageFlags.None, oc);// New view perspective should be BottomLeftRasterViewPerspective newViewPerspective = image.ViewPerspective;Console.WriteLine("newViewPerspective should be BottomLeft\nActual newViewPerspective is " + newViewPerspective.ToString());DicomEngine.Shutdown();}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images";}
Imports Leadtools.DicomImports Leadtools.Dicom.CommonImports Leadtools.Dicom.Common.ExtensionsImports Leadtools.Dicom.Common.LinqImports Leadtools.Dicom.Common.Linq.BasicDirectoryImports LeadtoolsImports Leadtools.Dicom.Common.DataTypesPublic Sub GetImageExample()Dim dicomFileCoronal As String = Path.Combine(LEAD_VARS.ImagesDir, "image3.dcm")Dim ds As New DicomDataSet()ds.Load(dicomFileCoronal, DicomDataSetLoadFlags.None)' Create a new coronal PlaneOrientation that corresponds to a horizontal flipDim poCoronal As New PlaneOrientation()poCoronal.Name = "Coronal or Frontal"poCoronal.Top = OrientationAxis.InferiorpoCoronal.Right = OrientationAxis.RightpoCoronal.Condition = New TagValueOrientationCondition(DicomTag.ImageOrientationPatient, Nothing)If (Not poCoronal.IsValid(Plane.Coronal)) ThenMessageBox.Show("Invalid PlaneOrientation for Coronal")ReturnEnd If' Create a new sagittal PlaneOrientation that corresponds to a Rotate90Dim poSagittal As New PlaneOrientation()poSagittal.Name = "Sagittal"poSagittal.Top = OrientationAxis.AnteriorpoSagittal.Right = OrientationAxis.InferiorpoSagittal.Condition = New TagValueOrientationCondition(0, Nothing)If (Not poSagittal.IsValid(Plane.Sagittal)) ThenMessageBox.Show("Invalid PlaneOrientation for Sagittal")ReturnEnd If' Create a new Axial that corresponds to a Rotate180Dim poAxial As New PlaneOrientation()poAxial.Name = "Axial"poAxial.Top = OrientationAxis.PosteriorpoAxial.Right = OrientationAxis.LeftpoAxial.Condition = New TagValueOrientationCondition(0, Nothing)If (Not poAxial.IsValid(Plane.Axial)) ThenMessageBox.Show("Invalid PlaneOrientation for Axial")ReturnEnd If' Set up the OrientationConfigurationDim oc As New OrientationConfiguration()oc.Coronal.Add(poCoronal)oc.Sagittal.Add(poSagittal)oc.Axial.Add(poAxial)If (Not oc.IsValid()) ThenMessageBox.Show("Invalid OrientationConfiguration")ReturnEnd If' Find the image from the dataset with the new view perspective' RasterViewPerspective newViewPerspective = ds.GetNewViewPerspective(RasterViewPerspective.TopLeft, oc);Dim image As RasterImage = ds.GetImage(Nothing, 0, 0, RasterByteOrder.Gray, DicomGetImageFlags.None, oc)' New view perspective should be BottomLeftDim newViewPerspective As RasterViewPerspective = image.ViewPerspectiveMessageBox.Show("newViewPerspective should be BottomLeft" & Constants.vbLf & "Actual newViewPerspective is " & newViewPerspective.ToString())End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images"End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
