Skip to content

Commit 2cd41b6

Browse files
committed
Change main() to test(), and Path to str
1 parent d596f74 commit 2cd41b6

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

monai/deploy/operators/dicom_data_loader_operator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def populate_series_attributes(self, series, sop_instance):
244244
pass
245245

246246

247-
def main():
247+
def test():
248248
data_path = "../../../examples/ai_spleen_seg_data/dcm"
249249

250250
loader = DICOMDataLoaderOperator()
@@ -258,4 +258,4 @@ def main():
258258

259259

260260
if __name__ == "__main__":
261-
main()
261+
test()

monai/deploy/operators/dicom_seg_writer_operator.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def compute(self, op_input: InputContext, op_output: OutputContext, context: Exe
121121
output_dir = op_output.get().path
122122
output_dir.mkdir(parents=True, exist_ok=True)
123123

124-
self.process_images(seg_image_numpy, dicom_series, output_path)
124+
self.process_images(seg_image, study_selected_series_list, output_dir)
125125

126126
def process_images(
127127
self, image: Union[Image, Path], study_selected_series_list: StudySelectedSeries, output_dir: Path
@@ -146,7 +146,6 @@ def process_images(
146146
DICOMSegmentationWriterOperator.DCM_EXTENSION,
147147
)
148148
output_path = output_dir / output_filename
149-
150149
# Pick DICOM Series that was used as input for getting the seg image.
151150
# For now, first one in the list.
152151
for study_selected_series in study_selected_series_list:
@@ -164,16 +163,16 @@ def create_dicom_seg(self, image: Image, dicom_series: DICOMSeries, file_path: P
164163
# DICOM Seg creation
165164
self._seg_writer = DICOMSegWriter()
166165
try:
167-
self._seg_writer.write(image, dicom_dataset_list, file_path.name, self._seg_labels)
166+
self._seg_writer.write(image, dicom_dataset_list, str(file_path), self._seg_labels)
168167
# TODO: get a class to encapsulate the seg label information.
169168

170169
# Test reading back
171-
_ = self._read_from_dcm(file_path.name)
170+
_ = self._read_from_dcm(str(file_path))
172171
except Exception as ex:
173172
print("DICOMSeg creation failed. Error:\n{}".format(ex))
174173
raise
175174

176-
def _read_from_dcm(self, file_path):
175+
def _read_from_dcm(self, file_path: str):
177176
"""Read dcm file into pydicom Dataset
178177
179178
Args:

monai/deploy/operators/dicom_series_selector_operator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def _print_instance_properties(obj: object, pre_fix: str = None, print_val=True)
279279
print(f"{pre_fix} {attribute}: {type(attr_val)} {attr_val if print_val else ''}")
280280

281281

282-
def main():
282+
def test():
283283
from pathlib import Path
284284

285285
from monai.deploy.operators.dicom_data_loader_operator import DICOMDataLoaderOperator
@@ -349,4 +349,4 @@ def main():
349349
"""
350350

351351
if __name__ == "__main__":
352-
main()
352+
test()

monai/deploy/operators/dicom_series_to_volume_operator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def _get_instance_properties(obj: object, not_none: bool = True) -> Dict:
337337
return prop_dict
338338

339339

340-
def main():
340+
def test():
341341

342342
from pathlib import Path
343343

@@ -359,4 +359,4 @@ def main():
359359

360360

361361
if __name__ == "__main__":
362-
main()
362+
test()

0 commit comments

Comments
 (0)