supervisely 6.73.381__py3-none-any.whl → 6.73.382__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1669,20 +1669,55 @@ class AppApi(TaskApi):
1669
1669
  def start(
1670
1670
  self,
1671
1671
  agent_id,
1672
- app_id=None,
1673
- workspace_id=None,
1674
- description="",
1675
- params=None,
1676
- log_level="info",
1677
- users_id=None,
1678
- app_version=None,
1679
- is_branch=False,
1680
- task_name="run-from-python",
1681
- restart_policy="never",
1682
- proxy_keep_url=False,
1683
- module_id=None,
1684
- redirect_requests={},
1672
+ app_id: Optional[int] = None,
1673
+ workspace_id: Optional[int] = None,
1674
+ description: str = "",
1675
+ params: Dict[str, Any] = None,
1676
+ log_level: Literal["info", "debug", "warning", "error"] = "info",
1677
+ users_id: Optional[int] = None,
1678
+ app_version: Optional[str] = None,
1679
+ is_branch: bool = False,
1680
+ task_name: str = "run-from-python",
1681
+ restart_policy: Literal["never", "on_error"] = "never",
1682
+ proxy_keep_url: bool = False,
1683
+ module_id: Optional[int] = None,
1684
+ redirect_requests: Dict[str, int] = {},
1685
1685
  ) -> SessionInfo:
1686
+ """Start a new application session (task).
1687
+
1688
+ :param agent_id: ID of the agent to run the task on. If set None - the task will be run on the any available agent.
1689
+ :type agent_id: int
1690
+ :param app_id: Deprecated. Use `module_id` instead.
1691
+ :type app_id: Optional[int]
1692
+ :param workspace_id: ID of the workspace to run the task in. If not specified, the default workspace will be used.
1693
+ :type workspace_id: Optional[int]
1694
+ :param description: Task description which will be shown in UI.
1695
+ :type description: str
1696
+ :param params: Task parameters which will be passed to the application.
1697
+ :type params: Optional[dict]
1698
+ :param log_level: Log level for the task. Default is "info".
1699
+ :type log_level: Literal["info", "debug", "warning", "error"]
1700
+ :param users_id: User ID for which will be created an instance of the application.
1701
+ :type users_id: Optional[int]
1702
+ :param app_version: Application version e.g. "v1.0.0" or branch name e.g. "dev".
1703
+ :type app_version: Optional[str]
1704
+ :param is_branch: If the application version is a branch name, set this parameter to True.
1705
+ :type is_branch: bool
1706
+ :param task_name: Task name which will be shown in UI. Default is "run-from-python".
1707
+ :type task_name: str
1708
+ :param restart_policy: When the app should be restarted: never or if error occurred.
1709
+ :type restart_policy: str
1710
+ :param proxy_keep_url: For internal usage only.
1711
+ :type proxy_keep_url: bool
1712
+ :param module_id: Module ID. Can be obtained from the apps page in UI.
1713
+ :type module_id: Optional[int]
1714
+ :param redirect_requests: For internal usage only in Develop and Debug mode.
1715
+ :type redirect_requests: dict
1716
+ :return: SessionInfo object with information about the started task.
1717
+ :rtype: SessionInfo
1718
+ :raises ValueError: If both app_id and module_id are not provided.
1719
+ :raises ValueError: If both app_id and module_id are provided.
1720
+ """
1686
1721
  users_ids = None
1687
1722
  if users_id is not None:
1688
1723
  users_ids = [users_id]
@@ -150,8 +150,8 @@ class NiiPlaneStructuredConverter(NiiConverter, VolumeConverter):
150
150
  objs = []
151
151
  spatial_figures = []
152
152
  for idx, ann_path in enumerate(item.ann_data, start=1):
153
- for mask, pixel_id in helper.get_annotation_from_nii(ann_path):
154
- class_id = pixel_id if item.is_semantic else idx
153
+ for mask, pixel_value in helper.get_annotation_from_nii(ann_path):
154
+ class_id = pixel_value if item.is_semantic else idx
155
155
  class_name = f"Segment_{class_id}"
156
156
  color = None
157
157
  if item.custom_data.get("cls_color_map") is not None:
@@ -161,7 +161,12 @@ class NiiPlaneStructuredConverter(NiiConverter, VolumeConverter):
161
161
  class_name = renamed_classes.get(class_name, class_name)
162
162
  obj_class = meta.get_obj_class(class_name)
