public static Attributes jsonToAttributes()

in util/src/main/java/com/google/cloud/healthcare/imaging/dicomadapter/AttributesUtil.java [166:182]


  public static Attributes jsonToAttributes(JSONObject jsonDataset) throws DicomServiceException {
    Attributes attributes = new Attributes();
    for (String tag : jsonDataset.keySet()) {
      JSONObject element = jsonDataset.getJSONObject(tag);
      int tagInt = TagUtils.forName(tag);
      VR vr = VR.valueOf(element.getString("vr"));
      if (isBinaryVr(vr)) {
        throw new DicomServiceException(Status.ProcessingFailure,
            "Binary VR not supported: " + vr.toString());
      } else if (element.has("Value")) {
        setAttributeValue(attributes, tagInt, vr, (JSONArray) element.get("Value"));
      } else {
        attributes.setValue(tagInt, vr, null);
      }
    }
    return attributes;
  }