Gets a new
Leadtools.RasterViewPerspective that results from applying a
OrientationConfiguration to a given
Leadtools.RasterViewPerspective.
Syntax
Example
This example does the following:
- Loads a DICOM dataset that contains orientation vectors that orient it as a coronal slice
- Creates an OrientationConfiguration that contains a coronal PlaneOrientation that corresponds to a horizontal flip
- Applies the above to a view perspective, and returns the resulting view perspective
Visual Basic | Copy Code |
---|
Public Sub GetNewViewPerspectiveExample2()
Dim dicomFileCoronal As String = LeadtoolsExamples.Common.ImagesPath.Path & "coronal.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 |
C# | Copy Code |
---|
public void GetNewViewPerspectiveExample2()
{
string dicomFileCoronal = LeadtoolsExamples.Common.ImagesPath.Path + "coronal.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());
} |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7
See Also