private static boolean checkAttrs(String what, AttributeList attrs) { if (attrs.size() != 1) { System.out.println( "TEST FAILS: list returned by " + what + " does not have size 1: " + attrs); return false; } Attribute attr = (Attribute) attrs.get(0); if (!"Exotic".equals(attr.getName())) { System.out.println("TEST FAILS: " + what + " returned wrong " + "attribute: " + attr); return false; } return true; }
/** * @param list * @return array of two String values, row then column orientation, else array of two nulls if * cannot be obtained */ private static String[] getPatientOrientation(AttributeList list) { String[] vPatientOrientation = null; Attribute aPatientOrientation = list.get(TagFromName.PatientOrientation); if (aPatientOrientation != null && aPatientOrientation.getVM() == 2) { try { vPatientOrientation = aPatientOrientation.getStringValues(); if (vPatientOrientation != null && vPatientOrientation.length != 2) { vPatientOrientation = null; } } catch (DicomException e) { vPatientOrientation = null; } } if (vPatientOrientation == null) { vPatientOrientation = new String[2]; } return vPatientOrientation; }
private static Object attrValue(AttributeList attrs) { return ((Attribute) attrs.get(0)).getValue(); }