private static VR getVR(String vr) { try { return VR.valueOf(vr); } catch (Exception e) { return VR.OB; } }
private VR vrOf(String s) throws SAXException { try { return VR.valueOf(s); } catch (NullPointerException e) { throw new SAXException("missing vr attribute"); } catch (IllegalArgumentException e) { throw new SAXException("unrecognized vr=\"" + s + '"'); } }
private void startDicomAttribute(int tag, String privateCreator, String vr) { this.tag = tag; this.privateCreator = privateCreator; this.vr = vr != null ? VR.valueOf(vr) : ElementDictionary.vrOf(tag, privateCreator); if (this.vr == VR.SQ) seqs.add(items.getLast().newSequence(privateCreator, tag, 10)); }
public void setLengthsThresholdsFromStrings(String... ss) { EnumMap<VR,Integer> tmp = new EnumMap<>(VR.class); for (String s : ss) { String[] entry = StringUtils.split(s, '='); if (entry.length != 2) throw new IllegalArgumentException(s); try { Integer length = Integer.valueOf(entry[1]); for (String vr : StringUtils.split(entry[0], ',')) { tmp.put(VR.valueOf(vr), length); } } catch (IllegalArgumentException e) { throw new IllegalArgumentException(s); } } lengthsThresholdByVR.clear(); lengthsThresholdByVR.putAll(tmp); }
public void readHeader() throws IOException { byte[] buf = buffer; tagPos = pos; readFully(buf, 0, 8); encodedVR = 0; switch(tag = ByteUtils.bytesToTag(buf, 0, bigEndian)) { case Tag.Item: case Tag.ItemDelimitationItem: case Tag.SequenceDelimitationItem: vr = null; break; default: if (explicitVR) { vr = VR.valueOf(encodedVR = ByteUtils.bytesToVR(buf, 4)); if (vr.headerLength() == 8) { length = ByteUtils.bytesToUShort(buf, 6, bigEndian); return; } readFully(buf, 4, 4); } else { vr = VR.UN; } } length = ByteUtils.bytesToInt(buf, 4, bigEndian); }
case "vr": try { el.vr = VR.valueOf(valueString()); } catch (IllegalArgumentException e) { throw new JsonParsingException("Invalid vr: " + getString(), parser.getLocation());