Documentation
¶
Overview ¶
Package jpip retrieves and decodes pixel streams referenced by DICOM JPIP transfer syntaxes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidRequest = errors.New("dicom: invalid JPIP request") ErrPolicyDenied = errors.New("dicom: JPIP endpoint denied by policy") ErrRedirectDenied = errors.New("dicom: JPIP redirect denied by policy") ErrOffline = errors.New("dicom: JPIP endpoint unavailable") ErrHTTPStatus = errors.New("dicom: JPIP endpoint returned an unsuccessful status") ErrUnsupportedContentType = errors.New("dicom: unsupported JPIP response content type") ErrResponseTooLarge = errors.New("dicom: JPIP response exceeds configured limit") ErrPartialResponse = errors.New("dicom: incomplete JPIP response") ErrCorruptResponse = errors.New("dicom: corrupt JPIP response") ErrIncrementalStream = errors.New("dicom: JPIP incremental data-bin stream is not directly decodable") ErrDecode = errors.New("dicom: JPIP response decode failed") )
Functions ¶
This section is empty.
Types ¶
type BasicCredential ¶
BasicCredential is applied only to the exact origin in Origin. It is never inherited by a redirect merely because a broader Rule permits that target.
type BearerCredential ¶
type BearerCredential struct {
Origin string
Source dicomweb.BearerTokenSource
}
BearerCredential obtains a dynamic bearer token only for the exact origin in Origin. Its source may refresh tokens and optionally invalidate a token challenged with HTTP 401.
type ByteRange ¶
ByteRange requests an inclusive HTTP byte range. It is useful for servers that expose a complete representation in addition to JPIP query controls.
type CacheStats ¶
type CacheStats struct {
Entries int
Bytes int64
MaxBytes int64
Hits uint64
Misses uint64
Evictions uint64
}
CacheStats is a PHI-free snapshot of the bounded response cache.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is safe for concurrent use.
func (*Client) CacheStats ¶
func (c *Client) CacheStats() CacheStats
CacheStats returns cache occupancy and counters without exposing target URLs.
func (*Client) DecodeFrame ¶
func (c *Client) DecodeFrame(ctx context.Context, request Request, dataset *object.Object) (DecodedFrame, error)
DecodeFrame retrieves and decodes one complete JPEG 2000 or HTJ2K response. JPP/JPT data-bin streams are returned as a stable typed limitation because they require session-level data-bin assembly rather than a still-image codec.
type Config ¶
type Config struct {
HTTPClient *http.Client
Policy Policy
MaxResponseBytes int64
MaxCacheBytes int64
MaxRetries int
Registry pixeldata.Registry
RetryDelay func(attempt int, response *http.Response) time.Duration
}
Config controls a Client. Supplying HTTPClient is primarily useful for custom trust stores and tests; its transport remains the caller's responsibility. The default transport enforces TLS 1.2 or newer.
type DecodedFrame ¶
type DecodedFrame struct {
Metadata pixeldata.Metadata
Data []byte
ContentType string
CacheHit bool
}
DecodedFrame is the native frame produced from one complete JPIP response.
type Error ¶
type Error struct {
Kind ErrorKind
Operation string
StatusCode int
ContentType string
Limit int64
Size int64
Err error
}
Error describes a JPIP failure without retaining the provider URL or its query parameters. Provider URLs can contain short-lived target identifiers and must not become durable diagnostics.
type ErrorKind ¶
type ErrorKind string
ErrorKind is a stable category callers can map to a user-facing diagnostic.
const ( ErrorKindInvalidRequest ErrorKind = "invalid-request" ErrorKindAuthentication ErrorKind = "authentication" ErrorKindPolicyDenied ErrorKind = "policy-denied" ErrorKindRedirectDenied ErrorKind = "redirect-denied" ErrorKindOffline ErrorKind = "offline" ErrorKindHTTPStatus ErrorKind = "http-status" ErrorKindUnsupportedContentType ErrorKind = "unsupported-content-type" ErrorKindResponseTooLarge ErrorKind = "response-too-large" ErrorKindPartialResponse ErrorKind = "partial-response" ErrorKindCorruptResponse ErrorKind = "corrupt-response" ErrorKindIncrementalStream ErrorKind = "incremental-stream" ErrorKindDecode ErrorKind = "decode" )
type Policy ¶
type Policy struct {
Rules []Rule
Credentials []BasicCredential
BearerCredentials []BearerCredential
}
Policy is an explicit network allowlist plus origin-bound credentials.
type Region ¶
Region requests a source region. Width and Height must both be positive when the region is present.
type Request ¶
type Request struct {
Reference pixeldata.JPIPReference
Frame int
Size Size
Region Region
Range *ByteRange
}
Request describes one JPIP representation. Frame is zero-based and becomes the DICOM/JPIP one-based stream query parameter.
type Rule ¶
Rule permits one scheme and host. Port is optional; an empty Port permits any port on the explicitly named host. Wildcards and subdomain matching are intentionally unsupported.
func RuleForHost ¶
RuleForHost creates a host rule. When port is empty, every port on that explicitly configured host is permitted.
func RuleFromURL ¶
RuleFromURL creates an exact-origin rule from an HTTP(S) URL.