Define project views
When displaying cases, there is the option to have images displayed at different “views” in order to see multiple versions of an image, or to provide additional context to labelers to help them provide the best possible label. Take, for example, pathology slides. A common use case for using views when displaying pathology slides would be to show the same slide with different stains - the first view might be your view with just DAPI stain (blue stain to visualize nuclei), and additional views would have different or more specific stains to help visualize additional details that would be of assistance to labelers. Views are displayed vertically, so a labeler would swipe up and down to see different views on the DiagnosUs app.
Creating a Project with Views
In order to display cases with views, you’ll first need to set all views for your project during project creation
See the Manage labeling projects how-to guide for more information about project creation.
Utilize the projects/public/v1/add endpoint to create a project with ALL views that should be available to any task that is created within that project. For example, if task A will have views DAPI and GREEN and task B will have views DAPI and RED , be sure to add DAPI, GREEN and RED during project creation. See example below:
curl --location --request POST 'https://api.centaurlabs.com/projects/public/v1/add' \
--header 'X-API-KEY: YOUR_API_KEY_HERE' \
--header 'Authorization: Bearer YOUR_TOKEN_HERE' \
--header 'Content-Type: application/json' \
--data '{
"name": "Hello World",
"description": "My first project",
"content_type": "image",
"views": ["DAPI", "GREEN", "RED"]
}'Creating a Task with Views
Once the project has been created, the views that should be available to a specific task can be specified during task creation by providing a view mapping.
See the Manage labeling tasks how-to guide for more information about task creation
To create a new task, utilize the /tasks/public/v1/add endpoint. The view (the name of the view) in addition to the index will be required. Indexes are 0-based and must be continuous. The view at index 0 will be displayed first (it will be the “bottom” most image). Additional views will be shown above the view at index 0. In the example below, the DAPI view will be displayed first and the GREEN view will be displayed second (above).
curl --location --request POST 'https://api.centaurlabs.com/tasks/public/v1/add' \
--header 'X-API-KEY: YOUR_API_KEY_HERE' \
--header 'Authorization: Bearer YOUR_TOKEN_HERE' \
--header 'Content-Type: application/json' \
--data '{
"task_name": "YOUR TASK NAME",
"task_prompt": "YOUR TASK PROMPT",
"project_id": PROJECT_ID,
"multi_answer": false,
"task_type": "classification",
"answer_classes": ["ANSWER 1", "ANSWER 2", "ANSWER 3", "ANSWER 4"],
"view_mapping": [
{"view": "DAPI", "index": 0},
{"view": "GREEN", "index": 1}
]
}'Adding a manifest setting views per content
After your project and task has been created, you’ll need to import new data.
See the Import data for labeling how-to guide for more information about importing data
After data has been imported, you’ll need to add the imported data to the task in order to create cases. This can be done via the /tasks/imports/public/v1/add endpoint.
See the section about creating cases in the how-to guide for more information about how to create cases
Next, you’ll be able to set a “files manifest” for your data. This is how you’ll associate each content with an existing view in the task. To be able to easily set the manifest, you can first retrieve a template to collect all content IDs that are in a task via the /manifests/public/v1/get endpoint. Once the template is retrieved, the metadata about each content can be populated.
In the example below, the content with ID 0 will be associated with the DAPI view at index 0, and the content with ID 1 will be associated with the GREEN view at index 1.
curl --location --request POST 'https://api.centaurlabs.com/manifests/public/v1/add' \
--header 'X-API-KEY: YOUR_API_KEY_HERE' \
--header 'Authorization: Bearer YOUR_TOKEN_HERE' \
--header 'Content-Type: application/json' \
--data '{
"project_id": PROJECT_ID,
"files_manifest":
{"content_id": 0, "series": "A", "series_index": 0, "view": "DAPI"},
{"content_id": 1, "series": "B", "series_index": 0, "view": "GREEN"},
]
}'Updated 3 months ago
