message.setDICOMPrivateDataContent¶
Signature: message.setDICOMPrivateDataContent(nodePath, vrName, value, instance*, forceNode*)
Returns: void
Sets the value at the nodePath location.
The vrName specifies the data type of the value.
Note
The vrName can be one of the following values: AE, AS, AT, CS DA, DS, DT, FL, FD, IS, LO, LT, OB, OD, OF, OW, PN, SH, SL, SQ, SS, ST, TM, UI, UL, US, or UT. For more information see: http://dicom.nema.org/dicom/2013/output/chtml/part05/sect_6.2.html.
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| String | nodePath | the DICOM node path | |
| String | vrName | the DICOM Value Representation String | |
| Object | value | the new node value whose type must match the vrString type | |
| 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 DICOM private tag values with an explicit VR (Value Representation).
// assumes `message` is a DICOM message model object
// Set a private tag to a single string value (VR=LO)
message.setDICOMPrivateDataContent(
"0019,10C1", // DICOM tag (private)
"LO", // vrName
"Private Data Sample" // value
);
// Set a private tag to multiple strings (VR=SH)
var Array = java.lang.reflect.Array;
var descriptions = Array.newInstance(java.lang.Object, 2);
descriptions[0] = new java.lang.String("Description A");
descriptions[1] = new java.lang.String("Description B");
message.setDICOMPrivateDataContent(
"0019,10C2", // DICOM tag (private)
"SH", // vrName
descriptions // value (Object[])
);
// Create missing private tag and set its value (VR=ST)
message.setDICOMPrivateDataContent(
"0019,10C3", // DICOM tag (private)
"ST", // vrName
"More Private Info", // value
null, // instance (first match)
true // create tag if it doesn't exist
);