Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Medical image visualization using WPF

, 27 Sep 2012
The article demonstrates the visualization of medical images (DICOM) using WPF.
using System.Collections.Generic;
using System.Linq;

namespace DICOMViewer.Parsing
{
    // The repository holds a list of all IOD's (one entry for each physical DICOM file).
    // The repository provides helper methods in order to build up the IOD model.
    public class IODRepository
    {
        IList<IOD> myIODRepository;

        public IODRepository()
        {
            myIODRepository = new List<IOD>();
        }

        public void Add(IOD theIODInfo)
        {
            myIODRepository.Add(theIODInfo);
        }

        public List<string> GetPatients()
        {
            var aPatientQuery = (from IODElement in myIODRepository
                                 orderby IODElement.PatientName ascending
                                 select IODElement.PatientName).Distinct();

            return aPatientQuery.ToList();
        }

        public List<string> GetSOPClassNames(string thePatientName)
        {
            var aSOPClassQuery = (from IODElement in myIODRepository
                                  where IODElement.PatientName.Equals(thePatientName)
                                  orderby IODElement.SOPClassName ascending
                                  select IODElement.SOPClassName).Distinct();

            return aSOPClassQuery.ToList();
        }

        public List<string> GetStudies(string thePatientName, string theSOPClassName)
        {
            var aStudyQuery = (from IODElement in myIODRepository
                               where IODElement.PatientName.Equals(thePatientName)
                               where IODElement.SOPClassName.Equals(theSOPClassName)
                               orderby IODElement.StudyInstanceUID ascending
                               select IODElement.StudyInstanceUID).Distinct();

            return aStudyQuery.ToList();
        }

        public List<string> GetSeries(string thePatientName, string theSOPClassName, string theStudyInstanceUID)
        {
            var aSeriesQuery = (from IODElement in myIODRepository
                                where IODElement.PatientName.Equals(thePatientName)
                                where IODElement.SOPClassName.Equals(theSOPClassName)
                                where IODElement.StudyInstanceUID.Equals(theStudyInstanceUID)
                                orderby IODElement.SeriesInstanceUID ascending
                                select IODElement.SeriesInstanceUID).Distinct();

            return aSeriesQuery.ToList();
        }

        public List<IOD> GetIODs(string thePatientName, string theSOPClassName, string theStudyInstanceUID, string theSeriesInstanceUID)
        {
            var aIODQuery = from IODElement in myIODRepository
                            where IODElement.PatientName.Equals(thePatientName)
                            where IODElement.SOPClassName.Equals(theSOPClassName)
                            where IODElement.StudyInstanceUID.Equals(theStudyInstanceUID)
                            where IODElement.SeriesInstanceUID.Equals(theSeriesInstanceUID)
                            orderby IODElement.SortOrder ascending
                            select IODElement;

            return aIODQuery.ToList();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Bernhard Kügle
Software Developer (Senior) Siemens Healthcare
Germany Germany
Currently working as a Requirement Engineer for Siemens Healthcare in Germany.

| Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 27 Sep 2012
Article Copyright 2012 by Bernhard Kügle
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid