Leadtools.Dicom.Common.Linq.BasicDirectory Namespace > LinqExtensions Class : DirectoryRecord<T> Method |
[ExtensionAttribute()] public static Queryable<T> DirectoryRecord<T>( DicomDataSet dataset )
'Declaration <ExtensionAttribute()> Public Shared Function DirectoryRecord(Of T)( _ ByVal dataset As DicomDataSet _ ) As Queryable(Of T)
'Usage Dim dataset As DicomDataSet Dim value As Queryable(Of T) value = LinqExtensions.DirectoryRecord(Of T)(dataset)
[ExtensionAttribute()] public: static Queryable<T^>^ DirectoryRecordgeneric<typename T> ( DicomDataSet^ dataset )
The following operations are provided by the DICOMDIR LINQ Provider.
Imports Leadtools.Dicom Imports Leadtools.Dicom.Common Imports Leadtools.Dicom.Common.Extensions Imports Leadtools.Dicom.Common.Linq Imports Leadtools.Dicom.Common.Linq.BasicDirectory Imports Leadtools Imports Leadtools.Dicom.Common.DataTypes <DicomKey(DicomDirKeyType.Patient)> _ Public Class PatientEntity <Element(DicomTag.PatientID)> _ Public Property Id() As String Get Return m_Id End Get Set(ByVal value As String) m_Id = value End Set End Property Private m_Id As String <Element(DicomTag.PatientName)> _ Public Property Name() As String Get Return m_Name End Get Set(ByVal value As String) m_Name = value End Set End Property Private m_Name As String End Class <DicomKey(DicomDirKeyType.Study)> _ Public Class StudyEntity <Element(DicomTag.PatientID)> _ <DicomKey(DicomDirKeyType.Patient)> _ Public Property PatientId() As String Get Return m_PatientId End Get Set(ByVal value As String) m_PatientId = value End Set End Property Private m_PatientId As String <Element(DicomTag.StudyDate)> _ Public Property [Date]() As System.Nullable(Of DateTime) Get Return m_Date End Get Set(ByVal value As System.Nullable(Of DateTime)) m_Date = value End Set End Property Private m_Date As System.Nullable(Of DateTime) <Element(DicomTag.StudyTime)> _ Public Property Time() As System.Nullable(Of DateTime) Get Return m_Time End Get Set(ByVal value As System.Nullable(Of DateTime)) m_Time = value End Set End Property Private m_Time As System.Nullable(Of DateTime) <Element(DicomTag.StudyDescription)> _ Public Property Description() As String Get Return m_Description End Get Set(ByVal value As String) m_Description = value End Set End Property Private m_Description As String <Element(DicomTag.StudyInstanceUID)> _ Public Property InstanceUID() As String Get Return m_InstanceUID End Get Set(ByVal value As String) m_InstanceUID = value End Set End Property Private m_InstanceUID As String <Element(DicomTag.StudyID)> _ Public Property Id() As String Get Return m_Id End Get Set(ByVal value As String) m_Id = value End Set End Property Private m_Id As String <Element(DicomTag.AccessionNumber)> _ Public Property AccessionNumber() As String Get Return m_AccessionNumber End Get Set(ByVal value As String) m_AccessionNumber = value End Set End Property Private m_AccessionNumber As String End Class Public Sub TestDicomLinq() DicomEngine.Startup() Using ds As New DicomDataSet() ds.Load(_DicomDirFile, DicomDataSetLoadFlags.None) FindPatients(ds) FindStudies(ds) FindPatientStudy(ds) End Using DicomEngine.Shutdown() End Sub Private Sub FindPatients(ByVal ds As DicomDataSet) Dim patients = From patient In ds.DirectoryRecord(Of PatientEntity)() _ Select Name = patient.Name, Id = patient.Id For Each patient In patients Console.WriteLine("Id: " & Convert.ToString(patient.Id)) Console.WriteLine("Name: " & Convert.ToString(patient.Name)) Next End Sub Private Sub FindStudies(ByVal ds As DicomDataSet) Dim studies = From study In ds.DirectoryRecord(Of StudyEntity)() _ Select study For Each study In studies Console.WriteLine("Patient Id: " & Convert.ToString(study.PatientId)) Console.WriteLine("Accession #: " & Convert.ToString(study.AccessionNumber)) Console.WriteLine("Study Id: " & Convert.ToString(study.Id)) Next End Sub Private Sub FindPatientStudy(ByVal ds As DicomDataSet) Dim query = From patient In ds.DirectoryRecord(Of PatientEntity)() _ Select _ patient, _ Studies = From study In ds.DirectoryRecord(Of StudyEntity)() Where study.PatientId = patient.Id _ Select study For Each item In query Console.WriteLine("Patient: " & Convert.ToString(item.patient.Id)) For Each study As StudyEntity In item.Studies Console.WriteLine(" Instance UID: " + study.InstanceUID) Next Next End Sub