Documentation
¶
Overview ¶
Package pixels decodes DICOM native and encapsulated pixel data.
Index ¶
- func DecodeAllFrames(fd FileSource, opts ...DecodeOption) ([]byte, error)
- func DecodeFrame(frame []byte, desc Descriptor, opts DecodeOptions) ([]byte, error)
- func DecodePixelData(fd FileSource, opts ...DecodeOption) ([][]byte, error)
- type DatasetSource
- type DecodeOption
- type DecodeOptions
- type Descriptor
- type ExtendedOffsets
- type FileSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeAllFrames ¶
func DecodeAllFrames(fd FileSource, opts ...DecodeOption) ([]byte, error)
DecodeAllFrames concatenates decoded frames into one buffer (native layout per frame).
func DecodeFrame ¶
func DecodeFrame(frame []byte, desc Descriptor, opts DecodeOptions) ([]byte, error)
DecodeFrame decodes a single encapsulated frame's compressed bytes.
func DecodePixelData ¶
func DecodePixelData(fd FileSource, opts ...DecodeOption) ([][]byte, error)
DecodePixelData decodes all (or selected) frames from a file dataset.
Types ¶
type DatasetSource ¶
type DatasetSource interface {
GetBytes(tag.Tag) ([]byte, bool)
GetInt(tag.Tag) (int, bool)
GetString(tag.Tag) (string, bool)
}
DatasetSource provides dataset element access for pixel decode.
type DecodeOption ¶
type DecodeOption func(*DecodeOptions)
DecodeOption configures DecodeOptions.
func WithFrameIndex ¶
func WithFrameIndex(index int) DecodeOption
WithFrameIndex limits decoding to a single frame index (0-based).
func WithRaw ¶
func WithRaw(raw bool) DecodeOption
WithRaw sets whether to return raw decoded bytes without colour transforms.
type DecodeOptions ¶
type DecodeOptions struct {
// Raw skips photometric colour transforms (library v2 / raw decode path).
Raw bool
// FrameIndex selects a single frame; nil decodes all frames.
FrameIndex *int
}
DecodeOptions configures pixel data decoding.
type Descriptor ¶
type Descriptor struct {
TransferSyntaxUID uid.UID
Rows int
Columns int
SamplesPerPixel int
BitsAllocated int
BitsStored int
PixelRepresentation int
NumberOfFrames int
PhotometricInterpretation string
PlanarConfiguration int
ExtendedOffsets *ExtendedOffsets
}
Descriptor holds image-related dataset attributes needed for pixel decode.
func DescriptorFromDataset ¶
func DescriptorFromDataset(ds DatasetSource, ts uid.UID) (Descriptor, error)
DescriptorFromDataset builds a Descriptor using an explicit transfer syntax UID.
func DescriptorFromFile ¶
func DescriptorFromFile(fd FileSource) (Descriptor, error)
DescriptorFromFile builds a Descriptor from a file dataset source.
func (Descriptor) BytesPerSample ¶
func (d Descriptor) BytesPerSample() int
BytesPerSample returns bytes per sample (1 for BitsAllocated 1).
func (Descriptor) UnpackedFrameBytes ¶
func (d Descriptor) UnpackedFrameBytes() int
UnpackedFrameBytes returns decoded frame size in bytes for one frame.
type ExtendedOffsets ¶
ExtendedOffsets holds optional extended offset table tags.
type FileSource ¶
type FileSource interface {
DatasetSource
TransferSyntaxUID() (string, bool)
}
FileSource is a DICOM file dataset with file meta transfer syntax.