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));
 }
Exemplo n.º 2
0
 public void TestSafePrivateGEPACSRelated_FromFile() throws Exception {
   AttributeList list = new AttributeList();
   String testFilePath = System.getProperty("com.pixelmed.test.filepath");
   // System.err.println("TestSafePrivateGEPACSRelated.TestSafePrivateGEPACSRelated_FromFile():
   // testFilePath = "+testFilePath);
   list.read(new java.io.File(testFilePath, "philipsctwithgepacsprivateattributes.dcm"));
   // System.err.print("TestSafePrivateGEPACSRelated.TestSafePrivateGEPACSRelated():\n"+list);
   list.removeUnsafePrivateAttributes();
   assertTrue(
       "Checking Creator is not removed", list.get(new AttributeTag(0x0903, 0x0010)) != null);
   assertTrue(
       "Checking Reject Image Flag is not removed",
       list.get(new AttributeTag(0x0903, 0x1010)) != null);
 }
 public void TestSafePrivatePhilipsPETRelated_ScaleFactors_FromFile() throws Exception {
   AttributeList list = new AttributeList();
   String testFilePath = System.getProperty("com.pixelmed.test.filepath");
   // System.err.println("TestSafePrivatePhilipsPETRelated.TestSafePrivatePhilipsPETRelated_ScaleFactors_FromFile(): testFilePath = "+testFilePath);
   list.read(new java.io.File(testFilePath, "philipssuvandactivityscalefactors.dcm"));
   // System.err.print("TestSafePrivatePhilipsPETRelated.TestSafePrivatePhilipsPETRelated_ScaleFactors():\n"+list);
   list.removeUnsafePrivateAttributes();
   assertTrue(
       "Checking Creator is not removed", list.get(new AttributeTag(0x7053, 0x0010)) != null);
   assertTrue(
       "Checking SUV Factor is not removed", list.get(new AttributeTag(0x7053, 0x1000)) != null);
   assertTrue(
       "Checking Activity Concentration Factor is not removed",
       list.get(new AttributeTag(0x7053, 0x1009)) != null);
 }
Exemplo n.º 4
0
 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));
 }