163
163
  if obj_class is None:
164
- obj_class = ObjClass(class_name, Mask3D, color)
164
+ obj_class = ObjClass(
165
+ class_name,
166
+ Mask3D,
167
+ color,
168
+ description=f"{helper.MASK_PIXEL_VALUE}{pixel_value}",
169
+ )
165
170
  meta = meta.add_obj_class(obj_class)
166
171
  self._meta_changed = True
167
172
  self._meta = meta
@@ -126,10 +126,12 @@ class NiiConverter(VolumeConverter):
126
126
  ann_name = get_file_name(ann_name)
127
127
 
128
128
  ann_name = renamed_classes.get(ann_name, ann_name)
129
- for mask, _ in helper.get_annotation_from_nii(ann_path):
129
+ for mask, pixel_value in helper.get_annotation_from_nii(ann_path):
130
130
  obj_class = meta.get_obj_class(ann_name)
131
131
  if obj_class is None:
132
- obj_class = ObjClass(ann_name, Mask3D)
132
+ obj_class = ObjClass(
133
+ ann_name, Mask3D, description=f"{helper.MASK_PIXEL_VALUE}{pixel_value}"
134
+ )
133
135
  meta = meta.add_obj_class(obj_class)
134
136
  self._meta_changed = True
135
137
  self._meta = meta
@@ -15,7 +15,7 @@ from supervisely.volume.volume import convert_3d_nifti_to_nrrd
15
15
 
16
16
  VOLUME_NAME = "anatomic"
17
17
  LABEL_NAME = ["inference", "label", "annotation", "mask", "segmentation"]
18
-
18
+ MASK_PIXEL_VALUE = "Mask pixel value: "
19
19
 
20
20
  class PlanePrefix(str, StrEnum):
21
21
  """Prefix for plane names."""
@@ -769,7 +769,9 @@ class Mask3D(Geometry):
769
769
 
770
770
  from supervisely.volume.volume import _sitk_image_orient_ras
771
771
 
772
- sitk_volume = sitk.GetImageFromArray(self.data)
772
+ # Convert bool data to uint8 for SimpleITK compatibility
773
+ data_for_sitk = self.data.astype(np.uint8) if self.data.dtype == np.bool_ else self.data
774
+ sitk_volume = sitk.GetImageFromArray(data_for_sitk)
773
775
  if self.space_origin is not None:
774
776
  sitk_volume.SetOrigin(self.space_origin)
775
777
  if self.space_directions is not None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.381
3
+ Version: 6.73.382
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -23,7 +23,7 @@ supervisely/api/advanced_api.py,sha256=Nd5cCnHFWc3PSUrCtENxTGtDjS37_lCHXsgXvUI3T
23
23
  supervisely/api/agent_api.py,sha256=8EQBwD6v7KLS0-xKcZ12B7mtzKwG7RRgq1fk1vaN144,8893
24
24
  supervisely/api/annotation_api.py,sha256=U6dHUIOt6Fe8XcbX1MA19z-fg91maOumJAawKG5ZJsk,82876
25
25
  supervisely/api/api.py,sha256=HyW8K0AEsiFf3HV2o9HbS-UJZfuMwWGIJPERbNifgWg,67695
26
- supervisely/api/app_api.py,sha256=-nj-1yvuaj4CSlzUR_YKpTJZpupg56QxLhtSIph_u40,73420
26
+ supervisely/api/app_api.py,sha256=u0DLOTS0jMD73bUFDmJkr1y3Tfw70hmbox1gq5Tw1a4,75707
27
27
  supervisely/api/constants.py,sha256=WfqIcEpRnU4Mcfb6q0njeRs2VVSoTAJaIyrqBkBjP8I,253
28
28
  supervisely/api/dataset_api.py,sha256=7idBMFL8jumWNw-wlBAbQWC09RskG-3GlidfPDukq3Q,47930
29
29
  supervisely/api/entities_collection_api.py,sha256=6nbh5KxBzqGwtjV9tgzMFHBKVla2x-pgIV_xfSL6j4E,9960
@@ -674,9 +674,9 @@ supervisely/convert/volume/dicom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
674
674
  supervisely/convert/volume/dicom/dicom_converter.py,sha256=Hw4RxU_qvllk6M26udZE6G-m1RWR8-VVPcEPwFlqrVg,3354
