예제 #1
0
func (s *Shape) FromShape(shape dvid.DataShape) error {
	switch {
	case shape.Equals(dvid.XY):
		*s = XY
	case shape.Equals(dvid.XZ):
		*s = XZ
	case shape.Equals(dvid.YZ):
		*s = YZ
	case shape.Equals(dvid.Vol3d):
		*s = XYZ
	default:
		return fmt.Errorf("No Google BrainMaps shape corresponds to DVID %s shape", shape)
	}
	return nil
}
예제 #2
0
// GetTileSpec returns a TileSpec for a given scale and dvid Geometry.
func GetTileSpec(scaling Scaling, shape dvid.DataShape) (*TileSpec, error) {
	ts := new(TileSpec)
	ts.scaling = scaling
	switch {
	case shape.Equals(dvid.XY):
		ts.plane = XY
	case shape.Equals(dvid.XZ):
		ts.plane = XZ
	case shape.Equals(dvid.YZ):
		ts.plane = YZ
	default:
		return nil, fmt.Errorf("No Google BrainMaps slice orientation corresponding to DVID %s shape", shape)
	}
	return ts, nil
}