String codeMeaning = codes.getProperty(codeValue);
if (codeMeaning == null)
throw new IllegalArgumentException("undefined code value: "
+ codeValue);
int endDesignator = codeValue.indexOf('-');
Attributes attrs = new Attributes(3);
attrs.setString(Tag.CodeValue, VR.SH,
endDesignator >= 0
? codeValue.substring(endDesignator + 1)
: codeValue);
attrs.setString(Tag.CodingSchemeDesignator, VR.SH,
endDesignator >= 0
? codeValue.substring(0, endDesignator)
: "DCM");
attrs.setString(Tag.CodeMeaning, VR.LO, codeMeaning);
return attrs;
}