Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

duplicate of label in post_labelindex function #12

Open
xiuliren opened this issue May 19, 2022 · 1 comment
Open

duplicate of label in post_labelindex function #12

xiuliren opened this issue May 19, 2022 · 1 comment

Comments

@xiuliren
Copy link

def post_labelindex(server, uuid, instance, label, proto_index, *, session=None):

The label could be fetched from the proto_index. There is a duplicate parameter here?

@stuarteberg
Copy link
Member

In most cases, the Python API aims to be a straightforward wrapper around dvid's REST API.

In this case, the REST API is the following:

GET  <api URL>/node/<UUID>/<data name>/index/<label>
POST <api URL>/node/<UUID>/<data name>/index/<label>

	Allows direct retrieval or storing of an index (blocks per supervoxel and their voxel count) 
	for a label.  Typically, these indices are computed on-the-fly during ingestion of
	of blocks of label voxels.  If there are cluster systems capable of computing label
	blocks, indices, and affinities directly, though, it's more efficient to simply POST
	them into dvid.

	The returned (GET) or sent (POST) protobuf serialization of a LabelIndex message is defined by:

	message SVCount {
		map<uint64, uint32> counts = 1;
	}

	message LabelIndex {
		map<uint64, SVCount> blocks = 1;  // key is encoded block coord ZYX (packed little-endian 21-bit numbers where MSB is sign flag)
		uint64 label = 2;
		uint64 last_mutid = 3;
		string last_mod_time = 4;  // string is time in RFC 3339 format
		string last_mod_user = 5;
	}

	If the blocks map is empty on a POST, the label index is deleted.

So yes, the label is provided in two places. Arguably this is a flaw in the REST API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants