Class OtherByteAttributeOnDisk

    • Constructor Detail

      • OtherByteAttributeOnDisk

        public OtherByteAttributeOnDisk​(AttributeTag t)

        Construct an (empty) attribute.

        Parameters:
        t - the tag of the attribute
      • OtherByteAttributeOnDisk

        public OtherByteAttributeOnDisk​(AttributeTag t,
                                        long vl,
                                        DicomInputStream i,
                                        long byteOffset)
                                 throws java.io.IOException,
                                        DicomException

        Read an attribute from an input stream.

        Parameters:
        t - the tag of the attribute
        vl - the value length of the attribute
        i - the input stream
        byteOffset - the byte offset in the input stream of the start of the data
        Throws:
        java.io.IOException
        DicomException
      • OtherByteAttributeOnDisk

        public OtherByteAttributeOnDisk​(AttributeTag t,
                                        java.lang.Long vl,
                                        DicomInputStream i,
                                        java.lang.Long byteOffset)
                                 throws java.io.IOException,
                                        DicomException

        Read an attribute from an input stream.

        Parameters:
        t - the tag of the attribute
        vl - the value length of the attribute
        i - the input stream
        byteOffset - the byte offset in the input stream of the start of the data
        Throws:
        java.io.IOException
        DicomException
    • Method Detail

      • getPaddedVL

        public long getPaddedVL()
        Description copied from class: Attribute

        Get the value length of this attribute, accounting for the need for even-length padding.

        Overrides:
        getPaddedVL in class Attribute
        Returns:
        the value length (padded to an even length)
      • getByteValues

        public byte[] getByteValues()
                             throws DicomException

        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 MappedByteBuffer from the file, or more likely is not even aware that the attribute values have been left on disk, because AttributeFactory silently created an instance of this class rather than an in-memory OtherByteAttribute.

        Overrides:
        getByteValues in class Attribute
        Returns:
        the values as an array of bytes
        Throws:
        DicomException - thrown if values cannot be read
      • getByteValuesPerFrame

        public byte[][] getByteValuesPerFrame​(int numberOfFrames)
                                       throws DicomException

        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 MappedByteBuffer 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
      • 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 MappedByteBuffer from the file, or more likely is not even aware that the attribute values have been left on disk, because AttributeFactory silently created an instance of this class rather than an in-memory OtherByteAttribute.

        Parameters:
        frameNumber - from 0
        numberOfFrames - 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:
        getVR in class Attribute
        Returns:
        'O','B' in ASCII as a two byte array; see ValueRepresentation