dvid: github.com/janelia-flyem/dvid/datatype/googlevoxels Index | Files

package googlevoxels

import "github.com/janelia-flyem/dvid/datatype/googlevoxels"

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


Package Files



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


var (
    DefaultTileSize   int32  = 512
    DefaultTileFormat string = "png"

type Data Uses

type Data struct {
    // contains filtered or unexported fields

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

func (*Data) CopyPropertiesFrom Uses

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 Uses

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

DoRPC handles the 'generate' command.

func (*Data) GetClient Uses

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 Uses

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 Uses

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

func (*Data) GobDecode Uses

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

func (*Data) GobEncode Uses

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

func (*Data) Help Uses

func (d *Data) Help() string

func (*Data) MarshalJSON Uses

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

func (*Data) ServeHTTP Uses

func (d *Data) ServeHTTP(uuid dvid.UUID, ctx *datastore.VersionedCtx, w http.ResponseWriter, r *http.Request) (activity map[string]interface{})

ServeHTTP handles all incoming HTTP requests for this data.

type GSpec Uses

type GSpec struct {
    // contains filtered or unexported fields

GSpec encapsulates the scale and orientation of a tile.

func GetGSpec Uses

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

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

func (GSpec) MarshalBinary Uses

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

func (*GSpec) UnmarshalBinary Uses

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

type Geometries Uses

type Geometries []Geometry

type Geometry Uses

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 Uses

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

type GeometryIndex Uses

type GeometryIndex int

type GeometryMap Uses

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 Uses

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

type GoogleSubvolGeom Uses

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 Uses

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 Uses

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 Uses

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 Uses

type Scaling uint8

Scaling describes the resolution where 0 is the highest resolution

type Shape Uses

type Shape uint8

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

const (
    XY  Shape = iota

func (*Shape) FromShape Uses

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

func (Shape) String Uses

func (s Shape) String() string

type Type Uses

type Type struct {

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 Uses

func NewType() *Type

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

func (*Type) Do Uses

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

Do handles command-line requests to the Google BrainMaps API

func (*Type) Help Uses

func (dtype *Type) Help() string

func (*Type) NewDataService Uses

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.

Package googlevoxels imports 19 packages (graph). Updated 2019-01-08. Refresh now. Tools for package owners.