コード例 #1
0
ファイル: VRFactory.cs プロジェクト: ZhangKe-Zoe/DICOMParser
        public VR GetVR(string key)
        {
            //如果对象存在,则直接从享元池获取
            if (VRs.ContainsKey(key))
            {
                return((VR)VRs[key]);
            }
            //如果对象不存在,先创建一个新的对象添加到享元池中,然后返回
            else
            {
                VR fw = null;
                switch (key)
                {
                case "SS": fw = new SS(syntax); break;

                case "US": fw = new US(syntax); break;

                case "SL": fw = new SL(syntax); break;

                case "UL": fw = new UL(syntax); break;

                case "FL": fw = new FL(syntax); break;

                case "FD": fw = new FD(syntax); break;

                case "DA": fw = new DA(syntax); break;

                case "TM": fw = new TM(syntax); break;

                case "DT": fw = new DT(syntax); break;

                case "OB": fw = new OB(syntax); break;

                case "OF": fw = new OF(syntax); break;

                case "OW": fw = new OW(syntax); break;

                case "SQ": fw = new SQ(syntax); break;

                case "UT": fw = new UT(syntax); break;

                case "UN": fw = new UN(syntax); break;

                //default for text
                default: fw = new ST(syntax); break;
                }
                VRs.Add(key, fw);
                return(fw);
            }
        }
コード例 #2
0
 public VR CreateVR(string key)
 {
     {
         VR vr = null;
         if (key == "UL")
         {
             vr = new UL(syntax);
         }
         else if (key == "US")
         {
             vr = new US(syntax);
         }
         else if (key == "AS")
         {
             vr = new AS(syntax);
         }
         else if (key == "DA")
         {
             vr = new DA(syntax);
         }
         else if (key == "DS")
         {
             vr = new DS(syntax);
         }
         else if (key == "FD")
         {
             vr = new FD(syntax);
         }
         else if (key == "DT")
         {
             vr = new DT(syntax);
         }
         else if (key == "SS")
         {
             vr = new SS(syntax);
         }
         else if (key == "FS")
         {
             vr = new FS(syntax);
         }
         else if (key == "OW")
         {
             vr = new OW(syntax);
         }
         else if (key == "UN")
         {
             vr = new UN(syntax);
         }
         else if (key == "UT")
         {
             vr = new UT(syntax);
         }
         else if (key == "SH")
         {
             vr = new SH(syntax);
         }
         else if (key == "ST")
         {
             vr = new ST(syntax);
         }
         else if (key == "LT")
         {
             vr = new LT(syntax);
         }
         else if (key == "AE")
         {
             vr = new AE(syntax);
         }
         else if (key == "CS")
         {
             vr = new CS(syntax);
         }
         else if (key == "IS")
         {
             vr = new IS(syntax);
         }
         else if (key == "SL")
         {
             vr = new SL(syntax);
         }
         else if (key == "SQ")
         {
             vr = new SQ(syntax);
         }
         else if (key == "TM")
         {
             vr = new TM(syntax);
         }
         else if (key == "UI")
         {
             vr = new UI(syntax);
         }
         else if (key == "LO")
         {
             vr = new LO(syntax);
         }
         else if (key == "TS")
         {
             vr = new TS(syntax);
         }
         else if (key == "PN")
         {
             vr = new PN(syntax);
         }
         else if (key == "OB")
         {
             vr = new OB(syntax);
         }
         else if (key == "OF")
         {
             vr = new OF(syntax);
         }
         else if (key == "FL")
         {
             vr = new FL(syntax);
         }
         return(vr);
     }
 }