googlevoxels

package
v0.8.18 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2018 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Overview

Package googlevoxels implements DVID support for multi-scale tiles and volumes in XY, XZ, and YZ orientation using the Google BrainMaps API.

Index

Constants

View Source
const (
	Version  = "0.1"
	RepoURL  = "github.com/janelia-flyem/dvid/datatype/googlevoxels"
	TypeName = "googlevoxels"
)

Variables

View Source
var (
	DefaultTileSize   int32  = 512
	DefaultTileFormat string = "png"
)

Functions

This section is empty.

Types

type Data

type Data struct {
	*datastore.Data
	Properties
	// contains filtered or unexported fields
}

Data embeds the datastore's Data and extends it with voxel-specific properties.

func (*Data) CopyPropertiesFrom added in v0.8.2

func (d *Data) CopyPropertiesFrom(src datastore.DataService, fs storage.FilterSpec) error

CopyPropertiesFrom copies the data instance-specific properties from a given data instance into the receiver's properties. Fulfills the datastore.PropertyCopier interface.

func (*Data) DoRPC

func (d *Data) DoRPC(request datastore.Request, reply *datastore.Response) error

DoRPC handles the 'generate' command.

func (*Data) GetClient added in v0.8.0

func (d *Data) GetClient() (*http.Client, error)

Returns a potentially cached client that handles authorization to Google. Assumes a JSON Web Token has been loaded into Data or else returns an error.

func (*Data) GetGoogleSubvolGeom added in v0.8.0

func (d *Data) GetGoogleSubvolGeom(scaling Scaling, shape dvid.DataShape, offset dvid.Point3d, size dvid.Point) (*GoogleSubvolGeom, error)

GetGoogleSubvolGeom returns a google-specific voxel spec, which includes how the data is positioned relative to scaled volume boundaries. Not that the size parameter is the desired size and not what is required to fit within a scaled volume.

func (*Data) GetVoxelSize

func (d *Data) GetVoxelSize(ts *GSpec) (dvid.NdFloat32, error)

func (*Data) GobDecode

func (d *Data) GobDecode(b []byte) error

func (*Data) GobEncode

func (d *Data) GobEncode() ([]byte, error)

func (*Data) Help

func (d *Data) Help() string

func (*Data) MarshalJSON

func (d *Data) MarshalJSON() ([]byte, error)

func (*Data) ServeHTTP

func (d *Data) ServeHTTP(uuid dvid.UUID, ctx *datastore.VersionedCtx, w http.ResponseWriter, r *http.Request)

ServeHTTP handles all incoming HTTP requests for this data.

type GSpec added in v0.8.0

type GSpec struct {
	// contains filtered or unexported fields
}

GSpec encapsulates the scale and orientation of a tile.

func GetGSpec added in v0.8.0

func GetGSpec(scaling Scaling, shape dvid.DataShape) (*GSpec, error)

GetGSpec returns a GSpec for a given scale and dvid Geometry.

func (GSpec) MarshalBinary added in v0.8.0

func (ts GSpec) MarshalBinary() ([]byte, error)

func (*GSpec) UnmarshalBinary added in v0.8.0

func (ts *GSpec) UnmarshalBinary(data []byte) error

type Geometries

type Geometries []Geometry

type Geometry

type Geometry struct {
	VolumeSize   dvid.Point3d   `json:"volumeSize"`
	ChannelCount uint32         `json:"channelCount"`
	ChannelType  string         `json:"channelType"`
	PixelSize    dvid.NdFloat32 `json:"pixelSize"`
}

Geometry corresponds to a Volume Geometry in Google BrainMaps API

func (*Geometry) UnmarshalJSON

func (g *Geometry) UnmarshalJSON(b []byte) error

type GeometryIndex

type GeometryIndex int

type GeometryMap

type GeometryMap map[GSpec]GeometryIndex

GeometryMap provides a mapping from DVID scale (0 is highest res) and tile orientation to the specific geometry (Google "scale" value) that supports it.

func (GeometryMap) MarshalJSON

func (gm GeometryMap) MarshalJSON() ([]byte, error)

type GoogleSubvolGeom added in v0.8.0

type GoogleSubvolGeom struct {
	// contains filtered or unexported fields
}

GoogleSubvolGeom encapsulates all information needed for voxel retrieval (aside from authentication) from the Google BrainMaps API, as well as processing the returned data.

func (GoogleSubvolGeom) GetURL added in v0.8.0

func (gsg GoogleSubvolGeom) GetURL(volumeid, formatStr string) (string, error)

GetURL returns the base API URL for retrieving an image. Note that the authentication key or token needs to be added to the returned string to form a valid URL. The formatStr parameter is of the form "jpeg" or "jpeg:80" or "png:8" where an optional compression level follows the image format and a colon. Leave formatStr empty for default.

type Properties

type Properties struct {
	// Necessary information to select data from Google BrainMaps API.
	VolumeID string
	JWT      string

	// Default size in pixels along one dimension of square tile.
	TileSize int32

	// GeomMap provides mapping between scale and various image shapes to Google scaling index.
	GeomMap GeometryMap

	// Scales is the list of available precomputed scales ("geometries" in Google terms) for this data.
	Scales Geometries

	// HighResIndex is the geometry that is the highest resolution among the available scaled volumes.
	HighResIndex GeometryIndex
	// contains filtered or unexported fields
}

Properties are additional properties for keyvalue data instances beyond those in standard datastore.Data. These will be persisted to metadata storage.

func (Properties) MarshalJSON

func (p Properties) MarshalJSON() ([]byte, error)

MarshalJSON handles JSON serialization for googlevoxels Data. It adds "Levels" metadata equivalent to imagetile's tile specification so clients can treat googlevoxels tile API identically to imagetile. Sensitive information like AuthKey are withheld.

type Scaling

type Scaling uint8

Scaling describes the resolution where 0 is the highest resolution

type Shape added in v0.8.0

type Shape uint8

Shape describes the orientation of a 2d or 3d image.

const (
	XY Shape = iota
	XZ
	YZ
	XYZ
)

func (*Shape) FromShape added in v0.8.0

func (s *Shape) FromShape(shape dvid.DataShape) error

func (Shape) String added in v0.8.0

func (s Shape) String() string

type Type

type Type struct {
	datastore.Type
}

Type embeds the datastore's Type to create a unique type with tile functions. Refinements of general tile types can be implemented by embedding this type, choosing appropriate # of channels and bytes/voxel, overriding functions as needed, and calling datastore.Register(). Note that these fields are invariant for all instances of this type. Fields that can change depending on the type of data (e.g., resolution) should be in the Data type.

func NewType

func NewType() *Type

NewDatatype returns a pointer to a new voxels Datatype with default values set.

func (*Type) Do added in v0.8.0

func (dtype *Type) Do(cmd datastore.Request, reply *datastore.Response) error

Do handles command-line requests to the Google BrainMaps API

func (*Type) Help

func (dtype *Type) Help() string

func (*Type) NewDataService

func (dtype *Type) NewDataService(uuid dvid.UUID, id dvid.InstanceID, name dvid.InstanceName, c dvid.Config) (datastore.DataService, error)

NewData returns a pointer to new googlevoxels data with default values.

Jump to

Keyboard shortcuts

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