Class OtherByteAttributeOnDisk
A concrete class specializing Attribute for
Other Byte (OB) attributes whose values are not memory resident.
Though an instance of this class may be created
using its constructors, there is also a factory class, AttributeFactory.
-
Field Summary
Fields inherited from class com.pixelmed.dicom.OtherAttributeOnDisk
byteOffset, deleteFilesWhenNoLongerNeeded, fileFields inherited from class com.pixelmed.dicom.Attribute
valueLength, valueMultiplicity -
Constructor Summary
ConstructorsConstructorDescriptionConstruct an (empty) attribute.OtherByteAttributeOnDisk(AttributeTag t, long vl, DicomInputStream i, long byteOffset) Read an attribute from an input stream.OtherByteAttributeOnDisk(AttributeTag t, Long vl, DicomInputStream i, Long byteOffset) Read an attribute from an input stream. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Get the values of this attribute as a byte array.byte[]getByteValuesForSelectedFrame(int frameNumber, int numberOfFrames) Get the value of this attribute as a byte array for one selected frame.byte[][]getByteValuesPerFrame(int numberOfFrames) Get the values of this attribute as multiple byte arrays, one per frame.longGet the value length of this attribute, accounting for the need for even-length padding.byte[]getVR()Get the value representation of this attribute (OB).voidWrite the entire attribute (including values) to the output stream.Methods inherited from class com.pixelmed.dicom.OtherAttributeOnDisk
deleteFilesWhenNoLongerNeeded, finalize, getByteOffset, getFile, removeValues, setFile, setFile, toStringMethods inherited from class com.pixelmed.dicom.Attribute
addValue, addValue, addValue, addValue, addValue, addValue, addValue, getByteValues, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDoubleValues, getDoubleValues, getDoubleValues, getElement, getFloatValues, getFloatValues, getFloatValues, getGroup, getIntegerValues, getIntegerValues, getIntegerValues, getLengthOfBaseOfEncodedAttribute, getLengthOfEncodedValue, getLengthOfEntireEncodedAttribute, getLongValues, getLongValues, getLongValues, getOriginalStringValues, getShortValues, getSingleDoubleValueOrDefault, getSingleDoubleValueOrDefault, getSingleDoubleValueOrDefault, getSingleFloatValueOrDefault, getSingleFloatValueOrDefault, getSingleFloatValueOrDefault, getSingleIntegerValueOrDefault, getSingleIntegerValueOrDefault, getSingleIntegerValueOrDefault, getSingleLongValueOrDefault, getSingleLongValueOrDefault, getSingleLongValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrNull, getSingleStringValueOrNull, getSingleStringValueOrNull, getSingleStringValueOrNull, getSingleStringValueOrNull, getSingleStringValueOrNull, getStringValues, getStringValues, getStringValues, getStringValues, getStringValues, getStringValues, getTag, getVL, getVM, getVRAsString, isValid, repairValues, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValues, setValues, setValues, setValues, setValues, setValues, setValues, toString, writeBase
-
Constructor Details
-
OtherByteAttributeOnDisk
Construct an (empty) attribute.
- Parameters:
t- the tag of the attribute
-
OtherByteAttributeOnDisk
public OtherByteAttributeOnDisk(AttributeTag t, long vl, DicomInputStream i, long byteOffset) throws IOException, DicomException Read an attribute from an input stream.
- Parameters:
t- the tag of the attributevl- the value length of the attributei- the input streambyteOffset- the byte offset in the input stream of the start of the data- Throws:
IOExceptionDicomException
-
OtherByteAttributeOnDisk
public OtherByteAttributeOnDisk(AttributeTag t, Long vl, DicomInputStream i, Long byteOffset) throws IOException, DicomException Read an attribute from an input stream.
- Parameters:
t- the tag of the attributevl- the value length of the attributei- the input streambyteOffset- the byte offset in the input stream of the start of the data- Throws:
IOExceptionDicomException
-
-
Method Details
-
getPaddedVL
public long getPaddedVL()Description copied from class:AttributeGet the value length of this attribute, accounting for the need for even-length padding.
- Overrides:
getPaddedVLin classAttribute- Returns:
- the value length (padded to an even length)
-
write
Description copied from class:AttributeWrite the entire attribute (including values) to the output stream.
- Specified by:
writein classAttribute- Parameters:
o-- Throws:
IOExceptionDicomException
-
getByteValues
Get the values of this attribute as a byte array.
This allocates a new array of sufficient length, which may fail if it is too large, and defeats the point of leaving the values on disk in the first place. However, it is a fallback for when the caller does not want to go to the trouble of creating a
MappedByteBufferfrom the file, or more likely is not even aware that the attribute values have been left on disk, becauseAttributeFactorysilently created an instance of this class rather than an in-memoryOtherByteAttribute.- Overrides:
getByteValuesin classAttribute- Returns:
- the values as an array of bytes
- Throws:
DicomException- thrown if values cannot be read
-
getByteValuesPerFrame
Get the values of this attribute as multiple byte arrays, one per frame.
Caller needs to supply the number for frames so that pixel data can be split across per-frame arrays (since not necessarily known when this attribute was created or read.
This allocates new arrays of sufficient length, which may fail if they are too large, and defeats the point of leaving the values on disk in the first place. However, it is a fallback for when the caller does not want to go to the trouble of creating a
MappedByteBufferfrom the file, or more likely is not even aware that the attribute values have been left on disk.- Parameters:
numberOfFrames- the number of frames- Returns:
- the values as an array of arrays of bytes
- Throws:
DicomException- thrown if values cannot be read
-
getByteValuesForSelectedFrame
public byte[] getByteValuesForSelectedFrame(int frameNumber, int numberOfFrames) throws DicomException Get the value of this attribute as a byte array for one selected frame.
This allocates a new array of sufficient length, which may fail if it is too large, and defeats the point of leaving the values on disk in the first place. However, it is a fallback for when the caller does not want to go to the trouble of creating a
MappedByteBufferfrom the file, or more likely is not even aware that the attribute values have been left on disk, becauseAttributeFactorysilently created an instance of this class rather than an in-memoryOtherByteAttribute.- Parameters:
frameNumber- from 0numberOfFrames- the number of frames- Returns:
- the values as an array of bytes
- Throws:
DicomException- thrown if values cannot be read
-
getVR
public byte[] getVR()Get the value representation of this attribute (OB).
- Overrides:
getVRin classAttribute- Returns:
- 'O','B' in ASCII as a two byte array; see
ValueRepresentation
-