Skip to content

Commit

Permalink
BUG: Should be whichtoinvert
Browse files Browse the repository at this point in the history
  • Loading branch information
ntustison committed Jan 2, 2024
1 parent 1d64706 commit 550bcfa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions antspynet/utilities/lesion_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ def lesion_segmentation(t1,
t1_preprocessed = ants.image_clone(t1)
brain_mask = ants.threshold_image(t1_preprocessed, 0, 0, 0, 1)

image = t1_preprocessed
image = (image - image.min()) / (image.max() - image.min())

if do_patch_based_prediction:

################################
Expand Down Expand Up @@ -122,6 +119,9 @@ def lesion_segmentation(t1,
if verbose:
print("Extract patches.")

image = t1_preprocessed
image = (image - image.min()) / (image.max() - image.min())

image_patches = extract_image_patches(image,
patch_size=patch_size,
max_number_of_patches="all",
Expand Down Expand Up @@ -199,7 +199,7 @@ def lesion_segmentation(t1,
if verbose:
print("Alignment to template.")

registration = ants.registration(template, image, type_of_transform="antsRegistrationSyNQuick[r]",
registration = ants.registration(template, t1_preprocessed, type_of_transform="antsRegistrationSyNQuick[r]",
verbose=verbose)
image = registration['warpedmovout']
image = (image - image.min()) / (image.max() - image.min())
Expand All @@ -210,8 +210,8 @@ def lesion_segmentation(t1,
lesion_mask_array = np.squeeze(unet_model.predict(image_array, verbose=verbose))
lesion_mask = ants.copy_image_info(template, ants.from_numpy(lesion_mask_array))

probability_image = ants.apply_transforms(t1, lesion_mask, registration['invtransforms'],
which_to_invert=[True], verbose=verbose)
probability_image = ants.apply_transforms(t1_preprocessed, lesion_mask, registration['invtransforms'],
whichtoinvert=[True], verbose=verbose)

return(probability_image)

0 comments on commit 550bcfa

Please sign in to comment.