api

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package api is a partial API client for the Orthanc DICOM server REST API.

Index

Constants

This section is empty.

Variables

View Source
var DefaultPollInterval = 60 * time.Second

Functions

This section is empty.

Types

type Api

type Api struct {
	BaseURL *url.URL

	Logger Logger
	// contains filtered or unexported fields
}

func New

func New(baseURL string) (*Api, error)

New returns a new API Client with default settings.

func (*Api) Changes

func (a *Api) Changes(ctx context.Context, since, limit int) (result ChangesResult, err error)

func (*Api) GetInstance added in v0.0.4

func (a *Api) GetInstance(ctx context.Context, id string) (result GetInstanceResponse, err error)

func (*Api) GetInstancePreview added in v0.0.4

func (a *Api) GetInstancePreview(ctx context.Context, id string) (r io.ReadCloser, len int64, err error)

func (*Api) GetInstanceTags added in v0.0.4

func (a *Api) GetInstanceTags(ctx context.Context, id string) (result GetInstanceTagsResponse, err error)

func (*Api) GetPatient added in v0.0.4

func (a *Api) GetPatient(ctx context.Context, id string) (result GetPatientResponse, err error)

func (*Api) GetSeries added in v0.0.4

func (a *Api) GetSeries(ctx context.Context, id string) (result GetSeriesResponse, err error)

func (*Api) GetStudy added in v0.0.4

func (a *Api) GetStudy(ctx context.Context, id string) (result GetStudyResponse, err error)

func (*Api) InstanceFile

func (a *Api) InstanceFile(ctx context.Context, id string) (r io.ReadCloser, len int64, err error)

func (*Api) Instances

func (a *Api) Instances(ctx context.Context, since int, limit int) (result []string, err error)

func (*Api) LastChange

func (a *Api) LastChange(ctx context.Context) (result ChangeResult, last int, err error)

func (*Api) PatientDetailsSince

func (a *Api) PatientDetailsSince(ctx context.Context, since, limit int) (result []GetPatientResponse, err error)

func (*Api) PostInstance

func (a *Api) PostInstance(ctx context.Context, data io.Reader, len int64) (result PostInstanceResponse, err error)

type ChangeResult

type ChangeResult struct {
	ChangeType   string
	Date         string
	ID           string
	Path         string
	ResourceType string
	Seq          int
}

type ChangeWatch

type ChangeWatch struct {
	StartIndex   int
	StopIndex    int
	StopAtEnd    bool
	PollInterval time.Duration
}

func (ChangeWatch) Run

func (cw ChangeWatch) Run(ctx context.Context, api *Api, f func(ChangeResult)) error

Run iterates through all the changes from StartIndex to StopIndex (or forever, when StopIndex is < 0) for all Change entries that are encountered the callback function is called.

when StopIndex is -1, it will wait DefaultChangeWatchSleepTime (60 seconds) before trying again.

type ChangesResult

type ChangesResult struct {
	Changes []ChangeResult
	Done    bool
	Last    int
}

type GetInstanceResponse added in v0.0.4

type GetInstanceResponse struct {
	ID            string            `json:"ID"`
	Type          string            `json:"Type"`
	FileSize      int               `json:"FileSize"`
	MainDicomTags map[string]string `json:"MainDicomTags"`
}

type GetInstanceTagsResponse added in v0.0.4

type GetInstanceTagsResponse map[string]InstanceTag

type GetPatientResponse added in v0.0.4

type GetPatientResponse struct {
	ID            string
	IsStable      bool
	LastUpdate    string
	MainDicomTags map[string]string
	Studies       []string
	Type          string
}

type GetSeriesResponse added in v0.0.4

type GetSeriesResponse struct {
	ID            string
	IsStable      bool
	Instances     []string
	LastUpdate    string
	MainDicomTags map[string]string
	ParentStudy   string
	Status        string
	Type          string
}

type GetStudyResponse added in v0.0.4

type GetStudyResponse struct {
	ID                   string
	IsStable             bool
	LastUpdate           string
	MainDicomTags        map[string]string
	ParentPatient        string
	PatientMainDicomTags map[string]string
	Series               []string
	Type                 string
}

type InstanceTag added in v0.0.4

type InstanceTag struct {
	Name  string      `json:"Name"`
	Type  string      `json:"Type"`
	Value interface{} `json:"Value"`
}

type Logger

type Logger interface {
	Printf(format string, v ...interface{})
}

type PostInstanceResponse

type PostInstanceResponse struct {
	ID     string `json:"ID"`
	Path   string `json:"Path"`
	Status string `json:"Status"`
}

Jump to

Keyboard shortcuts

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