Class OtherWordAttributeOnDisk
A concrete class specializing Attribute
for
Other Word (OW) 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
.
- See Also:
-
Field Summary
FieldsFields inherited from class com.pixelmed.dicom.OtherAttributeOnDisk
byteOffset, deleteFilesWhenNoLongerNeeded, file
Fields inherited from class com.pixelmed.dicom.Attribute
valueLength, valueMultiplicity
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct an (empty) attribute.OtherWordAttributeOnDisk
(AttributeTag t, boolean bigEndian) Construct an (empty) attribute.OtherWordAttributeOnDisk
(AttributeTag t, long vl, DicomInputStream i, long byteOffset) Read an attribute from an input stream.OtherWordAttributeOnDisk
(AttributeTag t, Long vl, DicomInputStream i, Long byteOffset) Read an attribute from an input stream. -
Method Summary
Modifier and TypeMethodDescriptionshort[]
Get the values of this attribute as a short array.short[]
getShortValuesForSelectedFrame
(int frameNumber, int numberOfFrames) Get the value of this attribute as a short array for one selected frame.short[][]
getShortValuesPerFrame
(int numberOfFrames) Get the values of this attribute as multiple short arrays, one per frame.byte[]
getVR()
Get the value representation of this attribute (OW).boolean
Is the data on disk byte order big endian ?void
Write the entire attribute (including values) to the output stream.Methods inherited from class com.pixelmed.dicom.OtherAttributeOnDisk
deleteFilesWhenNoLongerNeeded, finalize, getByteOffset, getFile, removeValues, setFile, setFile, toString
Methods inherited from class com.pixelmed.dicom.Attribute
addValue, addValue, addValue, addValue, addValue, addValue, addValue, getByteValues, 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, getLengthOfEncodedValue, getLongValues, getLongValues, getLongValues, getOriginalStringValues, getPaddedVL, 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
-
Field Details
-
bigEndian
protected boolean bigEndian
-
-
Constructor Details
-
OtherWordAttributeOnDisk
Construct an (empty) attribute.
Any file set later will be expected to be little endian.- Parameters:
t
- the tag of the attribute
-
OtherWordAttributeOnDisk
Construct an (empty) attribute.
Any file set later will be expected to be in the specified byte order.- Parameters:
t
- the tag of the attributebigEndian
- big endian, false if little endian
-
OtherWordAttributeOnDisk
public OtherWordAttributeOnDisk(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:
IOException
DicomException
-
OtherWordAttributeOnDisk
public OtherWordAttributeOnDisk(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:
IOException
DicomException
-
-
Method Details
-
write
Description copied from class:Attribute
Write the entire attribute (including values) to the output stream.
- Specified by:
write
in classAttribute
- Parameters:
o
-- Throws:
IOException
DicomException
-
isBigEndian
public boolean isBigEndian()Is the data on disk byte order big endian ?
- Returns:
- true if big endian, false if little endian
-
getShortValues
Get the values of this attribute as a short 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
MappedByteBuffer
from which to get aShortBuffer
from the file, or more likely is not even aware that the attribute values have been left on disk, becauseAttributeFactory
silently created an instance of this class rather than an in-memoryOtherWordAttribute
.- Overrides:
getShortValues
in classAttribute
- Returns:
- the values as an array of short
- Throws:
DicomException
- thrown if values cannot be read
-
getShortValuesPerFrame
Get the values of this attribute as multiple short 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
MappedByteBuffer
from which to get aShortBuffer
from 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
-
getShortValuesForSelectedFrame
public short[] getShortValuesForSelectedFrame(int frameNumber, int numberOfFrames) throws DicomException Get the value of this attribute as a short 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
MappedByteBuffer
from which to get aShortBuffer
from the file, or more likely is not even aware that the attribute values have been left on disk, becauseAttributeFactory
silently created an instance of this class rather than an in-memoryOtherWordAttribute
.- Parameters:
frameNumber
- from 0numberOfFrames
- the number of frames- Returns:
- the values as an array of short
- Throws:
DicomException
- thrown if values cannot be read
-
getVR
public byte[] getVR()Get the value representation of this attribute (OW).
- Overrides:
getVR
in classAttribute
- Returns:
- 'O','W' in ASCII as a two byte array; see
ValueRepresentation
-