Ejemplo n.º 1
0
        /// <summary>
        ///     Finds all DICOM elements that are embedded in the DICOM structure in some particular location. This location
        ///     is defined by descending tags from the outer most elements to the element. It is not necessary to include every
        ///     tag in the descending "treelike" structure. Branches can be skipped.
        /// </summary>
        /// <param name="descendingTags">
        ///     a string array containing in order the tags from the outer most elements to the element
        ///     being searched for
        /// </param>
        /// <returns>a list of all elements that meet the search criteria</returns>
        public List <IDICOMElement> FindAll(string[] descendingTags)
        {
            var matches = new List <IDICOMElement>();

            if (descendingTags.Length > 1)
            {
                var newDescTags = ArrayHelper.Pop(descendingTags);
                var sequences   =
                    AllElements.Where(e => e.IsVR(VR.Sequence))
                    .Where(el => el.Tag.CompleteID == descendingTags[0])
                    .ToList();
                foreach (var seq in sequences)
                {
                    var s = seq as Sequence;
                    foreach (var d in s.Items)
                    {
                        foreach (var el in d.FindAll(newDescTags))
                        {
                            matches.Add(el);
                        }
                    }
                }
            }
            else
            {
                matches = AllElements.Where(el => el.Tag.CompleteID == descendingTags[0]).ToList();
            }

            return(matches);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Finds all DICOM elements that match an element type
        /// </summary>
        /// <typeparam name="T">the DICOM element class that is being filtered and returned</typeparam>
        /// <returns>a list of all elements that are strongly typed</returns>
        public List <T> FindAll <T>()
        {
            var t = typeof(T);

            return
                (AllElements.Where(el => el is T)
                 .Select(el => (T)Convert.ChangeType(el, t, CultureInfo.CurrentCulture))
                 .ToList());
        }
Ejemplo n.º 3
0
 /// <summary>
 ///     Finds all DICOM elements that match a certain tag
 /// </summary>
 /// <param name="tag">the tag to find</param>
 /// <returns>a list of all elements that meet the search criteria</returns>
 public List <IDICOMElement> FindAll(string tag)
 {
     return(AllElements.Where(el => el.Tag.CompleteID == tag).ToList());
 }
Ejemplo n.º 4
0
 /// <summary>
 ///     Finds all DICOM elements that match a VR type
 /// </summary>
 /// <param name="vrToFind">the VR type to find</param>
 /// <returns>a list of all elements that meet the search criteria</returns>
 public List <IDICOMElement> FindAll(VR vrToFind)
 {
     return(AllElements.Where(el => el.IsVR(vrToFind)).ToList());
 }
Ejemplo n.º 5
0
 public virtual IEnumerable <Type> GetConfiguredServiceTypes()
 {
     return(new HashSet <Type>(AllElements.Where(c => c.PreventDefault).Select(c => Type.GetType(c.Service)).Where(t => t != null)));
 }