supervisely 6.73.335__py3-none-any.whl → 6.73.337__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.
- supervisely/app/widgets/custom_models_selector/template.html +6 -6
- supervisely/convert/volume/dicom/dicom_converter.py +4 -1
- supervisely/convert/volume/dicom/dicom_helper.py +46 -0
- {supervisely-6.73.335.dist-info → supervisely-6.73.337.dist-info}/METADATA +1 -1
- {supervisely-6.73.335.dist-info → supervisely-6.73.337.dist-info}/RECORD +9 -9
- {supervisely-6.73.335.dist-info → supervisely-6.73.337.dist-info}/LICENSE +0 -0
- {supervisely-6.73.335.dist-info → supervisely-6.73.337.dist-info}/WHEEL +0 -0
- {supervisely-6.73.335.dist-info → supervisely-6.73.337.dist-info}/entry_points.txt +0 -0
- {supervisely-6.73.335.dist-info → supervisely-6.73.337.dist-info}/top_level.txt +0 -0
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
<div v-if="Object.keys(data.{{{widget.widget_id}}}.rowsHtml).length === 0"> You don't have any custom models</div>
|
|
10
10
|
<div v-else>
|
|
11
|
-
|
|
12
11
|
<div v-if="data.{{{widget.widget_id}}}.taskTypes.length > 1">
|
|
13
12
|
<sly-field
|
|
14
13
|
title="Task Type"
|
|
@@ -71,12 +70,13 @@
|
|
|
71
70
|
</tbody>
|
|
72
71
|
</table>
|
|
73
72
|
</div>
|
|
74
|
-
|
|
75
|
-
>
|
|
76
|
-
{{{widget.show_custom_checkpoint_path_checkbox}}}
|
|
77
|
-
<div class="mt10">
|
|
78
|
-
{{{widget.custom_tab_widgets}}}
|
|
73
|
+
|
|
79
74
|
</div>
|
|
75
|
+
<div class="mt10" v-if="{{{widget.show_custom_checkpoint_path}}}"
|
|
76
|
+
>
|
|
77
|
+
{{{widget.show_custom_checkpoint_path_checkbox}}}
|
|
78
|
+
<div class="mt10">
|
|
79
|
+
{{{widget.custom_tab_widgets}}}
|
|
80
80
|
</div>
|
|
81
81
|
</div>
|
|
82
82
|
</div>
|
|
@@ -4,9 +4,9 @@ from supervisely.api.api import Api
|
|
|
4
4
|
from supervisely import generate_free_name, logger, ProjectMeta
|
|
5
5
|
from supervisely.convert.base_converter import AvailableVolumeConverters
|
|
6
6
|
from supervisely.convert.volume.volume_converter import VolumeConverter
|
|
7
|
+
from supervisely.convert.volume.dicom import dicom_helper as h
|
|
7
8
|
from supervisely.volume.volume import inspect_dicom_series, get_extension, read_dicom_serie_volume
|
|
8
9
|
|
|
9
|
-
|
|
10
10
|
class DICOMConverter(VolumeConverter):
|
|
11
11
|
class Item(VolumeConverter.Item):
|
|
12
12
|
"""Item class for DICOM series."""
|
|
@@ -60,6 +60,9 @@ class DICOMConverter(VolumeConverter):
|
|
|
60
60
|
f"Can not recognize file extension {item_path}, serie will be skipped"
|
|
61
61
|
)
|
|
62
62
|
continue
|
|
63
|
+
|
|
64
|
+
for dicom_path in dicom_paths:
|
|
65
|
+
h.convert_to_monochrome2(dicom_path)
|
|
63
66
|
_, meta = read_dicom_serie_volume(dicom_paths, anonymize=True)
|
|
64
67
|
item = self.Item(serie_id=dicom_id, item_paths=dicom_paths, volume_meta=meta)
|
|
65
68
|
self._items.append(item)
|
|
@@ -37,3 +37,49 @@ def dcm_to_nrrd(id: str, paths: List[str]) -> str:
|
|
|
37
37
|
nrrd.write(nrrd_path, volume_np, nrrd_header)
|
|
38
38
|
|
|
39
39
|
return nrrd_path, volume_meta
|
|
40
|
+
|
|
41
|
+
def convert_to_monochrome2(dcm_path: str):
|
|
42
|
+
import pydicom
|
|
43
|
+
|
|
44
|
+
is_modified = False
|
|
45
|
+
|
|
46
|
+
try:
|
|
47
|
+
dcm = pydicom.dcmread(dcm_path)
|
|
48
|
+
except Exception as e:
|
|
49
|
+
logger.warn("Failed to read DICOM file: " + str(e))
|
|
50
|
+
return
|
|
51
|
+
|
|
52
|
+
try:
|
|
53
|
+
if dcm.file_meta.TransferSyntaxUID.is_compressed:
|
|
54
|
+
dcm.decompress()
|
|
55
|
+
is_modified = True
|
|
56
|
+
except Exception as e:
|
|
57
|
+
logger.warn("Failed to decompress DICOM file: " + str(e))
|
|
58
|
+
return
|
|
59
|
+
|
|
60
|
+
if getattr(dcm, "PhotometricInterpretation", None) == "YBR_FULL_422":
|
|
61
|
+
# * Convert dicom to monochrome
|
|
62
|
+
if len(dcm.pixel_array.shape) == 4 and dcm.pixel_array.shape[-1] == 3:
|
|
63
|
+
monochrome = dcm.pixel_array[..., 0].astype(np.uint8)
|
|
64
|
+
else:
|
|
65
|
+
logger.warn("Unexpected shape for YBR_FULL_422 data: " + str(dcm.pixel_array.shape))
|
|
66
|
+
|
|
67
|
+
try:
|
|
68
|
+
dcm.SamplesPerPixel = 1
|
|
69
|
+
dcm.PhotometricInterpretation = "MONOCHROME2"
|
|
70
|
+
dcm.PlanarConfiguration = 0
|
|
71
|
+
if len(monochrome.shape) == 3:
|
|
72
|
+
dcm.NumberOfFrames = str(monochrome.shape[0])
|
|
73
|
+
dcm.Rows, dcm.Columns = monochrome.shape[1:3]
|
|
74
|
+
dcm.PixelData = monochrome.tobytes()
|
|
75
|
+
except AttributeError as ae:
|
|
76
|
+
logger.error(f"Error occurred while converting dicom to monochrome: {ae}")
|
|
77
|
+
|
|
78
|
+
logger.info("Rewriting DICOM file with MONOCHROME2 photometric interpretation.")
|
|
79
|
+
is_modified = True
|
|
80
|
+
|
|
81
|
+
try:
|
|
82
|
+
if is_modified:
|
|
83
|
+
dcm.save_as(dcm_path)
|
|
84
|
+
except Exception as e:
|
|
85
|
+
logger.warn("Failed to save DICOM file: " + str(e))
|
|
@@ -207,7 +207,7 @@ supervisely/app/widgets/copy_to_clipboard/template.html,sha256=4gGPot40yVqFkpVVU
|
|
|
207
207
|
supervisely/app/widgets/custom_models_selector/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
208
208
|
supervisely/app/widgets/custom_models_selector/custom_models_selector.py,sha256=Ww2FCcNqkfX6eGJPejHxHKs7aYDKEOgVRNXEx0Tb0XQ,21493
|
|
209
209
|
supervisely/app/widgets/custom_models_selector/style.css,sha256=-zPPXHnJvatYj_xVVAb7T8uoSsUTyhm5xCKWkkFQ78E,548
|
|
210
|
-
supervisely/app/widgets/custom_models_selector/template.html,sha256=
|
|
210
|
+
supervisely/app/widgets/custom_models_selector/template.html,sha256=Ot7dluekJEUtBWYezAVmcg6PbcEtb2_MRaTBhEnvRjk,2888
|
|
211
211
|
supervisely/app/widgets/dataset_thumbnail/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
212
212
|
supervisely/app/widgets/dataset_thumbnail/dataset_thumbnail.py,sha256=f7l7Te4jPRtvBcjTuUoo_AFRjpTujJHKHNYyt5EIx3Q,4646
|
|
213
213
|
supervisely/app/widgets/dataset_thumbnail/template.html,sha256=yXlpgxkuQEklVY8iXLydKZ07vpG5RLHAmLCKb58l-ac,677
|
|
@@ -661,8 +661,8 @@ supervisely/convert/video/sly/sly_video_helper.py,sha256=D8PgoXpi0y3z-VEqvBLDf_g
|
|
|
661
661
|
supervisely/convert/volume/__init__.py,sha256=RpSYjufciJT6AdhI9Oqp70b3XoFTtSkxFNexoqeOPW4,353
|
|
662
662
|
supervisely/convert/volume/volume_converter.py,sha256=3jpt2Yn_G4FSP_vHFsJHQfYNQpT7q6ar_sRyr_xrPnA,5335
|
|
663
663
|
supervisely/convert/volume/dicom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
664
|
-
supervisely/convert/volume/dicom/dicom_converter.py,sha256=
|
|
665
|
-
supervisely/convert/volume/dicom/dicom_helper.py,sha256=
|
|
664
|
+
supervisely/convert/volume/dicom/dicom_converter.py,sha256=Hw4RxU_qvllk6M26udZE6G-m1RWR8-VVPcEPwFlqrVg,3354
|
|
665
|
+
supervisely/convert/volume/dicom/dicom_helper.py,sha256=OrKlyt1hA5BOXKhE1LF1WxBIv3b6t96xRras4OSAuNM,2891
|
|
666
666
|
supervisely/convert/volume/nii/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
667
667
|
supervisely/convert/volume/nii/nii_planes_volume_converter.py,sha256=9TtN_AgCQgv16Olip6inFanCA5JlEEJ7JQf-0XjIw_Q,7091
|
|
668
668
|
supervisely/convert/volume/nii/nii_volume_converter.py,sha256=IZ6DJeLLbLAW-kifOJ_9ddV3h7gL3AswM2TTbXB9Os0,8476
|
|
@@ -1082,9 +1082,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
1082
1082
|
supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
|
|
1083
1083
|
supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
|
|
1084
1084
|
supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
|
|
1085
|
-
supervisely-6.73.
|
|
1086
|
-
supervisely-6.73.
|
|
1087
|
-
supervisely-6.73.
|
|
1088
|
-
supervisely-6.73.
|
|
1089
|
-
supervisely-6.73.
|
|
1090
|
-
supervisely-6.73.
|
|
1085
|
+
supervisely-6.73.337.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
1086
|
+
supervisely-6.73.337.dist-info/METADATA,sha256=jScEliXar4ZvwI1uw3RQwMuYWDQiojDu2__YBWsvfDg,33596
|
|
1087
|
+
supervisely-6.73.337.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
|
1088
|
+
supervisely-6.73.337.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
|
|
1089
|
+
supervisely-6.73.337.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
|
|
1090
|
+
supervisely-6.73.337.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|