Leadtools.Dicom.Common
LEAD Technologies, Inc

GetNewViewPerspective(DicomDataSet,RasterViewPerspective,OrientationConfiguration) Method

Example 





The Leadtools.Dicom.DicomDataSet that contains the image orientation vectors
The input Leadtools.RasterViewPerspective to which the Leadtools.Dicom.Common.DataTypes.PlaneOrientation will be applied.
An Leadtools.Dicom.Common.DataTypes.OrientationConfiguration that will be applied to the current view perspective.
Gets a new Leadtools.RasterViewPerspective that results from applying a Leadtools.Dicom.Common.DataTypes.OrientationConfiguration to a given Leadtools.RasterViewPerspective.
Syntax
'Declaration
 
<ExtensionAttribute()>
Public Overloads Shared Function GetNewViewPerspective( _
   ByVal ds As DicomDataSet, _
   ByVal currentViewPerspective As RasterViewPerspective, _
   ByVal orientation As OrientationConfiguration _
) As RasterViewPerspective
'Usage
 
Dim ds As DicomDataSet
Dim currentViewPerspective As RasterViewPerspective
Dim orientation As OrientationConfiguration
Dim value As RasterViewPerspective
 
value = DicomExtensions.GetNewViewPerspective(ds, currentViewPerspective, orientation)
ExtensionAttribute()
 function Leadtools.Dicom.Common.Extensions.DicomExtensions.GetNewViewPerspective(DicomDataSet,RasterViewPerspective,OrientationConfiguration)( 
   ds ,
   currentViewPerspective ,
   orientation 
)

Parameters

ds
The Leadtools.Dicom.DicomDataSet that contains the image orientation vectors
currentViewPerspective
The input Leadtools.RasterViewPerspective to which the Leadtools.Dicom.Common.DataTypes.PlaneOrientation will be applied.
orientation
An Leadtools.Dicom.Common.DataTypes.OrientationConfiguration that will be applied to the current view perspective.
Remarks

This overload gets the image orientation vectors from the ds.

The input view perspective is defined by two values: the original Leadtools.RasterViewPerspective, and a row and column orientation vector (which are read from the ds by searching for the Leadtools.Dicom.DicomElement that has a tag of Leadtools.Dicom.DicomTag.ImageOrientationPatient which contains the orientation vectors.). This method returns the new Leadtools.RasterViewPerspective that results from applying a Leadtools.Dicom.Common.DataTypes.OrientationConfiguration to the input view perspective. 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.
Example
Copy CodeCopy Code  
Public Sub GetNewViewPerspectiveExample2()
      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 flip
      Dim poCoronal As New PlaneOrientation()
      poCoronal.Name = "Coronal or Frontal"
      poCoronal.Top = OrientationAxis.Inferior
      poCoronal.Right = OrientationAxis.Right
      poCoronal.Condition = New TagValueOrientationCondition(DicomTag.ImageOrientationPatient, Nothing)
      If (Not poCoronal.IsValid(Plane.Coronal)) Then
         MessageBox.Show("Invalid PlaneOrientation for Coronal")
         Return
      End If

      ' Create a new sagittal PlaneOrientation that corresponds to a Rotate90
      Dim poSaggital As New PlaneOrientation()
      poSaggital.Name = "Saggital"
      poSaggital.Top = OrientationAxis.Anterior
      poSaggital.Right = OrientationAxis.Inferior
      poSaggital.Condition = New TagValueOrientationCondition(0, Nothing)
      If (Not poSaggital.IsValid(Plane.Sagittal)) Then
         MessageBox.Show("Invalid PlaneOrientation for Sagittal")
         Return
      End If

      ' Create a new Axial that corresponds to a Rotate180
      Dim poAxial As New PlaneOrientation()
      poAxial.Name = "Axial"
      poAxial.Top = OrientationAxis.Posterior
      poAxial.Right = OrientationAxis.Left
      poAxial.Condition = New TagValueOrientationCondition(0, Nothing)
      If (Not poAxial.IsValid(Plane.Axial)) Then
         MessageBox.Show("Invalid PlaneOrientation for Axial")
         Return
      End If

      ' Setup the OrientationConfiguration
      Dim oc As New OrientationConfiguration()
      oc.Coronal.Add(poCoronal)
      oc.Sagittal.Add(poSaggital)
      oc.Axial.Add(poAxial)
      If (Not oc.IsValid()) Then
         MessageBox.Show("Invalid OrientationConfiguration")
         Return
      End If

      ' Find the new view perspective
      Dim newViewPerspective As RasterViewPerspective = ds.GetNewViewPerspective(RasterViewPerspective.TopLeft, oc)

      ' New view perspective should be BottomLeft
      MessageBox.Show("newViewPerspective should be BottomLeft" & Constants.vbLf & "Actual newViewPerspective is " & newViewPerspective.ToString())
   End Sub

Public NotInheritable Class LEAD_VARS
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
public void GetNewViewPerspectiveExample2()
   {
      DicomEngine.Startup();
      string dicomFileCoronal = Path.Combine(LEAD_VARS.ImagesDir,"image1.dcm");
      DicomDataSet ds = new DicomDataSet();
      ds.Load(dicomFileCoronal, DicomDataSetLoadFlags.None);

      // Create a new coronal PlaneOrientation that corresponds to a horizontal flip
      PlaneOrientation 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))
      {
         MessageBox.Show("Invalid PlaneOrientation for Coronal");
         return;
      }

      // Create a new sagittal PlaneOrientation that corresponds to a Rotate90
      PlaneOrientation poSaggital = new PlaneOrientation();
      poSaggital.Name = "Saggital";
      poSaggital.Top = OrientationAxis.Anterior;
      poSaggital.Right = OrientationAxis.Inferior;
      poSaggital.Condition = new TagValueOrientationCondition(0, null);
      if (!poSaggital.IsValid(Plane.Sagittal))
      {
         MessageBox.Show("Invalid PlaneOrientation for Sagittal");
         return;
      }

      // Create a new Axial that corresponds to a Rotate180
      PlaneOrientation 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))
      {
         MessageBox.Show("Invalid PlaneOrientation for Axial");
         return;
      }

      // Setup the OrientationConfiguration
      OrientationConfiguration oc = new OrientationConfiguration();
      oc.Coronal.Add(poCoronal);
      oc.Sagittal.Add(poSaggital);
      oc.Axial.Add(poAxial);
      if (!oc.IsValid())
      {
         MessageBox.Show("Invalid OrientationConfiguration");
         return;
      }

      // Find the new view perspective
      RasterViewPerspective newViewPerspective = ds.GetNewViewPerspective(RasterViewPerspective.TopLeft, oc);

      // New view perspective should be BottomLeft
      MessageBox.Show("newViewPerspective should be BottomLeft\nActual newViewPerspective is " + newViewPerspective.ToString());

      DicomEngine.Shutdown();
   }

static class LEAD_VARS
{
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

DicomExtensions Class
DicomExtensions Members
Overload List

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.Dicom.Common requires a Document or Medical toolkit license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features