675
675
  supervisely/convert/volume/dicom/dicom_helper.py,sha256=OrKlyt1hA5BOXKhE1LF1WxBIv3b6t96xRras4OSAuNM,2891
676
676
  supervisely/convert/volume/nii/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
677
- supervisely/convert/volume/nii/nii_planes_volume_converter.py,sha256=dXoBA8AYUOEjLpV2cZJ5n1HDq4_gNhnD__NVsgfc_Qc,14551
678
- supervisely/convert/volume/nii/nii_volume_converter.py,sha256=BAOKX96-bp6WfTFLrCQNrXk2YhKqIFSU5LJ-auKiAfc,8514
679
- supervisely/convert/volume/nii/nii_volume_helper.py,sha256=_FepXNu1RIFuzBOv0aAtrG-J2xN3uyyEMcq6pUD9fsk,14159
677
+ supervisely/convert/volume/nii/nii_planes_volume_converter.py,sha256=-3afZ61BqfMVqTWNa19INn7OR7DqiIx_HhfVi1oHTcE,14751
678
+ supervisely/convert/volume/nii/nii_volume_converter.py,sha256=i8rs7NeDUofsG9uCOZuDe9hiB3IdMB_4PomUX_xo16U,8633
679
+ supervisely/convert/volume/nii/nii_volume_helper.py,sha256=CxUuJGYRVs9Uhhdnzzi7ioaV6gnReorIANGTvfab53o,14198
680
680
  supervisely/convert/volume/sly/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
681
681
  supervisely/convert/volume/sly/sly_volume_converter.py,sha256=XmSuxnRqxchG87b244f3h0UHvOt6IkajMquL1drWlCM,5595
682
682
  supervisely/convert/volume/sly/sly_volume_helper.py,sha256=gUY0GW3zDMlO2y-zQQG36uoXMrKkKz4-ErM1CDxFCxE,5620
@@ -702,7 +702,7 @@ supervisely/geometry/graph.py,sha256=kSShcGU4kZgwAbvTrqGzC55qha0nI7M5luiMZSbNx_4
702
702
  supervisely/geometry/helpers.py,sha256=2gdYMFWTAr836gVXcp-lkDQs9tdaV0ou33kj3mzJBQA,5132
703
703
  supervisely/geometry/image_rotator.py,sha256=wrU8cXEUfuNcmPms2myUV4BpZqz_2oDArsEUFeiTpxs,6888
704
704
  supervisely/geometry/main_tests.py,sha256=K3Olsz9igHDW2IfIA5JOpjoE8bZ3ex2PXvVR2ZCDrHU,27199
705
- supervisely/geometry/mask_3d.py,sha256=gaac4wUoG-qmpVcttgfAh2WhS3VUWjcdNqw5V-Aa5GA,26720
705
+ supervisely/geometry/mask_3d.py,sha256=-wGhQcoksnzUEvxe1joM4y2AIrnbNNxAfgWv5i5CM54,26886
706
706
  supervisely/geometry/multichannel_bitmap.py,sha256=dL0igkOCVZiIZ9LDU7srFLA50XGo4doE-B5_E1uboXM,4968
707
707
  supervisely/geometry/point.py,sha256=7ed_Ipd-Ab8ZeqJF5ft0kP9pKVb2iWXCxPuRhMuweMc,13228
708
708
  supervisely/geometry/point_3d.py,sha256=0ico0aV4fuKNBVrysDjUy1Cx1S9CEzBlEVE3AsbVd0E,1669
@@ -1103,9 +1103,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
1103
1103
  supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
1104
1104
  supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
1105
1105
  supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
1106
- supervisely-6.73.381.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1107
- supervisely-6.73.381.dist-info/METADATA,sha256=UUnBYUyuvA92UG865-LScbY3-NPG-QC8nGKPK8kU_kU,35154
1108
- supervisely-6.73.381.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1109
- supervisely-6.73.381.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1110
- supervisely-6.73.381.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1111
- supervisely-6.73.381.dist-info/RECORD,,
1106
+ supervisely-6.73.382.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1107
+ supervisely-6.73.382.dist-info/METADATA,sha256=va2f5WmgT5z98IN3fzGIi2t8M_p2URzhtN_pSgzAePA,35154
1108
+ supervisely-6.73.382.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1109
+ supervisely-6.73.382.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1110
+ supervisely-6.73.382.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1111
+ supervisely-6.73.382.dist-info/RECORD,,