private static EventTypeCode[] toEventTypeCodeArray(String... ss) { EventTypeCode[] a = new EventTypeCode[ss.length]; for (int i = 0; i < ss.length; i++) { Code code = new Code(ss[i]); a[i] = new EventTypeCode(); a[i].setCsdCode(code.getCodeValue()); a[i].setCodeSystemName(code.getCodingSchemeDesignator()); a[i].setOriginalText(code.getCodeMeaning()); } return a; }
private static JsonObject toCodeObject(Code qcRejectionCode) { JsonObjectBuilder codeBuilder = Json .createObjectBuilder() .add("codeValue", emptyIfNull(qcRejectionCode.getCodeValue())) .add("codeMeaning", emptyIfNull(qcRejectionCode.getCodeMeaning())) .add("codingSchemeDesignator", emptyIfNull(qcRejectionCode.getCodingSchemeDesignator())); if (qcRejectionCode.getCodingSchemeVersion() != null) codeBuilder.add("codingSchemeVersion", qcRejectionCode.getCodingSchemeVersion()); return codeBuilder.build(); }
@Override public String toConfigNode(Code object, ConfigProperty property, SavingContext ctx) throws ConfigurationUnserializableException { return object.toString(); }
private static String encodeRejectionCode(Code rejCode) { return rejCode.getCodeValue() + ":" + rejCode.getCodeMeaning() + ":" + rejCode.getCodingSchemeDesignator(); }
@Override public Code fromConfigNode(String configNode, ConfigProperty property, LoadingContext ctx, Object parent) throws ConfigurationException { return new Code(configNode); }
Attributes item = val.getNestedDataset(Tag.MeasurementUnitsCodeSequence); if (item != null) { Code unit = new Code(item); html.append(" "); //$NON-NLS-1$ html.append(EscapeChars.forHTML(unit.getCodeValue()));
public static IOD valueOf(Code code) { IOD iod = new IOD(); iod.add(new DataElement( Tag.CodeValue, VR.SH, DataElementType.TYPE_1, 1, 1, 0) .setValues(code.getCodeValue())); iod.add(new DataElement( Tag.CodingSchemeDesignator, VR.SH, DataElementType.TYPE_1, 1, 1, 0) .setValues(code.getCodingSchemeDesignator())); String codingSchemeVersion = code.getCodingSchemeVersion(); if (codingSchemeVersion == null) iod.add(new DataElement( Tag.CodingSchemeVersion, VR.SH, DataElementType.TYPE_0, -1, -1, 0)); else iod.add(new DataElement( Tag.CodingSchemeVersion, VR.SH, DataElementType.TYPE_1, 1, 1, 0)); return iod; } }
@Override protected void initLabel() { /* * DICOM PS 3.3 - 2011 - C.17.3 SR Document Content Module * * Concept Name Code Sequence: mandatory when type is CONTAINER or the root content item. */ StringBuilder buf = new StringBuilder(getLabelPrefix()); Attributes dicom = ((DicomMediaIO) mediaIO).getDicomObject(); Attributes item = dicom.getNestedDataset(Tag.ConceptNameCodeSequence); if (item != null) { Code code = new Code(item); buf.append(code.getCodeMeaning()); } label = buf.toString(); } }
public static Code addCode(Code code) { return MODALITIES.put(code.getCodeValue(), code); }
private static void addCodeMeaning(StringBuilder html, Code code, String startTag, String endTag) { if (code != null) { if (startTag != null) { html.append(startTag); } html.append(EscapeChars.forHTML(code.getCodeMeaning())); if (endTag != null) { html.append(endTag); } } }
public static Code codeValue(Attribute attr) throws NamingException { return attr != null ? new Code((String) attr.get()) : null; }
private static RoleIDCode[] toRoleIDCodeArray(String... ss) { RoleIDCode[] a = new RoleIDCode[ss.length]; for (int i = 0; i < ss.length; i++) { Code code = new Code(ss[i]); a[i] = new RoleIDCode(); a[i].setCsdCode(code.getCodeValue()); a[i].setCodeSystemName(code.getCodingSchemeDesignator()); a[i].setOriginalText(code.getCodeMeaning()); } return a; } }
public static Code codeValue(Attribute attr) throws NamingException { return attr != null ? new Code((String) attr.get()) : null; }
@Override public EventTypeCode fromConfigNode(String configNode, ConfigProperty property, LoadingContext ctx, Object parent) throws ConfigurationException { Code code = new Code(configNode); EventTypeCode eventTypeCode = new EventTypeCode(); eventTypeCode.setCode(code.getCodeValue()); eventTypeCode.setCodeSystemName(code.getCodingSchemeDesignator()); eventTypeCode.setOriginalText(code.getCodeMeaning()); return eventTypeCode; }
private static Code decodeCode(String codeString) { Code code = null; String[] codeComponents = codeString.split(":"); if(codeComponents.length < 3) { throw new IllegalArgumentException("Code string specified must contain at least value, scheme designator and meaning"); } else { if(codeComponents.length == 3) { code = new Code(codeComponents[0], codeComponents[2], null,codeComponents[1]); } else if(codeComponents.length == 4) { code = new Code(codeComponents[0], codeComponents[2], codeComponents[3], codeComponents[1]); } } return code; }