Skip to content

Commit

Permalink
Update inference for changes in preprocessing.
Browse files Browse the repository at this point in the history
  • Loading branch information
aecelaya committed Sep 19, 2024
1 parent 8a45c95 commit 60f4e65
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions mist/inference/main_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def test_time_inference(df,
no_preprocess=False,
output_std=False):
config = read_json_file(config_file)

create_empty_dir(dest)

# Set up rich progress bar
Expand Down Expand Up @@ -367,18 +367,15 @@ def test_time_inference(df,
og_ants_img = ants.image_read(image_list[0])

if no_preprocess:
torch_img, _, fg_bbox, _ = convert_nifti_to_numpy(image_list, None)
preprocessed_example = convert_nifti_to_numpy(image_list)
else:
torch_img, _, fg_bbox, _ = preprocess_example(
config,
image_list,
None,
False,
False,
None
preprocessed_example = preprocess_example(
config,
image_list,
)

# Make image channels first and add batch dimension
torch_img = preprocessed_example["image"]
torch_img = np.transpose(torch_img, axes=(3, 0, 1, 2))
torch_img = np.expand_dims(torch_img, axis=0)

Expand All @@ -394,7 +391,7 @@ def test_time_inference(df,
blend_mode,
tta,
output_std,
fg_bbox
preprocessed_example["fg_bbox"]
)

# Apply postprocessing if required
Expand Down

0 comments on commit 60f4e65

Please sign in to comment.