Documentation
¶
Index ¶
- Constants
- func DecodePixelData(src []byte, opts PixelDataOptions) ([]byte, error)
- func Encode(src []byte, opts EncodeOptions) ([]byte, error)
- func EncodePixelData(src []byte, opts PixelDataOptions, frame EncodeOptions) ([]byte, error)
- func OpenJPEGVersion() (string, error)
- func ReadStream(stream any) ([]byte, error)
- type Codec
- type EncodeOptions
- type Image
- type Params
- type PixelDataOptions
- type PixelDataVersion
Constants ¶
const ( ColourUnspecified = 0 ColourSRGB = 1 ColourGray = 2 ColourSYCC = 3 ColourEYCC = 4 ColourCMYK = 5 )
Colour spaces matching OpenJPEG OPJ_COLOR_SPACE.
Variables ¶
This section is empty.
Functions ¶
func DecodePixelData ¶
func DecodePixelData(src []byte, opts PixelDataOptions) ([]byte, error)
DecodePixelData decodes encapsulated JPEG 2000 pixel data for DICOM. Version 2 returns raw decoded bytes; version 1 matches pylibjpeg v1 behaviour.
func Encode ¶ added in v1.1.0
func Encode(src []byte, opts EncodeOptions) ([]byte, error)
Encode encodes little-endian colour-by-pixel samples to JPEG 2000.
func EncodePixelData ¶ added in v1.1.0
func EncodePixelData(src []byte, opts PixelDataOptions, frame EncodeOptions) ([]byte, error)
EncodePixelData encodes a single DICOM frame for JPEG 2000 transfer syntaxes.
func OpenJPEGVersion ¶
OpenJPEGVersion returns the linked openjpeg library version.
func ReadStream ¶
ReadStream reads JPEG 2000 data from bytes, a file path, or an io.Reader.
Types ¶
type Codec ¶
type Codec int
Codec selects the JPEG 2000 container format (pylibjpeg-openjpeg codec argument).
type EncodeOptions ¶ added in v1.1.0
type EncodeOptions struct {
Columns int
Rows int
SamplesPerPixel int
BitsStored int
IsSigned bool
ColourSpace int
UseMCT bool
Codec Codec
// CompressionRatios empty => lossless (DWT 5-3).
CompressionRatios []float64
}
EncodeOptions configures Encode / EncodePixelData.
type Image ¶
type Image struct {
Pixels []byte
Width int
Height int
Components int
Precision int
IsSigned bool
ColourSpace int
}
Image holds decoded pixel data in native precision, planar-interleaved (DICOM order).
func DecodeImage ¶
DecodeImage decodes JPEG 2000 data (pylibjpeg-openjpeg decode()).
func (*Image) BytesPerSample ¶
type Params ¶
type Params struct {
Width int
Height int
Components int
Precision int
IsSigned bool
ColourSpace int
}
Params holds JPEG 2000 image parameters without decoding pixels.
func GetImageParameters ¶
GetImageParameters reads JPEG 2000 parameters without decoding pixels.
func GetParameters ¶
GetParameters is a shorthand for GetImageParameters with CodecJ2K.
func (*Params) NrComponents ¶
type PixelDataOptions ¶
type PixelDataOptions struct {
Version PixelDataVersion
Codec Codec
PhotometricInterpretation string
}
PixelDataOptions configures DecodePixelData for DICOM handlers.
type PixelDataVersion ¶
type PixelDataVersion int
PixelDataVersion selects decode_pixel_data behaviour.
const ( PixelDataV1 PixelDataVersion = 1 PixelDataV2 PixelDataVersion = 2 )