frame

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 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)
	// IsEncapsulated 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)

GetEncapsulatedFrame returns an EncapsulatedFrame from this frame.

func (*EncapsulatedFrame) GetImage

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

GetImage returns a Go image.Image from the underlying frame.

func (*EncapsulatedFrame) GetNativeFrame

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

GetNativeFrame returns ErrorFrameTypeNotPresent, because this struct does not hold a NativeFrame.

func (*EncapsulatedFrame) IsEncapsulated

func (e *EncapsulatedFrame) IsEncapsulated() bool

IsEncapsulated indicates if the frame is encapsulated or not.

type Frame

type Frame struct {
	// Encapsulated indicates whether the underlying frame is encapsulated or
	// not.
	Encapsulated bool
	// EncapsulatedData holds the encapsulated data for this frame if
	// Encapsulated is set to true.
	EncapsulatedData EncapsulatedFrame
	// NativeData holds the native data for this frame if Encapsulated is set
	// to false.
	NativeData NativeFrame
}

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)

GetEncapsulatedFrame returns an EncapsulatedFrame from this frame. If the underlying frame is not an EncapsulatedFrame, ErrorFrameTypeNotPresent will be returned.

func (*Frame) GetImage

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

GetImage returns a Go image.Image from the underlying frame, regardless of the frame type.

func (*Frame) GetNativeFrame

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

GetNativeFrame returns a NativeFrame from this frame. If the underlying frame is not a NativeFrame, ErrorFrameTypeNotPresent will be returned.

func (*Frame) IsEncapsulated

func (f *Frame) IsEncapsulated() bool

IsEncapsulated indicates if the frame is encapsulated or not.

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)

GetEncapsulatedFrame returns ErrorFrameTypeNotPresent, because this struct does not hold encapsulated frame data.

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)

GetNativeFrame returns a NativeFrame from this frame. If the underlying frame is not a NativeFrame, ErrorFrameTypeNotPresent will be returned.

func (*NativeFrame) IsEncapsulated

func (n *NativeFrame) IsEncapsulated() bool

IsEncapsulated indicates if the frame is encapsulated or not.

Jump to

Keyboard shortcuts

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