dicomjson

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package dicomjson converts DICOM datasets to and from JSON.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DatasetToMap

func DatasetToMap(ds *godicom.Dataset, opts ...Option) (map[string]Element, error)

DatasetToMap returns the DICOM JSON Model map representation of ds.

func DecodeDataset

func DecodeDataset(r io.Reader, opts ...Option) (*godicom.Dataset, error)

DecodeDataset reads a DICOM JSON Model dataset from r.

func MarshalDataset

func MarshalDataset(ds *godicom.Dataset, opts ...Option) ([]byte, error)

MarshalDataset returns sorted JSON for a DICOM JSON Model dataset.

func MarshalDatasetString

func MarshalDatasetString(ds *godicom.Dataset, opts ...Option) (string, error)

MarshalDatasetString returns a sorted JSON string for a DICOM JSON Model dataset.

func MarshalDatasets added in v0.23.0

func MarshalDatasets(datasets []*godicom.Dataset, opts ...Option) ([]byte, error)

MarshalDatasets returns a JSON array of DICOM JSON Model datasets.

func ParseDataset

func ParseDataset(data []byte, opts ...Option) (*godicom.Dataset, error)

ParseDataset parses a DICOM JSON Model dataset.

func ParseDatasets added in v0.23.0

func ParseDatasets(data []byte, opts ...Option) ([]*godicom.Dataset, error)

ParseDatasets parses a DICOM JSON Model array (QIDO-RS / WADO-RS metadata). A single object is accepted and returned as a one-element slice.

Types

type BulkDataURIBuilder

type BulkDataURIBuilder func(tag godicom.Tag, vr godicom.VR, value []byte) (string, error)

BulkDataURIBuilder returns a BulkDataURI while marshaling large binary values.

type BulkDataURIReader

type BulkDataURIReader func(tag godicom.Tag, vr godicom.VR, uri string) ([]byte, error)

BulkDataURIReader resolves a BulkDataURI while parsing JSON.

type Element

type Element struct {
	VR           string            `json:"vr"`
	Value        []json.RawMessage `json:"Value,omitempty"`
	InlineBinary string            `json:"InlineBinary,omitempty"`
	BulkDataURI  string            `json:"BulkDataURI,omitempty"`
}

Element is the DICOM JSON Model representation of a data element.

type Option

type Option func(*options)

Option configures DICOM JSON Model parsing or marshaling.

func WithBulkDataThreshold

func WithBulkDataThreshold(n int) Option

WithBulkDataThreshold sets the base64 size threshold for BulkDataURI output.

func WithBulkDataURIBuilder

func WithBulkDataURIBuilder(fn BulkDataURIBuilder) Option

WithBulkDataURIBuilder sets the callback used to produce BulkDataURI values.

func WithBulkDataURIReader

func WithBulkDataURIReader(fn BulkDataURIReader) Option

WithBulkDataURIReader sets the callback used to resolve BulkDataURI values.

func WithSuppressInvalidTags

func WithSuppressInvalidTags() Option

WithSuppressInvalidTags drops elements that fail marshaling.

Jump to

Keyboard shortcuts

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