message.setDICOMBytes¶
Signature: message.setDICOMBytes(nodePath, value, instance*, forceNode*)
Returns: void
Set the value as a byte array of the first node that matches the nodePath.
A value given as a String must be Base64 encoded, and the call is refused if it is not. Line breaks within the Base64 are ignored. Pass a byte array to store bytes exactly as given.
Note
When the optional instance value is specified, the nodePath should not include an instance identifier.
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| String | nodePath | the DICOM node path | |
| byte[] or String | value | the new node value, either a byte array or a Base64 encoded String | |
| Integer | instance* | (optional) the match instance to set. Use 1 for the first instance. | 1 |
| Boolean | forceNode* | (optional) create the node if it doesn't exist | true |
Example¶
// Example: Set binary (byte[]) values on DICOM tags, creating tags if they do not exist.
// assumes `message` is a DICOM message model object
// Set a custom private tag to binary data
message.setDICOMBytes(
"0013,0001", // DICOM tag
new java.lang.String("custom data").getBytes(), // value (byte[])
null, // instance (first match)
true // create tag if it doesn't exist
);