-
Notifications
You must be signed in to change notification settings - Fork 0
Boss Project Setup Tutorial
ndio has resource classes that map directly to the objects in the Boss data
model. The Boss specific resources
are defined in the submodule ndio.ndresource.boss.resource
.
CollectionResource
ExperimentResource
CoordinateFrameResource
ChannelResource
LayerResource
Let's setup the initial data hierarchy with a collection and one experiment with a coordinate frame, channel, and layer. For clarity, we'll use the names of most of the positional arguments when creating resource instances.
Note only users with either the resource-manager or admin roles can actually create resources.
from ndio.remote.boss.remote import Remote
from ndio.ndresource.boss.resource import *
rmt = Remote()
collection = CollectionResource('JHUAPL', description='JHUAPL Data')
rmt.project_create(collection)
Note that the coordinate frame resource returned by
rmt.project_create()
is saved. The ID of the coordinate frame is needed
when creating an experiment. The ID isn't known until after the coordinate
frame is created.
Also, keep in mind that coordinate frames do not allow negative numbers.
coord_frame = CoordinateFrameResource(
'JHUAPLFrame', description='JHUAPL Standard Coordinate Frame',
x_start=0, x_stop=100,
y_start=0, y_stop=100,
z_start=0, z_stop=50,
x_voxel_size=1, y_voxel_size=1, z_voxel_size=1,
voxel_unit='nanometers')
coord_frame = rmt.project_create(coord_frame)
experiment = ExperimentResource(
'Mouse17', 'JHUAPL',
description='First viable mouse', coord_frame=coord_frame.id,
num_hierarchy_levels=1, hierarchy_method='near_iso')
rmt.project_create(experiment)
Similar to the coordinate frame, the ID of the channel is required when creating a layer because a layer is linked to at least one channel.
channel = ChannelResource(
'EM', 'JHUAPL', 'Mouse17', description='EM data channel', datatype='uint16')
channel = rmt.project_create(channel)
layer = LayerResource(
'Algorithm1', 'JHUAPL', 'Mouse17', description='1st experimental classifier',
datatype='uint16', channels=[channel.id])
rmt.project_create(layer)
At this point, your data hierarchy should be created.