MRI and CT Brain Tumor Diagnosis and Grad-CAM Visualization
Project description
Neuroflux
Neuroflux is a Python package that analyzes MRI and CT scans of brains and highlights regions of tumor damage on a heat map.
Installation
To install neuroflux, you can use pip:
pip install neuroflux
The recommended import is:
import neuroflux
MRI Scans
Setup
To begin, declare the following variables:
- case_folder: The folder where the input MRI scans are located (set it to "" if the input files are in the same folder as the program)
- input_flair: The file name of the input FLAIR
- input_t1ce: The file name of the input T1ce
- model_weights: The file name of the predefined model weights
Example setup:
case_folder = "BraTS20"
input_flair = "01_flair.nii"
input_t1ce = "01_t1ce.nii"
model_weights = "mri_weights.h5"
Usage
Neuroflux has three main functions:
- prepare_mri_model(model_weights, img_size=128)
- Creates the U-Net (first step)
- display_slice(folder, input_flair, input_t1ce, slice_num, model, target_layer_name="conv2d_1", img_size=128)
- Displays the Grad-CAM heat map at a given slice number
- display_grid(folder, input_flair, input_t1ce, model, num_slices=84, rows=7, cols=12, start_slice=20, target_layer_name="conv2d_1")
- Displays a grid containing a given number of slices beginning at a given slice number
Example usage:
model = neuroflux.mri.prepare_mri_model(model_weights=model_weights, img_size=img_size)
neuroflux.mri.display_slice(folder=case_folder, input_flair=input_flair, input_t1ce=input_t1ce, slice_num=77, model=model)
neuroflux.mri.display_grid(folder=case_folder,input_flair=input_flair, input_t1ce=input_t1ce, model=model)
CT Scans
Setup
To begin, declare the following variables:
- case_folder: The folder where the input CT scans are located (set it to "" if the input files are in the same folder as the program)
- input: The file name of the input CT scan (can be .jpg, .jpeg, or .png)
- model_weights: The file name of the predefined model weights
Example setup:
case_folder = "CT Scans"
input = "01.jpg"
model_weights = "ct_weights.pth"
Usage
Neuroflux has three main functions:
- prepare_ct_model(model_weights)
- Creates the neural network (first step)
- display_gradcam(folder, input, model)
- Displays the Grad-CAM heat map overlaid on the CT scan
Example usage:
model = neuroflux.ct.prepare_ct_model(model_weights=model_weights)
neuroflux.ct.display_gradcam(folder=case_folder, input=input, model=model)
Notes
- The model weights are not built into this package. Our GitHub contains two options to attain model weights for MRI and CT: Use our pre-trained weights (recommended) or run the Google Colab notebook to create your own unique weights.
- To get more involved, see our website, read our research paper, or contact us at neurofluxai@gmail.com.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file neuroflux-2.4.tar.gz.
File metadata
- Download URL: neuroflux-2.4.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fcb5cad7fba05472c1233db6323da4bed61ecb1dc536890bff35189851b56c8
|
|
| MD5 |
8c40c812210fd5c98b846d1ae0b07be7
|
|
| BLAKE2b-256 |
5e1be927a7c56d711702a333035932b06525cfaf25dbf823db65aad88db75eea
|
File details
Details for the file neuroflux-2.4-py3-none-any.whl.
File metadata
- Download URL: neuroflux-2.4-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2f3e31c005ad4db94a59b14e12fc0c8c6ef80889a6853bbcfb62b8ddf80e6d5
|
|
| MD5 |
42ca2030c3c84720ff1f55ff7b8c3182
|
|
| BLAKE2b-256 |
ddb5efcd83b48b7de98078e312b22fe9f57b5624e9d153031e210c8501075bc6
|