private static String toString(DateRange range, VR vr, TimeZone tz, DatePrecision precision) { String start = range.getStartDate() != null ? (String) vr.toValue(new Date[]{range.getStartDate()}, tz, precision) : ""; String end = range.getEndDate() != null ? (String) vr.toValue(new Date[]{range.getEndDate()}, tz, precision) : ""; return toDateRangeString(start, end); }
private DateRange toDateRange(String s, VR vr) { String[] range = splitRange(s); TimeZone tz = getTimeZone(); DatePrecision precision = new DatePrecision(); Date start = range[0] == null ? null : vr.toDate(range[0], tz, 0, false, null, precision); Date end = range[1] == null ? null : vr.toDate(range[1], tz, 0, true, null, precision); return new DateRange(start, end); }
private static void supplementMissingValue(Attributes metadata, int tag, String value) { if (!metadata.containsValue(tag)) metadata.setString(tag, DICT.vrOf(tag), value); } }
public static IDWithIssuer valueOf(Attributes attrs, int idTag, int issuerSeqTag) { String id = attrs.getString(idTag); if (id == null) return null; return new IDWithIssuer(id, Issuer.valueOf(attrs.getNestedDataset(issuerSeqTag))); }
public static IDWithIssuer pidOf(Attributes attrs) { String id = attrs.getString(Tag.PatientID); if (id == null) return null; IDWithIssuer result = new IDWithIssuer(id, Issuer.fromIssuerOfPatientID(attrs)); result.setTypeOfPatientID(attrs.getString(Tag.TypeOfPatientID)); result.setIdentifierTypeCode(identifierTypeCodeOf(attrs)); return result; }
public static Issuer valueOf(Attributes issuerItem) { if (issuerItem == null) return null; String localNamespaceEntityID = issuerItem.getString(Tag.LocalNamespaceEntityID); String universalEntityID = issuerItem.getString(Tag.UniversalEntityID); String universalEntityIDType = issuerItem.getString(Tag.UniversalEntityIDType); return (universalEntityID != null && universalEntityIDType != null) ? new Issuer(localNamespaceEntityID, universalEntityID, universalEntityIDType) : localNamespaceEntityID != null ? new Issuer(localNamespaceEntityID, null, null) : null; }
private void set(String privateCreator, int tag, Fragments src) { boolean toogleEndian = src.bigEndian() != bigEndian; VR vr = src.vr(); Fragments dst = newFragments(privateCreator, tag, vr, src.size()); for (Object frag : src) dst.add(toggleEndian(vr, frag, toogleEndian)); }
public SpecificCharacterSet getSpecificCharacterSet() { if (cs != null) return cs; if (containsSpecificCharacterSet) cs = SpecificCharacterSet.valueOf( getStrings(null, Tag.SpecificCharacterSet, VR.CS)); else if (parent != null) return parent.getSpecificCharacterSet(); else cs = SpecificCharacterSet.getDefaultCharacterSet(); return cs; }
@Override protected IOD queryKeysIOD(QueryRetrieveLevel rootLevel, boolean relational) { IOD iod = new IOD(); iod.add(new IOD.DataElement(Tag.StudyInstanceUID, VR.UI, IOD.DataElementType.TYPE_0, -1, -1, 0)); iod.add(new IOD.DataElement(Tag.SeriesInstanceUID, VR.UI, IOD.DataElementType.TYPE_0, -1, -1, 0)); iod.add(new IOD.DataElement(Tag.SOPInstanceUID, VR.UI, IOD.DataElementType.TYPE_0, -1, -1, 0)); return iod; }
public Date getDate(String privateCreator, int tag, VR vr, int valueIndex, Date defVal) { return getDate(privateCreator, tag, vr, valueIndex, defVal, new DatePrecision()); }
public static SpecificCharacterSet valueOf(String... codes) { if (codes == null || codes.length == 0) return DEFAULT; if (codes.length > 1) codes = checkISO2022(codes); Codec[] infos = new Codec[codes.length]; for (int i = 0; i < codes.length; i++) infos[i] = Codec.forCode(codes[i]); return codes.length > 1 ? new ISO2022(infos,codes) : new SpecificCharacterSet(infos, codes); }
public Sequence getSequence(String privateCreator, int tag) { int index = indexOf(privateCreator, tag); if (index < 0) return null; Object value = values[index]; if (value == Value.NULL) return (Sequence) (values[index] = new Sequence(this, 0)); return value instanceof Sequence ? (Sequence) value : null; }
@Override public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof Key)) return false; Key other = (Key) o; return outer().equalsIgnoreMeaning(other.outer()); }