public abstract class MCattributeSet extends java.lang.Object implements java.lang.Iterable<MCtag>
There are four types of attribute sets: messages - MCdimseMessage
, files - MCfile
,
DICOM directory files - MCdicomDir
and sequence items - MCitem
.
See the Data Set Manipulation topic for a description of various attribute set related classes and their usage.
Attributes are identified by tag numbers which are represented as integers but ordered as unsigned integers. For example the tag value -327686 (0xFFFAFFFA) represents the Digital Signatures Sequence attribute (FFFA,FFFA) and it comes after the tag number 2145386512 (0x7FE00010) representing the Pixel Data attribute.
Private attributes are identified using MCtag
objects, through the private group creator code, private group
number and private element number, as described in Part5 of the DICOM standard.
This class implements the Iterable
interface to provide easy access to the list of attributes
contained in the set.
This class provides access to the values of the attributes included in the attribute set. Values are represented by types according to the attribute's value representation. Values that are dependent on the specific character set encoding are converted by the toolkit to/from the Unicode representation used in Java strings. The encoding/decoding of these attribute values is done at the time when the value is set or retrieved so it is important that the specific character set attribute be set before setting the value for attributes that depends on it. For sequence items that inherit the value of the specific character set from the containing attribute set, attribute values must be set after the item object is added to the attribute set.
To encode a sequence item into an attribute of Value Representation SQ, treat the attribute as a multi-valued
attribute, where each value is an MCitem
object. The following sample code fragment gives an
example of encoding an Icon Image Item into a sequence:
// create a new sequence item MCitem myItem = new MCitem( "ICON_IMAGE" ); // add the item to the attribute set ats.addValue( MCdicom.ICON_IMAGE_SEQUENCE, myItem ); // set the content of the item myItem.setValue( MCdicom.ROWS, 24); myItem.setValue( MCdicom.COLUMNS, 24); myItem.setValue( MCdicom.PIXEL_DATA, iconBytes ); ...
Large binary (bulk) values, like pixel data, can be read or set by using Java nio's byte channels or by
simple byte arrays. The toolkit stores bulk data in either memory or temporary files depending on the
value of LARGE_DATA_STORE and LARGE_DATA_SIZE configuration items in mergecom.pro.
Alternatively custom value storage may be used for handling such values. See the description of the
MCapplication.registerValueStorageProvider(MCvalueStorageProvider, int)
method for details
on custom value storage.
For information on on handling bulk values, including encapsulation, byte ordering and value representation
choices,see the Pixel And Other Bulk Data
topic.
Regular attributes can be added to the set by simply setting a value for the attribute. Attributes (private or
non-standard) that are not defined in the data dictionary must be added using the
addAttribute(MCtag, MCvr)
method. addEncapsulatedFrame(ReadableByteChannel, boolean)
This class provides three methods to retrieve information about specific attributes contained in the set. The
getValueRepresentation(int)
method retrieves the attribute's value representation,
the getValueCount(int)
method returns the number of values assigned to the attribute
and the getValueLength(int)
method provides the size of an attribute's value.
A formatted list of the attributes of an attribute set can be obtained by using the list()
method of this class.
An instance of this class can not be used by multiple threads concurrently.
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(MCtag tag)
Adds an empty attribute to this attribute set.
|
void |
addAttribute(MCtag tag,
MCvr vr)
Adds an empty attribute to this attribute set.
|
void |
addEncapsulatedFrame(java.nio.channels.ReadableByteChannel source,
boolean last)
Adds a frame of encapsulated data to this attribute set.
|
void |
addValue(int tag,
java.lang.Object value)
Adds a value to this attribute.
|
void |
addValue(MCtag tag,
java.lang.Object value)
Adds a value to this attribute.
|
void |
clear()
Removes all attributes from this attribute set
|
void |
clear(int fromTag,
int toTag)
Removes all attributes with tag number in the specified range.
|
boolean |
contains(int tag)
Tells whether an attribute is present in this attribute set.
|
boolean |
contains(MCtag tag)
Tells whether an attribute is present in this attribute set.
|
void |
copyTo(MCattributeSet destination)
Copies the attributes in this set to another attribute set.
|
boolean |
createSignature(int[] tags,
java.security.cert.X509Certificate cert,
java.security.PrivateKey key,
java.security.MessageDigest md)
Creates a new digital signature (DICOM PS 3.3, C.12.1.1.3 Digital Signatures Macro) in the current attribute set
|
boolean |
createSignature(int[] tags,
java.security.cert.X509Certificate cert,
java.security.PrivateKey key,
java.lang.String ha)
Creates a new digital signature (DICOM PS 3.3, C.12.1.1.3 Digital Signatures Macro) in the current attribute set
|
void |
deleteSignature()
Creates a digital signature (DICOM PS 3.3, C.12.1.1.3 Digital Signatures Macro) in the current attribute set
|
void |
dispose()
Disposes this attribute set and ensures unmanaged resource associated with the attributes set are released.
|
MCattributeSet |
duplicate(MCtransferSyntax resultSyntax)
Create a duplicate copy of MCdimseMessage in the specified transfer syntax.
|
java.math.BigInteger |
getBigInteger(int tag,
int valueNo)
Gets the
BigInteger representation of an attribute's value. |
java.math.BigInteger |
getBigInteger(MCtag tag,
int valueNo)
Gets the
BigInteger representation of an attribute's value. |
void |
getBulkValue(int tag,
java.nio.channels.WritableByteChannel destination)
Reads the value of a bulk (OB, OW, OV, OL, OD, OF, UN) attribute.
|
void |
getBulkValue(MCtag tag,
java.nio.channels.WritableByteChannel destination)
Reads the value of a bulk (OB, OW, OV, OL, OD, OF, UN) attribute.
|
MCcommand |
getCommand()
Gets the command associated with this attribute set.
|
double |
getDoubleValue(int tag,
int valueNo)
Gets the
double representation of an attribute's value. |
double |
getDoubleValue(MCtag tag,
int valueNo)
Gets the
double representation of an attribute's value. |
boolean |
getEncapsulatedFrame(java.nio.channels.WritableByteChannel destination,
boolean first)
Reads a frame of encapsulated pixel data.
|
float |
getFloatValue(int tag,
int valueNo)
Gets the
float representation of an attribute's value. |
float |
getFloatValue(MCtag tag,
int valueNo)
Gets the
float representation of an attribute's value. |
boolean |
getFrame(java.nio.channels.WritableByteChannel destination,
int frame)
Reads a frame of multi-frame pixel data, compressed or uncompressed.
|
int |
getIntValue(int tag,
int valueNo)
Gets the integer representation of an attribute's value.
|
int |
getIntValue(MCtag tag,
int valueNo)
Gets the integer representation of an attribute's value.
|
MCitem |
getItem(int tag,
int itemNo)
Gets a sequence item of the specified attribute.
|
MCitem |
getItem(MCtag tag,
int itemNo)
Gets a sequence item of the specified attribute.
|
java.lang.String |
getKeyword(int tag)
Gets an attribute's keyword based on the name of the data
element as described by section 6 part 6 in the DICOM standard.
|
java.lang.String |
getKeyword(MCtag tag)
Gets an attribute's keyword based on the name of the data
element as described by section 6 part 6 in the DICOM standard.
|
long |
getLongValue(int tag,
int valueNo)
Gets the
long representation of an attribute's value. |
long |
getLongValue(MCtag tag,
int valueNo)
Gets the
long representation of an attribute's value. |
java.lang.String |
getModality()
Gets the value of the Modality attribute in this attribute set.
|
MCvalidationError |
getNextValidationError()
Gets the next validation error for this attribute set.
|
boolean |
getOffsetTable(java.nio.channels.WritableByteChannel destination)
Reads an offset table of multi-frame pixel data
|
java.lang.String |
getService()
Gets the DICOM service associated with this attribute set.
|
short |
getShortValue(int tag,
int valueNo)
Gets the
short representation of an attribute's value. |
short |
getShortValue(MCtag tag,
int valueNo)
Gets the
short representation of an attribute's value. |
java.lang.String |
getSOPClassUID()
Gets the value of the SOP Class UID attribute in this attribute set.
|
java.lang.String |
getSOPInstanceUID()
Gets the value of the SOP Instance UID attribute in this attribute set.
|
java.lang.String |
getStringValue(int tag,
int valueNo)
Gets the string representation of a value of an attribute.
|
java.lang.String |
getStringValue(int tag,
int valueNo,
java.lang.String defaultValue)
Gets the string representation of a value of an attribute.
|
java.lang.String |
getStringValue(MCtag tag,
int valueNo)
Gets the string representation of a value of an attribute.
|
java.lang.String |
getStringValue(MCtag tag,
int valueNo,
java.lang.String defaultValue)
Gets the string representation of a value of an attribute.
|
MCtransferSyntax |
getTransferSyntax()
Gets the transfer syntax used to encode or decode this attribute set.
|
java.lang.Object |
getValue(int tag,
int valueNo)
Gets a value of an attribute.
|
java.lang.Object |
getValue(int tag,
int valueNo,
java.lang.Object defaultValue)
Gets a value of an attribute.
|
java.lang.Object |
getValue(MCtag tag,
int valueNo)
Gets a value of an attribute.
|
java.lang.Object |
getValue(MCtag tag,
int valueNo,
java.lang.Object defaultValue)
Gets a value of an attribute.
|
int |
getValueCount(int tag)
Gets the number of values of an attribute in this attribute set.
|
int |
getValueCount(MCtag tag)
Gets the number of values of an attribute in this attribute set.
|
long |
getValueLength(int tag)
Returns the total length of an attribute's values, in bytes.
|
long |
getValueLength(MCtag tag)
Returns the value length of an attribute in this attribute set.
|
MCvr |
getValueRepresentation(int tag)
Gets an attribute's DICOM Value Representation.
|
MCvr |
getValueRepresentation(MCtag tag)
Gets an attribute's DICOM Value Representation.
|
java.lang.Object |
getValues(int tag)
Gets all values of an attribute.
|
java.lang.Object |
getValues(MCtag tag)
Gets all values of an attribute.
|
java.util.Iterator<MCtag> |
iterator()
Gets an iterator over the attributes of this attribute set in order of increasing tag numbers.
|
void |
list()
Lists the content of this attribute set in a human readable form to the
"standard" output stream (
System.out ). |
void |
list(java.io.PrintStream dest)
Lists the content of this attribute set in a human readable form.
|
static MCattributeSet[] |
readAttributeSetsFromJSON(java.io.InputStream stream)
Converts an array of JSON representation (DICOM JSON Model PS3.19 F)
of the DICOM attributes into an array of
MCattributeSet . |
static MCattributeSet[] |
readAttributeSetsFromJSON(java.io.InputStream stream,
MCbulkDataUriProvider provider)
Converts an array of JSON representation (DICOM JSON Model PS3.19 F) of the DICOM attributes
into an array of
MCattributeSet . |
void |
readFromJSON(java.io.InputStream stream)
Converts a JSON representation (DICOM JSON Model PS3.19 F) of the DICOM attributes into
MCattributeSet . |
void |
readFromJSON(java.io.InputStream stream,
MCbulkDataUriProvider provider)
Converts a JSON representation (DICOM JSON Model PS3.19 F) of the DICOM attributes into
MCattributeSet . |
long |
readFromStream(int fromTag,
int toTag,
MCtransferSyntax ts,
java.nio.channels.ReadableByteChannel source)
Decodes a DICOM encoded stream of bytes into this attribute set.
|
long |
readFromStream(MCtransferSyntax ts,
java.nio.channels.ReadableByteChannel source)
Decodes a DICOM encoded stream of bytes into this attribute set.
|
void |
readFromXML(java.io.InputStream stream)
Converts an XML representation of the DICOM attributes into an attribute set.
|
void |
readFromXML(java.io.Reader reader)
Deprecated.
Use readFromXML(InputStream source) instead. Warning, to keep using this API, user must construct a
reader that uses UTF-8 encoding (in which the DICOM xml file is expected to be encoded).
|
void |
readFromXMLNative(java.io.InputStream stream)
Converts an XML representation (Native DICOM Model schema PS3.19) of the DICOM attributes into
MCattributeSet . |
void |
readFromXMLNative(java.io.InputStream stream,
MCbulkDataUriProvider provider)
Converts an XML representation (Native DICOM Model schema PS3.19) of the DICOM attributes into
MCattributeSet . |
void |
removeAttribute(int tag)
Removes an attribute from this attribute set.
|
void |
removeAttribute(MCtag tag)
Removes an attribute from this attribute set.
|
void |
resetTransferSyntax()
Invalidate the transfer syntax used to encode this attribute set.
|
void |
setDefaultCompression(boolean on)
Register the default compression/decompression callbacks.
|
void |
setServiceCommand(java.lang.String serviceName,
MCcommand command)
Associates this attribute set with a given DICOM service/command pair.
|
void |
setTransferSyntax(MCtransferSyntax ts)
Sets the transfer syntax used to encode this attribute set.
|
void |
setValue(int tag,
java.lang.Object value)
Sets the value of an attribute.
|
void |
setValue(MCtag tag,
java.lang.Object value)
Sets the value of an attribute.
|
void |
setValueRepresentation(int tag,
MCvr vr)
Changes the value representation of an attribute.
|
void |
setValueRepresentation(MCtag tag,
MCvr vr)
Changes the value representation of an attribute.
|
int |
size()
Returns the number of attributes in this attribute list.
|
MCvalidationError |
validate(MCvalidationLevel level)
Validates all attributes in this attribute set.
|
MCvalidationError |
validateAttribute(int tag,
MCvalidationLevel level)
Validates the value of an attribute in this attribute set.
|
boolean |
verifySignature()
Verifies a digital signature (DICOM PS 3.3, C.12.1.1.3 Digital Signatures Macro) in the current attribute set
|
static void |
writeAttributeSetsToJSON(MCattributeSet[] attributeSets,
java.io.OutputStream stream,
int xmlOptions,
MCbulkDataUriProvider provider) |
void |
writeToJSON(java.io.OutputStream stream,
int xmlOptions,
MCbulkDataUriProvider provider)
Converts
MCattributeSet into its JSON representation (DICOM JSON Model PS3.19 F). |
void |
writeToStream(int fromTag,
int toTag,
MCtransferSyntax ts,
java.nio.channels.WritableByteChannel destination)
Encodes this attribute set into a DICOM stream.
|
void |
writeToStream(MCtransferSyntax ts,
java.nio.channels.WritableByteChannel destination)
Encodes the full content of this attribute set into a DICOM stream.
|
void |
writeToXML(java.io.OutputStream destination,
int xmlOptions)
Converts DICOM attribute set into its XML representation.
|
void |
writeToXML(java.io.Writer destination,
int xmlOptions)
Deprecated.
Use writeToXML(OutputStream destination, int xmlOptions) instead. Warning, to keep using this API,
user must construct a writer that uses UTF-8 encoding (in which the DICOM xml file is expected to be encoded).
|
void |
writeToXMLNative(java.io.OutputStream stream,
int xmlOptions,
MCbulkDataUriProvider provider)
Converts
MCattributeSet into its XML representation (Native DICOM Model schema PS3.19). |
public void dispose()
If this method is not called the unmanaged resources are released when this object is garbage collected.
An application must not call any method of the attribute set after disposing it.
public MCtransferSyntax getTransferSyntax()
public void setTransferSyntax(MCtransferSyntax ts)
ts
- The transfer syntax to use for encoding.MCexception
- If the transfer syntax parameter is invalid or if the attribute set is disposed.public void resetTransferSyntax()
MCexception
- If the attribute set is disposed.public void setServiceCommand(java.lang.String serviceName, MCcommand command)
serviceName
- The DICOM service name to be associated with this attribute set. It must be a valid service
name defined in the MergeCOM service profile file (mergecom.srv).command
- The command which is to be associated with this attribute set.MCexception
- If a parameter is invalid or if the attribute set is disposed.public java.lang.String getService()
MCexception
- If the attribute set is disposed.public MCcommand getCommand()
MCcommand
object representing the command for this attribute set.MCexception
- If the attribute set is disposed.public void clear()
MCexception
- If the attribute set is disposed.public void clear(int fromTag, int toTag)
The toolkit interprets the value of the two int parameters as unsigned integers.
fromTag
- The tag number of the first attribute to removed from this attribute set.toTag
- The tag number of the last attribute to remove from this attribute set.MCexception
- If the attribute set is disposed.public java.util.Iterator<MCtag> iterator()
The returned iterator represents the collection of attributes at the moment of the call. Changes made to the list of attributes in this attribute set made after this call returns are not reflected by the iterator.
The returned iterator does not support the remove() operation. Attributes can be removed during iteration using
the removeAttribute(int)
method.
iterator
in interface java.lang.Iterable<MCtag>
public int size()
public void list(java.io.PrintStream dest)
This method produces a report describing the contents of this attribute set. The report will
be written to the provided print stream, or to the "standard" output stream if the argument is
null
.
Note that if the object contains an attribute with a Value Representation of SQ (sequence of items), each item in the sequence will be listed. Each sequence of items is indented in the listing four spaces to the right of its owning message or items. This behavior is configurable through the LIST_SQ_DEPTH_LIMIT setting.
The maximum size of values listed can be controlled using the LIST_VALUE_LIMIT setting. The listing of attributes with UNKNOWN value representation is controlled by the LIST_UN_ATTRIBUTES setting.
dest
- The output for the listing.public void list()
System.out
).
See list(PrintStream)
method for details on the listing format.
public MCvr getValueRepresentation(int tag)
tag
- The tag number of the attribute.MCvr
object identifying the DICOM Value Representation of this attribute or null
if the attribute is not in this attribute set.public MCvr getValueRepresentation(MCtag tag)
tag
- The tag number of the attribute.MCvr
object identifying the DICOM Value Representation of this attribute or null
if the attribute is not in this attribute set.public java.lang.String getKeyword(int tag)
tag
- The tag number of the attribute.null
if the keyword can not be generated.public java.lang.String getKeyword(MCtag tag)
tag
- The tag number of the attribute.null
if the keyword can not be generated.public int getValueCount(int tag)
Note that for attributes of single value VR (UN, OB, OW, OV, OL, OD, OF, LT, ST, UT), this method will always return 1 or zero.
tag
- The tag number of the attribute.public int getValueCount(MCtag tag)
Note that for attributes of single value VR (UN, OB, OW, OV, OL, OD, OF, LT, ST, UT), this method will always return 1 or zero.
tag
- The tag of the attribute.public long getValueLength(int tag)
For multi-valued string attributes the returned number does not account for the value separator used between the values.
For encapsulated values the length represents the total length of the encoded encapsulated value, including the offset table, sequence item tags and lengths.
tag
- The tag number of the attribute.public long getValueLength(MCtag tag)
For multi-valued string attributes the returned number does not account for the value separator used between the values.
For encapsulated values the length represents the total length of the encoded encapsulated value, including the offset table, sequence item tags and lengths.
tag
- The tag of the attribute.public boolean contains(MCtag tag)
tag
- The tag of the attribute to check.true
if this attribute set contains the specified attribute.public boolean contains(int tag)
tag
- The tag number of the attribute to check.true
if this attribute set contains the specified attribute.public boolean createSignature(int[] tags, java.security.cert.X509Certificate cert, java.security.PrivateKey key, java.security.MessageDigest md)
tags
- The list of Data Element tags used to create Digital Signaturecert
- X509Certificate object with public keykey
- Private keymd
- MessageDigest object which provides one of the following hash algorithms: "MD5", "SHA-1", "SHA-256", "SHA-384" or "SHA-512"true
if Digital Signature is created successfully, false
otherwisepublic boolean createSignature(int[] tags, java.security.cert.X509Certificate cert, java.security.PrivateKey key, java.lang.String ha)
tags
- The list of Data Element tags used to create Digital Signaturecert
- X509Certificate object with public keykey
- Private keyha
- Term for MAC Algorithm (0400,0015) attribute in Digital Signatures Macro (DICOM PS3.3, Table C.12-6). Defined Terms are "MD5", "SHA1", "SHA256", "SHA384" and "SHA512"true
if Digital Signature is created successfully, false
otherwisepublic void deleteSignature()
public boolean verifySignature()
true
if Digital Signature is verified successfully, false
otherwisepublic java.lang.String getStringValue(int tag, int valueNo, java.lang.String defaultValue)
This method can be used to retrieve values of attributes with the following value representation: AS, AT, CS, DA, DS, DT, FD, FL, IS, LO, LT, PN, SH, SL, SS, ST, TM, UI, UL, US, UT.
If the value encoding depends on the specific character set (LO, LT, SH, ST, UT or PN), the toolkit decodes it so
that the returned value is the Unicode representation of the value. The MC.setStringEncoder(com.merge.mcw.MCstringEncoder)
method can be
used to specify a character set decoder for string values. By default the toolkit uses it's internal decoder.
tag
- The attribute's tag number.valueNo
- The zero based index of the value to retrieve.defaultValue
- The value to return if the attribute or the value is missing.public java.lang.String getStringValue(int tag, int valueNo)
This method can be used to retrieve values of attributes with the following value representation: AS, AT, CS, DA, DS, DT, FD, FL, IS, LO, LT, PN, SH, SL, SS, ST, TM, UI, UL, US, UT.
If the value encoding depends on the specific character set (LO, LT, SH, ST, UT or PN), the toolkit decodes it so
that the returned value is the Unicode representation of the value. The MC.setStringEncoder(com.merge.mcw.MCstringEncoder)
method can be
used to specify a character set decoder for string values. By default the toolkit uses it's internal decoder.
tag
- The attribute's tag.valueNo
- The zero based index of the value to retrieve.MCexception
- If this attribute set does not contain the requested attribute, if the value number is out of
range or if the value can not be represented as a string.public java.lang.String getStringValue(MCtag tag, int valueNo, java.lang.String defaultValue)
This method can be used to retrieve values of attributes with the following value representation: AS, AT, CS, DA, DS, DT, FD, FL, IS, LO, LT, PN, SH, SL, SS, ST, TM, UI, UL, US, UT.
If the value encoding depends on the specific character set (LO, LT, SH, ST, UT or PN), the toolkit decodes it so
that the returned value is the Unicode representation of the value. The MC.setStringEncoder(com.merge.mcw.MCstringEncoder)
method can be
used to specify a character set decoder for string values. By default the toolkit uses it's internal decoder.
tag
- The attribute's tag.valueNo
- The zero based index of the value to retrieve.defaultValue
- The value to return if the attribute or the value is missing.public java.lang.String getStringValue(MCtag tag, int valueNo)
This method can be used to retrieve values of attributes with the following value representation: AS, AT, CS, DA, DS, DT, FD, FL, IS, LO, LT, PN, SH, SL, SS, ST, TM, UI, UL, US, UT.
If the value encoding depends on the specific character set (LO, LT, SH, ST, UT or PN), the toolkit decodes it so
that the returned value is the Unicode representation of the value. The MC.setStringEncoder(com.merge.mcw.MCstringEncoder)
method can be
used to specify a character set decoder for string values. By default the toolkit uses it's internal decoder.
tag
- The attribute's tag number.valueNo
- The zero based index of the value to retrieve.MCexception
- If this attribute set does not contain the requested attribute, if the value number is out of
range or if the value can not be represented as a string.public int getIntValue(int tag, int valueNo)
This method can be used to retrieve values of attributes with the following value representation: AT, DS, FD, FL, IS, SL, SS, UL and US.
tag
- The attribute's tag number.valueNo
- The zero based index of the value to retrieve.MCexception
- If this attribute set does not contain the requested attribute, if the value number is out of
range or if the value can not be represented as an integer.public int getIntValue(MCtag tag, int valueNo)
This method can be used to retrieve values of attributes with the following value representation: AT, DS, FD, FL, IS, SL, SS, UL and US.
tag
- The attribute's tag.valueNo
- The zero based index of the value to retrieve.MCexception
- If this attribute set does not contain the requested attribute, if the value number is out of
range or if the value can not be represented as an integer.public short getShortValue(int tag, int valueNo)
short
representation of an attribute's value.
This method can be used to retrieve values of attributes with the following value representation: DS, FD, FL, IS, SL, SS, UL and US.
tag
- The attribute's tag number.valueNo
- The zero based index of the value to retrieve.MCexception
- If this attribute set does not contain the requested attribute, if the value number is out of
range or if the value can not be represented as a short.public short getShortValue(MCtag tag, int valueNo)
short
representation of an attribute's value.
This method can be used to retrieve values of attributes with the following value representation: DS, FD, FL, IS, SL, SS, UL and US.
tag
- The attribute's tag.valueNo
- The zero based index of the value to retrieve.MCexception
- If this attribute set does not contain the requested attribute, if the value number is out of
range or if the value can not be represented as a short.public long getLongValue(int tag, int valueNo)
long
representation of an attribute's value.
This method can be used to retrieve values of attributes with the following value representation: AT, DS, FD, FL, IS, SL, SS, UL and US.
tag
- The attribute's tag number.valueNo
- The zero based index of the value to retrieve.MCexception
- If this attribute set does not contain the requested attribute, if the value number is out of
range or if the value can not be represented as a long.public long getLongValue(MCtag tag, int valueNo)
long
representation of an attribute's value.
This method can be used to retrieve values of attributes with the following value representation: AT, DS, FD, FL, IS, SL, UL, SS, US, SV and UV.
tag
- The attribute's tag.valueNo
- The zero based index of the value to retrieve.MCexception
- If this attribute set does not contain the requested attribute, if the value number is out of
range or if the value can not be represented as a long.public java.math.BigInteger getBigInteger(int tag, int valueNo)
BigInteger
representation of an attribute's value.
This method can be used to retrieve values of attributes with the following value representation: AT, DS, FD, FL, IS, SL, UL, SS and US, but mostly SV and UV value representation.
tag
- The attribute's tag.valueNo
- The zero based index of the value to retrieve.BigInteger
object representing the attribute's value.MCexception
- If this attribute set does not contain the requested attribute, if the value number is out of
range or if the value can not be represented as a long.public java.math.BigInteger getBigInteger(MCtag tag, int valueNo)
BigInteger
representation of an attribute's value.
This method can be used to retrieve values of attributes with the following value representation: AT, DS, FD, FL, IS, SL, UL, SS and US, but mostly SV and UV value representation.
tag
- The attribute's tag.valueNo
- The zero based index of the value to retrieve.BigInteger
object representing the attribute's value.MCexception
- If this attribute set does not contain the requested attribute, if the value number is out of
range or if the value can not be represented as a long.public float getFloatValue(int tag, int valueNo)
float
representation of an attribute's value.
This method can be used to retrieve values of attributes with the following value representation: AT, DS, FD, FL, IS, SL, UL, SS and US.
tag
- The attribute's tag number.valueNo
- The zero based index of the value to retrieve.MCexception
- If this attribute set does not contain the requested attribute, if the value number is out of
range or if the value can not be represented as a float.public float getFloatValue(MCtag tag, int valueNo)
float
representation of an attribute's value.
This method can be used to retrieve values of attributes with the following value representation: AT, DS, FD, FL, IS, SL, UL, SS and US.
tag
- The attribute's tag.valueNo
- The zero based index of the value to retrieve.MCexception
- If this attribute set does not contain the requested attribute, if the value number is out of
range or if the value can not be represented as a float.public double getDoubleValue(int tag, int valueNo)
double
representation of an attribute's value.
This method can be used to retrieve values of attributes with the following value representation: AT, DS, FD, FL, IS, SL, UL, SS, US, SV and UV.
tag
- The attribute's tag number.valueNo
- The zero based index of the value to retrieve.MCexception
- If this attribute set does not contain the requested attribute, if the value number is out of
range or if the value can not be represented as a double.public double getDoubleValue(MCtag tag, int valueNo)
double
representation of an attribute's value.
This method can be used to retrieve values of attributes with the following value representation: AT, DS, FD, FL, IS, SL, UL, SS, US, SV and UV.
tag
- The attribute's tag.valueNo
- The zero based index of the value to retrieve.MCexception
- If this attribute set does not contain the requested attribute, if the value number is out of
range or if the value can not be represented as a double.public MCitem getItem(int tag, int itemNo)
tag
- The attribute's tag number.itemNo
- The zero based index of the item to retrieve.MCitem
object representing the requested item.MCexception
- If this attribute set does not contain the specified sequence attribute, if the item number
is less than zero or higher than or equal to the number of items, or if the attribute is not a sequence attribute.public MCitem getItem(MCtag tag, int itemNo)
tag
- The attribute's tag.itemNo
- The zero based index of the item to retrieve.MCitem
object representing the requested item.MCexception
- If this attribute set does not contain the specified sequence attribute, if the item number
is less than zero or higher than or equal to the number of items, or if the attribute is not a sequence attribute.public java.lang.Object getValue(int tag, int valueNo, java.lang.Object defaultValue)
This method returns the value in a format appropriate to the attribute's VR. See
getValue(MCtag, int, Object)
for the list of types associated with each VR.
tag
- The attribute's tag number.valueNo
- The zero based index of the value to retrieve.defaultValue
- The value to return if the attribute or the value is missing.defaultValue
if the requested attribute or
value is missing.public java.lang.Object getValue(MCtag tag, int valueNo, java.lang.Object defaultValue)
This method returns the value in a format appropriate to the attribute's VR. The following table lists the type associated with each VR:
tag
- The attribute's tag.valueNo
- The zero based index of the value to retrieve.defaultValue
- The value to return if the attribute or the value is missing.defaultValue
if the requested attribute or
value is missing.MCexception
- If the tag parameter is null
.public java.lang.Object getValue(int tag, int valueNo)
This method returns the value in a format appropriate to the attribute's VR. See
getValue(MCtag, int, Object)
for the list of types associated with each VR.
tag
- The attribute's tag number.valueNo
- The zero based index of the value to retrieve.MCexception
- If this attribute set does not contain the requested attribute
or if the value number is out of range.public java.lang.Object getValue(MCtag tag, int valueNo)
This method returns the value in a format appropriate to the attribute's VR. See
getValue(MCtag, int, Object)
for the list of types associated with each VR.
tag
- The attribute's tag.valueNo
- The zero based index of the value to retrieve.MCexception
- If this attribute set does not contain the requested attribute,
if the value number is out of range or if the tag parameter is null
.public java.lang.Object getValues(int tag)
This method returns an array containing each value of the attribute. The element type of the array depends on the value representation of the attribute as follows:
The length of the returned array is equal to the number of values of the attribute, except for bulk type
attributes (OB, OW, OV, OL, OD, OF, UN) for which the length of the array is equal to the attribute's length. For bulk
attributes the return value is the same as the return value of the getValue(MCtag, int, Object)
method. If the attribute has no values an array of zero length is returned.
Modifying the elements of the returned array has no effect on the attribute's values and each call to this method returns a different array instance.
tag
- The attribute's tag number.MCexception
- If this attribute set does not contain the requested attribute.public java.lang.Object getValues(MCtag tag)
This method returns an array containing each value of the attribute. The element type of the array depends on the
value representation of the attribute as described for the getValues(int)
method.
The length of the returned array is equal to the number of values of the attribute, except for bulk type
attributes (OB, OW, OV, OL, OD, OF, UN) for which the length of the array is equal to the attribute's length. For bulk
attributes the return value is the same as the return value of the getValue(MCtag, int, Object)
method. If the attribute has no values an array of zero length is returned.
Modifying the elements of the returned array has no effect on the attribute's values and each call to this method returns a different array instance.
tag
- The attribute's tag.MCexception
- If this attribute set does not contain the requested attribute or if the tag parameter is
null
.public void getBulkValue(int tag, java.nio.channels.WritableByteChannel destination)
tag
- The attribute's tag number.destination
- A byte channel object that will receive the attribute's value.MCexception
- If this attribute set does not contain the requested attribute, if the attribute is not a bulk
attribute or if the destination parameter is null
.public void getBulkValue(MCtag tag, java.nio.channels.WritableByteChannel destination)
tag
- The attribute's tag.destination
- A byte channel object that will receive the attribute's value.MCexception
- If this attribute set does not contain the requested attribute, if the attribute is not a bulk
attribute or if one of the parameters is null
.public boolean getOffsetTable(java.nio.channels.WritableByteChannel destination)
destination
- A byte channel object that will receive the frame data.true
if operation is completed successfully.MCexception
- If this attribute set has no pixel data or the pixel data doesn't contain
offset table or if the destination parameter is null
public boolean getFrame(java.nio.channels.WritableByteChannel destination, int frame)
destination
- A byte channel object that will receive the frame data.frame
- The number of frame in sequence is requested.true
if operation is completed successfully.MCexception
- If this attribute set has no pixel data or the pixel data doesn't contain
this frame or if the destination parameter is null
public boolean getEncapsulatedFrame(java.nio.channels.WritableByteChannel destination, boolean first)
destination
- A byte channel object that will receive the frame data.first
- Flag indicating whether the first or next frame in sequence is requested.true
if there are more frames of pixel data to be read.MCexception
- If this attribute set has no pixel data or the pixel data is not
encapsulated or if the destination parameter is null
public void addEncapsulatedFrame(java.nio.channels.ReadableByteChannel source, boolean last)
source
- The source of the data. If this parameter is null
no frame is added.last
- Flag indicating whether this is the last frame.MCexception
- If this attribute set is disposed or if the transfer syntax is not compatible
with encapsulated data.public void setDefaultCompression(boolean on)
on
- Flag indicating whether to use default compression/decompressionMCexception
- If the transfer syntax does not comply with default compression/decompression.public void removeAttribute(int tag)
tag
- The attribute's tag number.MCexception
- If this attribute set is disposed.public void removeAttribute(MCtag tag)
tag
- The attribute's tag.MCexception
- If this attribute set is disposed or if the tag is null
.public void addAttribute(MCtag tag)
tag
- The tag of the attribute to add.MCexception
- If the tag parameter is null, if the attribute set is disposed or if
the attribute is already in this attribute set.public void addAttribute(MCtag tag, MCvr vr)
This method is useful for adding attributes with tags that are not defined in the
data dictionary. For other attributes any of the setValue()
or
addValue()
methods will add the attribute if not already present.
tag
- The tag of the attribute to add.vr
- The value representation of the attribute. This parameter must be
null
if the tag is defined in the toolkit's data dictionary.MCexception
- If the tag parameter is null, if the attribute set is disposed or if
the attribute is already in this attribute set.public void setValueRepresentation(MCtag tag, MCvr vr)
This method will attempt to convert the value of the attribute to the proper type. Note that conversions from unknown VR to string types that depend on the specific character set are done using the default DICOM character set.
Valid conversions are: US -> SS, SS -> US, SS -> OW, US -> OW, OW -> US, OW -> SS, OW -> OB, OB -> OW and UN -> Any VR. Bulk attributes (e.g. pixel data) can only be converted between OW and OB but not to SS or US.
tag
- The attribute's tag.vr
- The new value representation of the attribute.MCexception
- If the tag
or vr
parameter is null
, if the attribute
set is disposed, if the attribute is not in this data set or if the conversion is not valid.public void setValueRepresentation(int tag, MCvr vr)
This method may be used, for example, when DICOM allows more than one Value Representation for an attribute, or when a message is received with an attribute whose VR is UN (unknown). The Merge DICOM toolkit uses a default VR for each attribute, as specified in the data dictionary.
This method will attempt to convert the value of the attribute to the proper type. Note that conversions from unknown VR to string types that depend on the specific character set are done using the default DICOM character set.
Valid conversions are: US -> SS, SS -> US, SS -> OW, US -> OW, OW -> US, OW -> SS, OW -> OB, OB -> OW and UN -> Any VR. Bulk attributes (e.g. pixel data) can only be converted between OW and OB but not to SS or US.
tag
- The attribute's tag number.vr
- The new value representation of the attribute.MCexception
- If the vr
parameter is null
, if the attribute
set is disposed, if the attribute is not in this data set or if the conversion is not valid.public void setValue(int tag, java.lang.Object value)
This method replaces any existing value with the value provided. If this attribute set does not have an attribute for the specified tag, the toolkit will add the attribute and set it's first value.
The toolkit will try to convert the value to a type that is appropriate for the value representation of the
attribute as described for the {#link #getValue(MCtag, int, Object)} method. For text type VR's the toolkit
will use the value's toString()
method to obtain the value.
For bulk attributes (OB, OW, OV, OL, OD, OF) the value can be a byte array or a ReadableByteChannel. Encapsulated values can
be set using the addEncapsulatedFrame(java.nio.channels.ReadableByteChannel, boolean)
method.
For sequence attributes the value must be an MCitem
object or an MCitem[] array.
For multi-valued attributes, if the value is an array the toolkit will assign each element of the array as a separate value. It is not acceptable to set multiple values for string type attributes using a single string object that includes the separator character '\'.
If the value is null
the toolkit set the attribute's value to zero length, except when there is a
MCvalueStorage
registered for the attribute's tag, in which case the toolkit will read the value from
the storage when needed (when streaming out).
If the value type is compatible with the attribute's value representation but the value is invalid for the VR
(e.g. it contains invalid characters), the toolkit will accept the value or throw an exception depending on the
flag set by the last MC.setReportInvalidEncoding(boolean)
call.
tag
- The attribute's tag number.value
- The value to set or null
to set the attribute to empty.MCexception
- If the attribute set is disposed, if the tag number is invalid, if the type or the content of
the value is incompatible with the attribute's value representation, if there are too many values set or if the
toolkit fails to store the value (out of memory or temporary file storage problem).public void setValue(MCtag tag, java.lang.Object value)
This method replaces any existing value with the value provided. If this attribute set does not have an attribute for the specified tag, the toolkit will add the attribute and set it's first value.
The toolkit will try to convert the value to a type that is appropriate for the value representation of the
attribute as described for the {#link #getValue(MCtag, int, Object)} method. For text type VR's the toolkit
will use the value's toString()
method to obtain the value.
For bulk attributes (OB, OW, OV, OL, OD, OF) the value can be a byte array or a ReadableByteChannel. Encapsulated values can
be set using the addEncapsulatedFrame(java.nio.channels.ReadableByteChannel, boolean)
method.
For sequence attributes the value must be an MCitem
object or an MCitem
array.
For multi-valued attributes, if the value is an array the toolkit will assign each element of the array as a separate value. It is not acceptable to set multiple values for string type attributes using a single string object that includes the separator character '\'.
If the value is null
the toolkit set the attribute's value to zero length, except when there is a
MCvalueStorage
registered for the attribute's tag, in which case the toolkit will read the value from
the storage when needed (when streaming out).
If the value type is compatible with the attribute's value representation but the value is invalid for the VR
(e.g. it contains invalid characters), the toolkit will accept the value or throw an exception depending on the
flag set by the last MC.setReportInvalidEncoding(boolean)
call.
tag
- The attribute's tag.value
- The value to set or null
to set the attribute to empty.MCexception
- If the attribute set is disposed, if the tag is invalid, if the type or the content of
the value is incompatible with the attribute's value representation, if there are too many values set or if the
toolkit fails to store the value (out of memory or temporary file storage problem).public void addValue(int tag, java.lang.Object value)
This method adds a new value to the list of the attribute's values. If this attribute set does not have an attribute for the specified tag, the toolkit will add the attribute and set it's first value.
The toolkit will try to convert the value to a type that is appropriate for the value representation of the
attribute as described for the {#link #getValue(MCtag, int, Object)} method. For text type VR's the toolkit
will use the value's toString()
method to obtain the value.
This method can not be used to set values for bulk attributes (OB, OW, OV, OL, OD, OF). Use setValue(int, Object)
or addEncapsulatedFrame(java.nio.channels.ReadableByteChannel, boolean)
methods for bulk attributes.
The value can be null
if the attribute's value representation is a multi-valued text VR (AE, AS, CS,
DA, DS, DT, IS, LO, PN, SH, TM, UI), in which case the toolkit adds an empty value.
If the value type is compatible with the attribute's value representation but the value is invalid for the VR
(e.g. it contains invalid characters), the toolkit will accept the value or throw an exception depending on the
flag set by the last MC.setReportInvalidEncoding(boolean)
call.
tag
- The attribute's tag number.value
- The value to add.MCexception
- If the attribute set is disposed, if the tag is invalid, if the type or the content of
the value is incompatible with the attribute's value representation, if there are too many values set or if the
toolkit fails to store the value (out of memory or temporary file storage problem).public void addValue(MCtag tag, java.lang.Object value)
This method adds a new value to the list of the attribute's values. If this attribute set doe not have an attribute for the specified tag, the toolkit will add the attribute and set it's first value.
The toolkit will try to convert the value to a type that is appropriate for the value representation of the
attribute as described for the {#link #getValue(MCtag, int, Object)} method. For text type VR's the toolkit
will use the value's toString()
method to obtain the value.
This method can not be used to set values for bulk attributes (OB, OW, OV, OL, OD, OF). Use setValue(int, Object)
or addEncapsulatedFrame(java.nio.channels.ReadableByteChannel, boolean)
methods for bulk attributes.
The value can be null
if the attribute's value representation is a multi-valued text VR (AE, AS, CS,
DA, DS, DT, IS, LO, PN, SH, TM, UI), in which case the toolkit adds an empty value.
If the value type is compatible with the attribute's value representation but the value is invalid for the VR
(e.g. it contains invalid characters), the toolkit will accept the value or throw an exception depending on the
flag set by the last MC.setReportInvalidEncoding(boolean)
call.
tag
- The attribute's tag.value
- The value to add.MCexception
- If the attribute set is disposed, if the tag is invalid, if the type or the content of
the value is incompatible with the attribute's value representation, if there are too many values set or if the
toolkit fails to store the value (out of memory or temporary file storage problem).public void copyTo(MCattributeSet destination)
destination
- The attribute set to copy into.MCexception
- If the destination parameter is invalid, if this attribute set is disposed or if the
toolkit fails to store a value (out of memory or temporary file storage problem).public void writeToStream(MCtransferSyntax ts, java.nio.channels.WritableByteChannel destination)
If this attribute set is a DICOM file object the preamble and the DICM prefix is not included in the
stream and the output is not a valid DICOM media file. To generate a valid DICOM media file use
MCfile.writeP10File(WritableByteChannel)
method.
ts
- The transfer syntax for the encoding. If this parameter is null
the toolkit uses
the transfer syntax of this attribute set.destination
- The byte channel receiving the encoded stream.MCexception
- null
.
public void writeToStream(int fromTag, int toTag, MCtransferSyntax ts, java.nio.channels.WritableByteChannel destination)
This method encodes the attributes that have tag numbers between the specified values inclusively. The
toolkit interprets the two tag number parameters as unsigned integers so that negative values represent
values beyond Integer.MAX_VALUE
. E.g. -327686 (0xFFFAFFFA) represents the tag (FFFA,FFFA).
If this attribute set is a DICOM file object the preamble and the DICM prefix is not included in the
stream and the output is not a valid DICOM media file. To generate a valid DICOM media file use
MCfile.writeP10File(WritableByteChannel)
method.
fromTag
- The tag number identifying the first attribute to be streamed.toTag
- The tag number identifying the last attribute to be streamed.ts
- The transfer syntax for the encoding. If this parameter is null
the toolkit uses
the transfer syntax of this attribute set.destination
- The byte channel receiving the encoded stream.MCexception
- null
.
public long readFromStream(MCtransferSyntax ts, java.nio.channels.ReadableByteChannel source)
ts
- The transfer Syntax of the encoded stream or null
if the stream is encoded in
Little Endian Explicit transfer syntax.source
- The byte channel that provides the encoded byte stream.MCexception
- public long readFromStream(int fromTag, int toTag, MCtransferSyntax ts, java.nio.channels.ReadableByteChannel source)
This method decodes the attributes that have tag numbers between the specified values inclusively. The
toolkit interprets the two tag number parameters as unsigned integers so that negative values represent
values beyond Integer.MAX_VALUE
. E.g. -327686 (0xFFFAFFFA) represents the tag (FFFA,FFFA).
fromTag
- The minimum value of the attribute's tag number to decode. Attributes with tag number less
than this value will be ignored during the encoding.toTag
- The maximum value of the attribute's tag number to decode. The decoding will stop at the first
attribute with tag number greater than this value.ts
- The transfer Syntax of the encoded stream or null
if the stream is encoded in
Little Endian Explicit transfer syntax.source
- The byte channel that provides the encoded byte stream.toTag
.MCexception
- null
.
public MCvalidationError validate(MCvalidationLevel level)
This method validates this attribute set to determine that required attributes are present and that all attribute values are valid. The attribute set is validated to insure that it meets the requirements of the associated service and command.
If this method detects DICOM violations it returns an MCvalidationError
object describing the first
violation. Subsequent violations can be retrieved using getNextValidationError()
method.
The toolkit validates the attribute set based on message definitions obtained from the its DICOM database files (mrgcom3.dct and mrgcom3.dcm). This database is provided with the toolkit and it is updated with each version of the toolkit to reflect the latest changes and additions to the DICOM standard. Documentation on how the database can be amended is provided in the Message Database Manual (database.pdf).
Note that in case of some 1C or 2C attributes, the condition can not be verified by the toolkit, in such cases the toolkit will consider the attribute of type 3.
See Validating Attribute Sets topic for more details on the validation process.
level
- The level of validation.MCvalidationError
object representing the first validation error encountered or
null
if the attribute set has no DICOM violations.MCexception
- If this attribute set is disposed, if the level argument is null, if the toolkit fails
to read validation information from the database or if a system error occurs (e.g. unmanaged memory
allocation failure).public MCvalidationError getNextValidationError()
This method may be called only after a call to validate(MCvalidationLevel)
returned a
non null
value.
The application can use this method in a loop to retrieve all validation errors.
null
if there are no more validation errors.MCexception
- If this attribute set is disposed.public MCvalidationError validateAttribute(int tag, MCvalidationLevel level)
This method validates the value of the attribute to determine that it meets the requirements of the associated service and command.
If this method detects DICOM violations it returns an MCvalidationError
object describing the first
violation. Subsequent violations can be retrieved using getNextValidationError()
method.
The toolkit validates the attribute set based on message definitions obtained from the its DICOM database files (mrgcom3.dct and mrgcom3.dcm). This database is provided with the toolkit and it is updated with each version of the toolkit to reflect the latest changes and additions to the DICOM standard. Documentation on how the database can be amended is provided in the Message Database Manual (database.pdf).
tag
- The tag number of the attribute to validate.level
- The level of validation.MCvalidationError
object representing the first validation error encountered or
null
if the attribute's value conforms to DICOM.MCexception
- If this attribute set is disposed, if the level argument is null, if the toolkit fails
to read validation information from the database or if a system error occurs (e.g. unmanaged memory
allocation failure).public java.lang.String getSOPInstanceUID()
This is a convenience method that provides easy access to the SOP Instance UID of the
DICOM instance in this attribute set. This method is equivalent with the following call:
getStringValue(MCdicom.SOP_INSTANCE_UID, 0, null)
.
public java.lang.String getSOPClassUID()
This is a convenience method that provides easy access to the SOP Class UID of the
DICOM instance in this attribute set. This method is equivalent with the following call:
getStringValue(MCdicom.SOP_CLASS_UID, 0, null)
.
public java.lang.String getModality()
This is a convenience method that provides easy access to the Modality value of the
DICOM instance in this attribute set. This method is equivalent with the following call:
getStringValue(MCdicom.MODALITY, 0, null)
.
null
if
the Modality attribute is missing or it has no values.public MCattributeSet duplicate(MCtransferSyntax resultSyntax)
resultSyntax
- The transfer syntax of the newly created message or file objectMCexception
- If the type of the MCAttributeSet is not one of file or messagepublic void readFromXML(java.io.Reader reader) throws java.io.IOException
reader
- The source (java.io.Reader) to read the XML attributes from.java.io.IOException
- if an error occurred while parsing the XMLpublic void readFromXML(java.io.InputStream stream) throws java.io.IOException
stream
- The source (java.io.InputStream) to read the XML attributes from.java.io.IOException
- if an error occurred while parsing the XMLpublic void readFromXMLNative(java.io.InputStream stream) throws java.io.IOException
MCattributeSet
.stream
- The source (java.io.InputStream) to read the XML attributes from.java.io.IOException
- if an error occurred while parsing the XML.public void readFromXMLNative(java.io.InputStream stream, MCbulkDataUriProvider provider) throws java.io.IOException
MCattributeSet
.stream
- The source (java.io.InputStream) to read the XML attributes from.provider
- An implementation of MCbulkDataUri interface that can handle reading of BulkDataURI from the XML stream.
When an attribute contains BulkDataURI, the MCbulkDataUriProvider.provideData method will be called.java.io.IOException
- if an error occurred while parsing the XMLpublic static MCattributeSet[] readAttributeSetsFromJSON(java.io.InputStream stream) throws java.io.IOException
MCattributeSet
.stream
- The source (java.io.InputStream) to read the JSON attributes from.MCattributeSet
java.io.IOException
- if an error occurred while parsing the JSON data setpublic static MCattributeSet[] readAttributeSetsFromJSON(java.io.InputStream stream, MCbulkDataUriProvider provider) throws java.io.IOException
MCattributeSet
.stream
- The source (java.io.InputStream) to read the JSON attributes from.provider
- An implementation of MCbulkDataUriProvider
interface that can handle reading
of BulkDataURI from the JSON stream. When an attribute contains BulkDataURI,
the MCbulkDataUriProvider.provideData(com.merge.mcw.MCattributeSet, int, com.merge.mcw.MCvr, java.lang.String)
method will be called.MCattributeSet
java.io.IOException
- if an error occurred while parsing the JSON data setpublic void readFromJSON(java.io.InputStream stream) throws java.io.IOException
MCattributeSet
.stream
- The source (java.io.InputStream) to read the JSON attributes from.java.io.IOException
- if an error occurred while parsing the JSON data setpublic void readFromJSON(java.io.InputStream stream, MCbulkDataUriProvider provider) throws java.io.IOException
MCattributeSet
.stream
- The source (java.io.InputStream) to read the XML attributes from.provider
- An implementation of MCbulkDataUri interface that can handle reading of BulkDataURI from the JSON stream.
When an attribute contains BulkDataURI, the MCbulkDataUriProvider.provideData method will be called.java.io.IOException
- if an error occurred while parsing the JSON data setpublic void writeToXML(java.io.Writer destination, int xmlOptions) throws java.io.IOException
destination
- The destination (java.io.Writer) to write the XML attributes representation to.xmlOptions
- The XML configuration options.java.io.IOException
- If an I/O error occurspublic void writeToXML(java.io.OutputStream destination, int xmlOptions) throws java.io.IOException
destination
- The output stream (java.io.OutputStream) to write the XML attributes representation to.xmlOptions
- The XML configuration options.java.io.IOException
- If an I/O error occurspublic void writeToXMLNative(java.io.OutputStream stream, int xmlOptions, MCbulkDataUriProvider provider) throws java.io.IOException
MCattributeSet
into its XML representation (Native DICOM Model schema PS3.19).stream
- The output stream (java.io.OutputStream) to write the XML attributes representation to.xmlOptions
- The XML configuration options.provider
- implementation to handle writing BulkDataURI
during generation of XML stream. When set to null, all bulk attributes will be send as actual value.
MCbulkDataUriHandler.provideUri method will only be called if vr is one of:
FL, FD, IS, LT, OB, OW, OV, OL, OD, OF, SL, SS, ST, UL, UN, US, or UT.java.io.IOException
- If an I/O error occurspublic void writeToJSON(java.io.OutputStream stream, int xmlOptions, MCbulkDataUriProvider provider) throws java.io.IOException
MCattributeSet
into its JSON representation (DICOM JSON Model PS3.19 F).stream
- The output stream (java.io.OutputStream) to write the JSON attributes representation to.xmlOptions
- The XML configuration options.provider
- implementation to handle writing BulkDataURI
during generation of XML stream. When set to null, all bulk attributes will be send as actual value.
MCbulkDataUriHandler.provideUri method will only be called if vr is one of:
FL, FD, IS, LT, OB, OW, OV, OL, OD, OF, SL, SS, ST, UL, UN, US, or UT.java.io.IOException
- If an I/O error occurspublic static void writeAttributeSetsToJSON(MCattributeSet[] attributeSets, java.io.OutputStream stream, int xmlOptions, MCbulkDataUriProvider provider) throws java.io.IOException
attributeSets
- An array of MCattributeSet
stream
- The output stream (java.io.OutputStream) to write the JSON attributes representation to.xmlOptions
- The XML configuration options.provider
- implementation to handle writing BulkDataURI
during generation of XML stream. When set to null, all bulk attributes will be send as actual value.
MCbulkDataUriHandler.provideUri method will only be called if vr is one of:
FL, FD, IS, LT, OB, OW, OV, OL, OD, SL, SS, ST, UL, UN, US, or UT.java.io.IOException
- If an I/O error occurs