Exemplo n.º 1
0
        public void DicomPersonName_FamilyAndSurname_YieldsCompositeName()
        {
            var element = new DicomPersonName(DicomTag.ConsultingPhysicianName, "Doe", "John");
            var actual  = element.Get <string>(0);

            Assert.Equal("Doe^John", actual);
        }
Exemplo n.º 2
0
        protected virtual void WriteVR_PN(fo.DicomElement element, XmlWriter writer)
        {
            for (int index = 0; index < element.Count; index++)
            {
                writer.WriteStartElement(Constants.PN_PERSON_NAME);
                WriteNumberAttrib(writer, index);

                var pnComponents = GetTrimmedString(element.Get <string> ( )).Split('=');

                for (int compIndex = 0; (compIndex < pnComponents.Length) && (compIndex < 3); compIndex++)
                {
                    writer.WriteStartElement(Utilities.PersonNameComponents.PN_Components[compIndex]);

                    fo.DicomPersonName pn = new fo.DicomPersonName(element.Tag, pnComponents[compIndex]);

                    writer.WriteElementString(Utilities.PersonNameParts.PN_Family, pn.Last);
                    writer.WriteElementString(Utilities.PersonNameParts.PN_Given, pn.First);
                    writer.WriteElementString(Utilities.PersonNameParts.PN_Midlle, pn.Middle);
                    writer.WriteElementString(Utilities.PersonNameParts.PN_Prefix, pn.Prefix);
                    writer.WriteElementString(Utilities.PersonNameParts.PN_Suffix, pn.Suffix);

                    writer.WriteEndElement( );
                }
                writer.WriteEndElement( );
            }
        }
Exemplo n.º 3
0
        public void DicomPersonName_TwoNames_YieldsTwoValues()
        {
            var element = new DicomPersonName(DicomTag.ConsultingPhysicianName, new [] { "Doe^John", "Bar^Foo" });
            var actual  = element.Get <string[]>();

            Assert.Equal(2, actual.Length);
            Assert.Equal("Bar^Foo", actual[1]);
        }
Exemplo n.º 4
0
 public void PrefixTest()
 {
     DicomPersonName target = new DicomPersonName(DicomTag.PatientName, "Last", "First", "Middle", "Prefix", "Suffix");
     Assert.Equal("Prefix", target.Prefix);
     target = new DicomPersonName(DicomTag.PatientName, "Last");
     Assert.Equal("", target.Prefix);
     target = new DicomPersonName(DicomTag.PatientName, "Last^First^Middle=Doe^John^Peter^MD^xx");
     Assert.Equal("", target.Prefix);
 }
Exemplo n.º 5
0
 public void FirstTest()
 {
     DicomPersonName target = new DicomPersonName(DicomTag.PatientName, "Last", "First", "Middle", "Prefix", "Suffix");
     Assert.Equal("First", target.First);
     target = new DicomPersonName(DicomTag.PatientName, "Last");
     Assert.Equal("", target.First);
     target = new DicomPersonName(DicomTag.PatientName, "Last=Doe^John");
     Assert.Equal("", target.First);
 }
Exemplo n.º 6
0
 public void DicomPersonNameConstructorTest1()
 {
     DicomPersonName target = new DicomPersonName(DicomTag.PatientName, DicomEncoding.GetEncoding("ISO IR 144"), "Тарковский", "Андрей", "Арсеньевич");
     byte[] b = target.Buffer.GetByteRange(0, (int)target.Buffer.Size);
     byte[] c = Encoding.GetEncoding("iso-8859-5").GetBytes("Тарковский^Андрей^Арсеньевич");
     Assert.Equal(c, b);
     // foloowing test checks also padding with space!
     target = new DicomPersonName(DicomTag.PatientName, DicomEncoding.GetEncoding("ISO IR 144"), "Тарковский", "Андрей");
     b = target.Buffer.GetByteRange(0, (int)target.Buffer.Size);
     c = Encoding.GetEncoding("iso-8859-5").GetBytes("Тарковский^Андрей ");
     Assert.Equal(c, b);
 }
Exemplo n.º 7
0
 public void DicomPersonNameConstructorTest()
 {
     DicomPersonName target = new DicomPersonName(DicomTag.PatientName, "Last", "First", "Middle", "Prefix", "Suffix");
     Assert.Equal("Last^First^Middle^Prefix^Suffix", target.Get<string>());
     target = new DicomPersonName(DicomTag.PatientName, "Last", "First", "Middle", "", "");
     Assert.Equal("Last^First^Middle", target.Get<string>());
     target = new DicomPersonName(DicomTag.PatientName, "Last", "First", null, "");
     Assert.Equal("Last^First", target.Get<string>());
     target = new DicomPersonName(DicomTag.PatientName, "Last", "First", "", null, "Suffix");
     Assert.Equal("Last^First^^^Suffix", target.Get<string>());
     target = new DicomPersonName(DicomTag.PatientName, "", "", "", null, null);
     Assert.Equal("", target.Get<string>());
 }