A collection of utilities used for MRI data analysis
Project description
neuroimager
A collection of utilities used for MRI data analysis
Atlas Operation
Suggest you have two probability atlas:
from nilearn import plotting
import nibabel as nib
import os
# Plot the original prob masks
atlas_path = "./assets/masks/"
files = [
"HarvardOxford-sub-prob-1mm.nii.gz",
"JHU-ICBM-tracts-prob-1mm.nii.gz",
]
atlas_paths = [os.path.join(atlas_path, file) for file in files]
# plot listed atlases with nilearn.plotting.plot_prob_atlas
for file in atlas_paths:
img = nib.load(file)
plotting.plot_prob_atlas(img, title=file, draw_cross=False, threshold="auto")
plotting.show()
Then you can use the atlas_operation to do some operations on the atlases:
## Remove selected regions
```python
from neuroimager.utils import filter_rois
harvard_sub = nib.load("./assets/masks/HarvardOxford-sub-prob-1mm.nii.gz")
rois_to_remove = [0, 1, 11, 12] # remove the cortical regions in this atlas
output_path = "./assets/output/filtered_harvard_sub.nii.gz"
filtered_atlas = filter_rois(harvard_sub, rois_to_remove, output_path)
plotting.plot_prob_atlas(filtered_atlas, draw_cross=False, threshold="auto")
plotting.show()
Merge two atlases
from neuroimager.utils import combine_probabilistic_atlases
atlas_paths = [
"./assets/output/filtered_harvard_sub.nii.gz",
"./assets/masks/JHU-ICBM-tracts-prob-1mm.nii.gz",
]
combined_atlas = combine_probabilistic_atlases(
atlas_paths, "./assets/output/combined_prob_atlas.nii.gz"
)
plotting.plot_roi(combined_atlas, title="3D Atlas")
plotting.show()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
neuroimager-0.0.6.tar.gz
(28.4 kB
view hashes)
Built Distribution
Close
Hashes for neuroimager-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f9dc74dc8b9be8d055557da084eff380f6b34a80ab247f210931e1aa57ef747 |
|
MD5 | b386b2a2bf21bcb2a3e8098dcc3b92c3 |
|
BLAKE2b-256 | b4eb32f6ccc7c703e5a1da5a85d3c76324eec20231427213dfe9b53e0fde587d |