Skip to content

DVID Upload Cutout Tutorial

Luis Rodriguez edited this page Apr 23, 2020 · 4 revisions

Uploading Cutout Data

Before uploading cutout data, make sure you can answer yes to the following questions.

Cutout checklist:

  • Is the cutout within the dimensions of the experiment's coordinate frame?
  • Does the data's type match the data type of the channel or layer?
  • Is the numpy array arranged properly (Z-Y-X or time-Z-Y-X)?

This example is extracted from our DVID examples folder

from intern.remote.dvid import DVIDRemote
from intern.resource.dvid import DataInstanceResource
import numpy as np

dvid = DVIDRemote({"protocol": "http", "host": "localhost:8001",})

# Prepare the data
data_cube = np.load("/My/dummy/dir/validation_grayscale.npy").astype(np.uint8)
data_cube = data_cube[0:512, 0:512, 0:512]
data_cube = data_cube.copy(order="C")

# Create the project
instance_setup_up = DataInstanceResource(
    alias="local_dvid_test",
    type="uint8blk",
    name="validation",
    UUID=None,
    datatype="uint8",
)
chan_actual_up = dvid.create_project(instance_setup_up)

# Create the cutout
dvid.create_cutout(instance_setup_up, 0, [0, 512], [0, 512], [0, 512], data_cube)