IsValid Method

Summary
Indicates if Top and Right are valid combinations for  plane.
Syntax
C#
C++/CLI
public bool IsValid( 
   Plane plane 
) 
public: 
bool IsValid(  
   Plane plane 
)  

Parameters

plane
The specified plane that is being verified as valid combination with Top and Right

Return Value

true if  plane is consistent with the combination of Top and Right

Example
C#
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; 
 
using Leadtools.Codecs; 
 
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 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)) 
   { 
      Console.WriteLine("Invalid PlaneOrientation for Coronal"); 
      return; 
   } 
 
   // Create a new sagittal PlaneOrientation that corresponds to a Rotate90 
   PlaneOrientation 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 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)) 
   { 
      Console.WriteLine("Invalid PlaneOrientation for Axial"); 
      return; 
   } 
 
   // Setup the OrientationConfiguration 
   OrientationConfiguration 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 BottomLeft 
   RasterViewPerspective 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:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2023.1.30
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom.Common Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.