public DicomDirKeyType DicomKey { get; }
public:
property DicomDirKeyType DicomKey {
DicomDirKeyType get();
}
The DICOM key.
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;
[DicomKey(DicomDirKeyType.Patient)]
public class PatientEntity
{
[Element(DicomTag.PatientID)]
public string Id
{
get;
set;
}
[Element(DicomTag.PatientName)]
public string Name
{
get;
set;
}
}
[DicomKey(DicomDirKeyType.Study)]
public class StudyEntity
{
[Element(DicomTag.PatientID)]
[DicomKey(DicomDirKeyType.Patient)]
public string PatientId
{
get;
set;
}
[Element(DicomTag.StudyDate)]
public DateTime? Date
{
get;
set;
}
[Element(DicomTag.StudyTime)]
public DateTime? Time
{
get;
set;
}
[Element(DicomTag.StudyDescription)]
public string Description
{
get;
set;
}
[Element(DicomTag.StudyInstanceUID)]
public string InstanceUID
{
get;
set;
}
[Element(DicomTag.StudyID)]
public string Id
{
get;
set;
}
[Element(DicomTag.AccessionNumber)]
public string AccessionNumber
{
get;
set;
}
}
public void TestDicomLinq()
{
DicomEngine.Startup();
using (DicomDataSet ds = new DicomDataSet())
{
ds.Load(_DicomDirFile, DicomDataSetLoadFlags.None);
FindPatients(ds);
FindStudies(ds);
FindPatientStudy(ds);
}
DicomEngine.Shutdown();
}
private void FindPatients(DicomDataSet ds)
{
var patients = from patient in ds.DirectoryRecord<PatientEntity>()
select new { Name = patient.Name, Id = patient.Id };
foreach (var patient in patients)
{
Console.WriteLine("Id: " + patient.Id);
Console.WriteLine("Name: " + patient.Name);
}
}
private void FindStudies(DicomDataSet ds)
{
var studies = from study in ds.DirectoryRecord<StudyEntity>()
select study;
foreach (var study in studies)
{
Console.WriteLine("Patient Id: " + study.PatientId);
Console.WriteLine("Accession #: " + study.AccessionNumber);
Console.WriteLine("Study Id: " + study.Id);
}
}
private void FindPatientStudy(DicomDataSet ds)
{
var query = from patient in ds.DirectoryRecord<PatientEntity>()
select new
{
patient,
Studies = from study in ds.DirectoryRecord<StudyEntity>()
where study.PatientId == patient.Id
select study
};
foreach (var item in query)
{
Console.WriteLine("Patient: " + item.patient.Id);
foreach (StudyEntity study in item.Studies)
{
Console.WriteLine(" Instance UID: " + study.InstanceUID);
}
}
}
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
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.