public void TestSafePrivateGEMRRelated_CreatorFromList() throws Exception {
   {
     AttributeList list = new AttributeList();
     {
       Attribute a = new LongStringAttribute(new AttributeTag(0x0019, 0x0010));
       a.addValue("GEMS_ACQU_01");
       list.put(a);
     }
     assertTrue(
         "Internal Pulse Sequence Name is safe",
         ClinicalTrialsAttributes.isSafePrivateAttribute(new AttributeTag(0x0019, 0x109E), list));
   }
   {
     AttributeList list = new AttributeList();
     {
       Attribute a = new LongStringAttribute(new AttributeTag(0x0025, 0x0010));
       a.addValue("GEMS_SERS_01");
       list.put(a);
     }
     assertTrue(
         "Images In Series is safe",
         ClinicalTrialsAttributes.isSafePrivateAttribute(new AttributeTag(0x0025, 0x1007), list));
   }
   {
     AttributeList list = new AttributeList();
     {
       Attribute a = new LongStringAttribute(new AttributeTag(0x0043, 0x0010));
       a.addValue("GEMS_PARM_01");
       list.put(a);
     }
     assertTrue(
         "Scanner Table Entry + Gradient Coil Selected",
         ClinicalTrialsAttributes.isSafePrivateAttribute(new AttributeTag(0x0043, 0x106F), list));
   }
 }
 public void TestSafePrivateGEMRRelated_AddedToList() throws Exception {
   {
     String value = "MySequence";
     Attribute a = new LongStringAttribute(new AttributeTag(0x0019, 0x109E));
     a.addValue(value);
     testIsNotRemovedAndRetainsValue(
         "Internal Pulse Sequence Name",
         new AttributeTag(0x0019, 0x0010),
         "GEMS_ACQU_01",
         a,
         value);
   }
   {
     String value = "35";
     Attribute a = new SignedLongAttribute(new AttributeTag(0x0025, 0x1007));
     a.addValue(value);
     testIsNotRemovedAndRetainsValue(
         "Images In Series", new AttributeTag(0x0025, 0x0010), "GEMS_SERS_01", a, value);
   }
   {
     String expectValue = "0\\0\\0\\2";
     Attribute a = new DecimalStringAttribute(new AttributeTag(0x0043, 0x106F));
     a.addValue("0");
     a.addValue("0");
     a.addValue("0");
     a.addValue("2");
     testIsNotRemovedAndRetainsValue(
         "Scanner Table Entry + Gradient Coil Selected",
         new AttributeTag(0x0043, 0x0010),
         "GEMS_PARM_01",
         a,
         expectValue);
   }
 }
 private void testIsNotRemovedAndRetainsValue(
     String description,
     AttributeTag creatorTag,
     String creator,
     Attribute privateAttribute,
     String expectValue)
     throws DicomException {
   AttributeList list = new AttributeList();
   {
     Attribute a = new LongStringAttribute(creatorTag);
     a.addValue(creator);
     list.put(a);
   }
   list.put(privateAttribute);
   AttributeTag privateTag = privateAttribute.getTag();
   list.removeUnsafePrivateAttributes();
   assertTrue("Checking Creator is not removed", list.get(creatorTag) != null);
   assertEquals(
       "Checking Creator retains value",
       creator,
       Attribute.getDelimitedStringValuesOrEmptyString(list, creatorTag));
   assertTrue("Checking " + description + " is not removed", list.get(privateTag) != null);
   assertEquals(
       "Checking " + description + " retains value",
       expectValue,
       Attribute.getDelimitedStringValuesOrEmptyString(list, privateTag));
 }
 public void TestSafePrivateGEPACSRelated_AddedToList() throws Exception {
   AttributeList list = new AttributeList();
   {
     Attribute a = new LongStringAttribute(new AttributeTag(0x0903, 0x0010));
     a.addValue("GEIIS PACS");
     list.put(a);
   }
   {
     Attribute a = new UnsignedShortAttribute(new AttributeTag(0x0903, 0x1010));
     a.addValue(0);
     list.put(a);
   }
   list.removeUnsafePrivateAttributes();
   assertTrue(
       "Checking Creator is not removed", list.get(new AttributeTag(0x0903, 0x0010)) != null);
   assertTrue(
       "Checking Reject Image Flag is not removed",
       ClinicalTrialsAttributes.isSafePrivateAttribute(new AttributeTag(0x0903, 0x1010), list));
 }
 public void TestSafePrivateGEPACSRelated_CreatorFromList() throws Exception {
   AttributeList list = new AttributeList();
   {
     Attribute a = new LongStringAttribute(new AttributeTag(0x0903, 0x0010));
     a.addValue("GEIIS PACS");
     list.put(a);
   }
   assertTrue(
       "Checking Reject Image Flag is safe",
       ClinicalTrialsAttributes.isSafePrivateAttribute(new AttributeTag(0x0903, 0x1010), list));
 }
 public void TestSafePrivatePhilipsPETRelated_ScaleFactors_FromList() throws Exception {
   AttributeList list = new AttributeList();
   {
     Attribute a = new LongStringAttribute(new AttributeTag(0x7053, 0x0010));
     a.addValue("Philips PET Private Group");
     list.put(a);
   }
   assertTrue(
       "Checking SUV Factor is safe",
       ClinicalTrialsAttributes.isSafePrivateAttribute(new AttributeTag(0x7053, 0x1000), list));
   assertTrue(
       "Checking Activity Concentration Factor is safe",
       ClinicalTrialsAttributes.isSafePrivateAttribute(new AttributeTag(0x7053, 0x1009), list));
 }