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

package imagetile

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

Package imagetile implements DVID support for imagetiles in XY, XZ, and YZ orientation. All raw tiles are stored as PNG images that are by default gzipped. This allows raw tile gets to be already compressed at the cost of more expensive uncompression to retrieve arbitrary image sizes.


Package Files

imagetile.go keys.go push.go


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


var DefaultTileSize = dvid.Point3d{512, 512, 512}
var (
    ErrNoMetadataSet = errors.New("Tile metadata has not been POSTed yet.  GET requests require metadata to be POST.")

func NewTKey Uses

func NewTKey(tile dvid.ChunkPoint3d, plane dvid.DataShape, scale Scaling) (tk storage.TKey, err error)

NewTKey returns an imagetile-specific key component based on the components of a tile request.

func NewTKeyByTileReq Uses

func NewTKeyByTileReq(req TileReq) (storage.TKey, error)

NewTKeyByTileReq returns an imagetile-specific key component based on a tile request.

type Data Uses

type Data struct {

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

func (*Data) ConstructTiles Uses

func (d *Data) ConstructTiles(uuidStr string, tileSpec TileSpec, request datastore.Request) error

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) DefaultTileSpec Uses

func (d *Data) DefaultTileSpec(uuidStr string) (TileSpec, error)

DefaultTileSpec returns the default tile spec that will fully cover the source extents and scaling 0 uses the original voxel resolutions with each subsequent scale causing a 2x zoom out.

func (*Data) DescribeTKeyClass Uses

func (d *Data) DescribeTKeyClass(tkc storage.TKeyClass) string

DescribeTKeyClass returns a string explanation of what a particular TKeyClass is used for. Implements the datastore.TKeyClassDescriber interface.

func (*Data) DoRPC Uses

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

DoRPC handles the 'generate' command.

func (*Data) GetImage Uses

func (d *Data) GetImage(ctx storage.Context, src *imageblk.Data, geom dvid.Geometry, isotropic bool) (*dvid.Image, error)

GetImage returns an image given a 2d orthogonal image description. Since imagetile tiles have precomputed XY, XZ, and YZ orientations, reconstruction of the desired image should be much faster than computing the image from voxel blocks.

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) NewFilter Uses

func (d *Data) NewFilter(fs storage.FilterSpec) (storage.Filter, error)

NewFilter returns a Filter for use with a push of key-value pairs.

func (*Data) ParseTileReq Uses

func (d *Data) ParseTileReq(r *http.Request, parts []string) (TileReq, error)

func (*Data) PostTile Uses

func (d *Data) PostTile(ctx storage.Context, w http.ResponseWriter, r *http.Request, parts []string) error

PostTile stores a tile.

func (*Data) PushData Uses

func (d *Data) PushData(p *datastore.PushSession) error

PushData does an imagetile-specific push using optional ROI and tile filters.

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.

func (*Data) ServeTile Uses

func (d *Data) ServeTile(ctx storage.Context, w http.ResponseWriter, r *http.Request, parts []string) error

ServeTile returns a tile with appropriate Content-Type set.

func (*Data) SetMetadata Uses

func (d *Data) SetMetadata(uuid dvid.UUID, jsonBytes []byte) error

SetMetadata loads JSON data giving MinTileCoord, MaxTileCoord, and tile level specifications.

type Filter Uses

type Filter struct {
    // contains filtered or unexported fields

func (*Filter) Check Uses

func (f *Filter) Check(tkv *storage.TKeyValue) (skip bool, err error)

type Format Uses

type Format uint8
const (
    LZ4 Format = iota

func (Format) String Uses

func (f Format) String() string

type LevelSpec Uses

type LevelSpec struct {
    Resolution dvid.NdFloat32
    TileSize   dvid.Point3d

func (LevelSpec) Duplicate Uses

func (spec LevelSpec) Duplicate() LevelSpec

type Properties Uses

type Properties struct {
    // Source of the data for these imagetile.  Could be blank if tiles are not generated from
    // an associated grayscale data instance, but were loaded directly from external processing.
    Source dvid.InstanceName

    // MinTileCoord gives the minimum tile coordinate.
    MinTileCoord dvid.Point3d

    // MaxTileCoord gives the maximum tile coordinate.
    MaxTileCoord dvid.Point3d

    // Levels describe the resolution and tile sizes at each level of resolution.
    Levels TileSpec

    // Placeholder, when true (false by default), will generate fake tile images if a tile cannot
    // be found.  This is useful in testing clients.
    Placeholder bool

    // Encoding describes encoding of the stored tile.  See imagetile.Format
    Encoding Format

    // Quality is optional quality of encoding for jpeg, 1-100, higher is better.
    Quality int

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

type Scaling Uses

type Scaling uint8

Scaling describes the scale level where 0 = original data resolution and higher levels have been downsampled.

func DecodeTKey Uses

func DecodeTKey(tk storage.TKey) (tile dvid.ChunkPoint3d, plane dvid.DataShape, scale Scaling, err error)

DecodeTKey returns the components of a tile request based on an imagetile-specific key component.

type SourceData Uses

type SourceData interface{}

SourceData is the source of the tile data and should be voxels or voxels-derived data.

type TileReq Uses

type TileReq struct {
    // contains filtered or unexported fields

func NewTileReq Uses

func NewTileReq(tile dvid.ChunkPoint3d, plane dvid.DataShape, scale Scaling) TileReq

type TileScaleSpec Uses

type TileScaleSpec struct {
    // contains filtered or unexported fields

TileScaleSpec is a slice of tile resolution & size for each dimensions.

type TileSpec Uses

type TileSpec map[Scaling]TileScaleSpec

TileSpec specifies the resolution & size of each dimension at each scale level.

func LoadTileSpec Uses

func LoadTileSpec(jsonBytes []byte) (TileSpec, error)

LoadTileSpec loads a TileSpec from JSON data. JSON data should look like: {

"0": { "Resolution": [3.1, 3.1, 40.0], "TileSize": [512, 512, 40] },
"1": { "Resolution": [6.2, 6.2, 40.0], "TileSize": [512, 512, 80] },

} Each line is a scale with a n-D resolution/voxel and a n-D tile size in voxels.

func (TileSpec) MarshalJSON Uses

func (tileSpec TileSpec) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON of the imagetile specifications for each scale level.

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) 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 tile data with default values.

Package imagetile imports 22 packages (graph) and is imported by 2 packages. Updated 2019-09-13. Refresh now. Tools for package owners.