frame

package
v0.4.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorFrameTypeNotPresent = errors.New("The frame type you requested is not present in this CommonFrame")

ErrorFrameTypeNotPresent is returned when the user asked to Get an underlying GetNativeFrame or GetEncapsulatedFrame that is not contained in that particular CommonFrame.

Functions

This section is empty.

Types

type CommonFrame

type CommonFrame interface {
	// GetImage gets this frame as an image.Image. Beware that the underlying frame may perform
	// some default rendering and conversions. Operate on the raw NativeFrame or EncapsulatedFrame
	// if you need to do some custom rendering work or want the data from the dicom.
	GetImage() (image.Image, error)
	// Encapsulated indicates if the underlying Frame is an EncapsulatedFrame
	IsEncapsulated() bool
	// GetNativeFrame attempts to get the underlying NativeFrame (or returns an error)
	GetNativeFrame() (*NativeFrame, error)
	// GetEncapsulatedFrame attempts to get the underlying EncapsulatedFrame (or returns an error)
	GetEncapsulatedFrame() (*EncapsulatedFrame, error)
}

CommonFrame represents a harmonized DICOM Frame with a consistent interface (harmonized across Native and Encapsulated frames), however users still have the ability to fetch underlying Native or Encapsulated frame constructs.

type EncapsulatedFrame

type EncapsulatedFrame struct {
	// Data is a collection of bytes representing a JPEG encoded image frame
	Data []byte
}

EncapsulatedFrame represents an encapsulated image frame

func (*EncapsulatedFrame) GetEncapsulatedFrame

func (e *EncapsulatedFrame) GetEncapsulatedFrame() (*EncapsulatedFrame, error)

func (*EncapsulatedFrame) GetImage

func (e *EncapsulatedFrame) GetImage() (image.Image, error)

func (*EncapsulatedFrame) GetNativeFrame

func (e *EncapsulatedFrame) GetNativeFrame() (*NativeFrame, error)

func (*EncapsulatedFrame) IsEncapsulated

func (e *EncapsulatedFrame) IsEncapsulated() bool

type Frame

type Frame struct {
	Encapsulated     bool
	EncapsulatedData EncapsulatedFrame
	NativeData       NativeFrame
	FileOffset       int64
	SizeInBytes      int
}

Frame wraps a single encapsulated or native image frame TODO: deprecate this old intermediate representation in favor of CommonFrame once happy and solid with API

func (*Frame) GetEncapsulatedFrame

func (f *Frame) GetEncapsulatedFrame() (*EncapsulatedFrame, error)

func (*Frame) GetImage

func (f *Frame) GetImage() (image.Image, error)

func (*Frame) GetNativeFrame

func (f *Frame) GetNativeFrame() (*NativeFrame, error)

func (*Frame) IsEncapsulated

func (f *Frame) IsEncapsulated() bool

type NativeFrame

type NativeFrame struct {
	// Data is a slice of pixels, where each pixel can have multiple values
	Data          [][]int
	Rows          int
	Cols          int
	BitsPerSample int
}

NativeFrame represents a native image frame

func (*NativeFrame) GetEncapsulatedFrame

func (n *NativeFrame) GetEncapsulatedFrame() (*EncapsulatedFrame, error)

func (*NativeFrame) GetImage

func (n *NativeFrame) GetImage() (image.Image, error)

GetImage returns an image.Image representation the frame, using default processing. This default processing is basic at the moment, and does not autoscale pixel values or use window width or level info.

func (*NativeFrame) GetNativeFrame

func (n *NativeFrame) GetNativeFrame() (*NativeFrame, error)

func (*NativeFrame) IsEncapsulated

func (n *NativeFrame) IsEncapsulated() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL