コード例 #1
0
        /// <summary>
        /// Build a list of matching SOPs.
        /// </summary>
        /// <param name="sops"></param>
        /// <returns></returns>
        public static List <SopClass> FindMatchingSOPS(Configuration.SOPClassSet sops)
        {
            var result = new List <SopClass>();

            sops.Rules.ForEach(
                r =>
            {
                if (r.Uid == "*")
                {
                    AllSopClasses.ForEach(ms =>
                    {
                        // Add all rules
                        result.Add(ms);
                    });
                }
                else if (r.Uid.Contains("*"))
                {
                    AllSopClasses
                    .FindAll(sc => sc.Uid.StartsWith(r.Uid.TrimEnd('*')))
                    .ForEach(ms =>
                    {
                        // Add all rules
                        result.Add(ms);
                    });
                }
                else
                {
                    var sop = SopClass.GetSopClass(r.Uid);
                    if (sop != null)
                    {
                        // Add all rules
                        result.Add(sop);
                    }
                    else
                    {
                        log.Error(string.Format("SOP class {0} is not defined!", sop));
                    }
                }
            });

            return(result);
        }
コード例 #2
0
        public static void AddPresentationContexts(ServerAssociationParameters assoc, Configuration.SOPClassSet sops)
        {
            byte pcid = assoc.AddPresentationContext(SopClass.VerificationSopClass);

            assoc.AddTransferSyntax(pcid, TransferSyntax.ExplicitVrLittleEndian);
            assoc.AddTransferSyntax(pcid, TransferSyntax.ImplicitVrLittleEndian);

            FindMatchingSOPS(sops).ForEach(
                s => {
                pcid = assoc.AddPresentationContext(s);
                SetImageTransferSyntaxes(pcid, assoc);
                log.Info(string.Format("Allow SOP class {0}", s.Name));
            }
                );
        }