Skip to content

Nuance pin integration minor adjustments #355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions integrations/nuance_pin/app/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
LoadImaged,
Orientationd,
ScaleIntensityRanged,
Spacingd,
ToDeviced,
ToTensord,
)
Expand Down Expand Up @@ -182,6 +183,7 @@ def pre_process(self, img_reader) -> Compose:
),
ToDeviced(keys=image_key, device="cuda"),
EnsureChannelFirstd(keys=image_key),
Spacingd(keys=image_key, pixdim=(0.703125, 0.703125, 1.25)),
Orientationd(
keys=image_key,
axcodes="RAS",
Expand Down
10 changes: 8 additions & 2 deletions integrations/nuance_pin/app/post_inference_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def compute(self, op_input: InputContext, op_output: OutputContext, context: Exe
detection_result: DetectionResult = op_input.get("detection_predictions").detection_list[0]
output_path = op_output.get("gsps_files").path

slice_coords = [-inst.first_pixel_on_slice_normal[2] for inst in selected_series.series.get_sop_instances()]
slice_coords = list(range(len(selected_series.series.get_sop_instances())))

series_uid = hd.UID()
series_number = randint(1, 100000)
Expand Down Expand Up @@ -119,6 +119,12 @@ def compute(self, op_input: InputContext, op_output: OutputContext, context: Exe
graphic_annotations=[annotation],
institution_name="MONAI",
institutional_department_name="Deploy",
voi_lut_transformations=[
hd.pr.SoftcopyVOILUTTransformation(
window_center=-550.0,
window_width=1350.0,
)
],
)

gsps.save_as(os.path.join(output_path, f"gsps-{inst_num:04d}.dcm"))
Expand Down Expand Up @@ -167,7 +173,7 @@ def compute(self, op_input: InputContext, op_output: OutputContext, context: Exe
procedure_text="CT Chest wo IV Contrast",
)

slice_coords = [-inst.first_pixel_on_slice_normal[2] for inst in selected_series.series.get_sop_instances()]
slice_coords = list(range(len(selected_series.series.get_sop_instances())))

for box_data, box_score in zip(detection_result.box_data, detection_result.score_data):

Expand Down