Skip to content
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

Try using image or SC mask #2

Open
naga-karthik opened this issue Jun 22, 2023 · 0 comments
Open

Try using image or SC mask #2

naga-karthik opened this issue Jun 22, 2023 · 0 comments

Comments

@naga-karthik
Copy link
Collaborator

The issues with convergence of mutual information with INR T1w and INR T2w could be improved by using an image mask or the spinal cord mask. Here's a snippet I used for the image mask:

import nibabel as nib
from skimage import filters

input_img_nii = nib.load(input_path)
input_img = input_img_nii.get_fdata()

# "Minimum" method from scipy.filters gives a decent SC image mask 
# cuts out part of the image where the contrast is too low but rest is fine
thr = filters.threshold_minimum(input_img, nbins=256)
mask = input_img > thr

# create nii image and save
mask_nii = nib.Nifti1Image(mask, input_img_nii.affine, input_img_nii.header)
nib.save(mask_nii, output_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant