message.setDICOMSignedLongs¶
Signature: message.setDICOMSignedLongs(nodePath, value, instance*, forceNode*)
Returns: void
Sets the value as a \\ delimited string of signed longs of the first node that matches the nodePath.
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 | |
| String or Number[] | value | the new node value either as a String or a JS Array of JS Numbers | |
| 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 tag values using signed long integers (String or Number[])
// assumes `message` is a DICOM message model object
// Example: value as String (backslash-delimited signed longs)
message.setDICOMSignedLongs(
"0013,000C", // nodePath - DICOM tag
"1\\0\\-1\\0" // value (String of signed longs)
);
// Example: value as Number[] (JS array of numbers)
message.setDICOMSignedLongs(
"0013,000C", // nodePath
[1, 0, -1, 0] // value (Number[])
);
// Example: value as Number[] with larger values (Long range)
message.setDICOMSignedLongs(
"0013,000C",
[123456789, -987654321]
);
// Example: specify instance (1-based index)
message.setDICOMSignedLongs(
"0013,000C", // nodePath
[2, 1, -2, 1], // value
1 // instance (first match)
);
// Example: create node if it does not exist (forceNode = true)
message.setDICOMSignedLongs(
"0013,000D", // nodePath (new tag)
"5\\4\\-5\\4", // value
1, // instance
true // forceNode - create if missing
);
// Example: do NOT create node if it does not exist
message.setDICOMSignedLongs(
"0013,000E",
[0, 0],
1,
false // forceNode - will NOT create tag
);