Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
143e32e
rdme with todos
neuronflow Feb 12, 2024
7d4c26c
tut
neuronflow Feb 14, 2024
c746e4d
gi
neuronflow Feb 14, 2024
9ceb311
utils
neuronflow Feb 14, 2024
80a9870
data
neuronflow Feb 14, 2024
2dcd161
init
neuronflow Feb 14, 2024
4815a66
add preprocessed data
neuronflow Feb 14, 2024
fa2beca
start segmentation
neuronflow Feb 14, 2024
6536add
add documentation
neuronflow Feb 14, 2024
9b8dfb1
change file names, introduce fusion
neuronflow Feb 14, 2024
f4b0101
clean
neuronflow Feb 14, 2024
b571cad
new: todos added
neuronflow Feb 14, 2024
37fed72
todos
neuronflow Feb 14, 2024
b2736a6
first outputs
neuronflow Feb 14, 2024
95a3d40
clean
neuronflow Feb 15, 2024
efa68a2
gi
neuronflow Feb 15, 2024
cd7cd65
Merge branch 'main' into 23-feature-request-glioma-segmentation-tutor…
neuronflow Feb 15, 2024
c0c90eb
clean
neuronflow Feb 15, 2024
5698f73
interim
neuronflow Feb 15, 2024
dd1f76b
gi
neuronflow Feb 15, 2024
1bf0c72
change
neuronflow Feb 15, 2024
335f9ae
simplify prep
neuronflow Feb 15, 2024
73acd24
prep data
neuronflow Feb 15, 2024
bda8842
rdme
neuronflow Feb 15, 2024
bc96066
seg
neuronflow Feb 15, 2024
18330ed
prep
neuronflow Feb 15, 2024
3f8df62
fus
neuronflow Feb 15, 2024
dda095e
fix: loop
neuronflow Feb 15, 2024
48c2581
segmentations
neuronflow Feb 15, 2024
3f66405
update
neuronflow Feb 15, 2024
21b9752
better preprocessed
neuronflow Feb 16, 2024
1b640b6
skullstripped
neuronflow Feb 16, 2024
0e12454
clean
Feb 16, 2024
41b1b2d
try with non-normalized
neuronflow Feb 16, 2024
6293d7d
segs
Feb 16, 2024
28af20a
Merge branch '23-feature-request-glioma-segmentation-tutorial-with-br…
Feb 16, 2024
388b330
fusion and segmentation working
Feb 16, 2024
a9bcf46
clean
Feb 16, 2024
2d77c55
clean norm
Feb 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions BraTS-Toolkit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# Preprocessing tutorials
This folder contains tutorials for the [BraTS Toolkit package](https://github.com/neuronflow/BraTS-Toolkit). Please have a look at the Jupyter notebooks.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2,577 changes: 2,577 additions & 0 deletions BraTS-Toolkit/glioma_segmentation_with_BraTS_Toolkit.ipynb

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions BraTS-Toolkit/temporary_directory/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
43 changes: 43 additions & 0 deletions BraTS-Toolkit/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import os
import matplotlib.pyplot as plt
import nibabel as nib

DATA_FOLDER = "data"


def visualize_data(data_folder: str = DATA_FOLDER, slice_index: int = 75):
"""Visualize the MRI modalities for a given slice index

Args:
data_folder (str, optional): Path to the folder containing the t1, t1c, t2 & flair file. Defaults to DATA_FOLDER.
slice_index (int, optional): Slice to be visualized (first index in data of shape (155, 240, 240)). Defaults to 75.
"""
_, axes = plt.subplots(1, 4, figsize=(12, 10))

modalities = ["t1", "t1c", "t2", "flair"]
for i, mod in enumerate(modalities):
modality_file = os.path.join(data_folder, f"{mod}.nii.gz")
modality_np = nib.load(modality_file).get_fdata().transpose(2, 1, 0)
axes[i].set_title(mod)
axes[i].imshow(modality_np[slice_index, :, :], cmap="gray")
axes[i].axis("off")


def visualize_segmentation(modality_file: str, segmentation_file: str):
"""Visualize the MRI modality and the segmentation

Args:
modality_file (str): Path to the desired modality file
segmentation_file (str): Path to the segmentation file
"""
modality_np = nib.load(modality_file).get_fdata().transpose(2, 1, 0)
seg_np = nib.load(segmentation_file).get_fdata().transpose(2, 1, 0)
_, ax = plt.subplots(1, 2, figsize=(8, 4))

slice_index = modality_np.shape[0] // 2 # You can choose any slice here
ax[0].imshow(modality_np[slice_index, :, :], cmap="gray")
ax[1].imshow(modality_np[slice_index, :, :], cmap="gray")
ax[1].imshow(seg_np[slice_index, :, :], cmap="plasma", alpha=0.3)
for ax in ax:
ax.axis("off")
plt.tight_layout()
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading