You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
" print(\"No tutorial resources found to add to project\")"
365
-
]
329
+
"source": "# Get some resources to add to a project\ntutorial_resources = list(api.resources.get_list(\n tags=['tutorial'],\n status='inbox'\n))\n\nif tutorial_resources:\n resource_ids_for_project = [r.id for r in tutorial_resources[:3]] # Take first 3 resources\n\n # Create a new project (exists_ok returns the existing project instead of raising)\n project = api.projects.create(\n name=\"Tutorial Project\",\n description=\"A project created for demonstration purposes\",\n resource_ids=resource_ids_for_project,\n exists_ok=True\n )\n\n print(f\"Created project: {project.name} (ID: {project.id})\")\n\n # List all projects\n all_projects = api.projects.get_list()\n print(f\"\\nAll projects ({len(all_projects)}):\")\n for proj in all_projects:\n print(f\" - {proj.name} (ID: {proj.id})\")\nelse:\n print(\"No tutorial resources found to add to project\")"
"# Adds an annotation to a single resource, associated with a project.\n",
57
-
"api.add_annotations(resource_id=resource_id,\n",
58
-
" identifier='img-lb1',\n",
59
-
" project='Example Project' # You can pass None to use not associated with a project\n",
60
-
" )"
61
-
]
47
+
"source": "from datamint.api.dto import CreateAnnotationDto\nfrom datamint.entities.annotations import AnnotationType\n\n# Adds a label annotation to a single resource\nannotation = CreateAnnotationDto(type=AnnotationType.LABEL, identifier='img-lb1', scope='image')\napi.annotations.create(resource, annotation)\n\n# Associate the resource with a project. Resources aren't tied to a project\n# automatically anymore, so this is a separate, explicit step.\napi.projects.add_resources(resource, project=PROJECT_NAME)"
62
48
},
63
49
{
64
50
"cell_type": "markdown",
65
51
"id": "0db3307f",
66
52
"metadata": {},
67
-
"source": [
68
-
"See more details about the function parameter in the documentation [APIHandler.add_annotations](https://sonanceai.github.io/datamint-python-api/datamint.apihandler.html#datamint.apihandler.api_handler.APIHandler.add_annotations)."
69
-
]
53
+
"source": "See more details about the function parameters in the documentation [AnnotationsApi.create](https://sonanceai.github.io/datamint-python-api/datamint.api.endpoints.html#datamint.api.endpoints.annotations_api.AnnotationsApi.create)."
70
54
},
71
55
{
72
56
"cell_type": "markdown",
@@ -82,22 +66,13 @@
82
66
"id": "b2dc2320",
83
67
"metadata": {},
84
68
"outputs": [],
85
-
"source": [
86
-
"# Adds an annotation to a single resource, associated with a project.\n",
" project='Example Project' # You can pass None to use not associated with a project\n",
91
-
" )"
92
-
]
69
+
"source": "# Adds an image classification annotation to a single resource\napi.annotations.create_image_classification(resource, identifier='img-cls', value='cls1')\n\n# Associate the resource with a project. Resources aren't tied to a project\n# automatically anymore, so this is a separate, explicit step.\napi.projects.add_resources(resource, project=PROJECT_NAME)"
93
70
},
94
71
{
95
72
"cell_type": "markdown",
96
73
"id": "b1746dae",
97
74
"metadata": {},
98
-
"source": [
99
-
"See more details about the function parameter in the documentation [APIHandler.add_image_category_annotation](https://sonanceai.github.io/datamint-python-api/datamint.apihandler.html#datamint.apihandler.api_handler.APIHandler.add_image_category_annotation)."
100
-
]
75
+
"source": "See more details about the function parameters in the documentation [AnnotationsApi.create_image_classification](https://sonanceai.github.io/datamint-python-api/datamint.api.endpoints.html#datamint.api.endpoints.annotations_api.AnnotationsApi.create_image_classification)."
"source": "# Creating a Line annotation\n\nReference: [AnnotationsApi.add_line_annotation](https://sonanceai.github.io/datamint-python-api/datamint.api.endpoints.html#datamint.api.endpoints.annotations_api.AnnotationsApi.add_line_annotation)"
"First, add a new box/rectangle shape named 'BoundingBox1' in your project settings (similar to the line shape setup above)."
174
-
]
164
+
"source": "# Creating a Box annotation\n\nReference: [AnnotationsApi.add_box_annotation](https://sonanceai.github.io/datamint-python-api/datamint.api.endpoints.html#datamint.api.endpoints.annotations_api.AnnotationsApi.add_box_annotation)\n\nFirst, add a new box/rectangle shape named 'BoundingBox1' in your project settings (similar to the line shape setup above)."
" dicom_metadata=dicom_path, # Automatically converts to patient coordinates\n",
211
-
" coords_system='pixel',\n",
212
-
" project=PROJECT_NAME)\n",
213
-
"```"
214
-
]
185
+
"source": "Both line and box annotations support:\n- **DICOM coordinate conversion**: Automatically convert pixel coordinates to patient coordinates\n- **Patient coordinates**: Direct specification of 3D patient coordinates\n- **Model annotations**: Associate annotations with specific AI models\n\n### Example with DICOM metadata:\n\n```python\n# Assuming you have DICOM metadata\nimport pydicom\n\ndicom_metadata = pydicom.dcmread(\"/path/to/your/dicom/file.dcm\")\napi.annotations.add_box_annotation((10, 10), (50, 50),\n resource=res,\n identifier='DicomBox',\n frame_index=0,\n metadata=dicom_metadata, # Required when coords_system='patient'\n coords_system='patient', # Automatically converts to patient coordinates\n worklist_id=proj.fetch_worklists()[0].id)\n```"
Copy file name to clipboardExpand all lines: notebooks/04_experiment_tracking/02_model_registry.ipynb
+2-9Lines changed: 2 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -225,14 +225,7 @@
225
225
"cell_type": "markdown",
226
226
"id": "5edb693f",
227
227
"metadata": {},
228
-
"source": [
229
-
"## Next Steps",
230
-
"",
231
-
"Once you have a model version you're happy with, alias it and deploy it, see",
232
-
"`05_deployment/01_deploy_registered_model.ipynb`. Registered models are also created",
233
-
"automatically when you pass `--ai-model <name>` to `datamint-upload` with a name that doesn't",
234
-
"exist yet."
235
-
]
228
+
"source": "## Next Steps\n\nOnce you have a model version you're happy with, alias it and deploy it, see\n`05_deployment/01_deploy_registered_model.ipynb`. Registered models are also created\nautomatically when you pass `--ai-model <name>` to `datamint upload` with a name that doesn't\nexist yet."
0 commit comments