Update prostate158.py
Browse files- prostate158.py +10 -1
prostate158.py
CHANGED
|
@@ -5,6 +5,7 @@ import pandas as pd
|
|
| 5 |
import numpy as np
|
| 6 |
from pathlib import Path
|
| 7 |
import os
|
|
|
|
| 8 |
|
| 9 |
_DESCRIPTION = "Prostate dataset."
|
| 10 |
|
|
@@ -87,9 +88,17 @@ class Prostate158Dataset(datasets.GeneratorBasedBuilder):
|
|
| 87 |
print(os.listdir(downloaded_files))
|
| 88 |
df = pd.read_csv(downloaded_files / f"{split}.csv")
|
| 89 |
images_folder = downloaded_files / split
|
| 90 |
-
|
| 91 |
for idx, row in df.iterrows():
|
| 92 |
print(row)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
break
|
| 94 |
|
| 95 |
elif self.config.name == "3d":
|
|
|
|
| 5 |
import numpy as np
|
| 6 |
from pathlib import Path
|
| 7 |
import os
|
| 8 |
+
import nibabel as nib
|
| 9 |
|
| 10 |
_DESCRIPTION = "Prostate dataset."
|
| 11 |
|
|
|
|
| 88 |
print(os.listdir(downloaded_files))
|
| 89 |
df = pd.read_csv(downloaded_files / f"{split}.csv")
|
| 90 |
images_folder = downloaded_files / split
|
| 91 |
+
yield_index = 0
|
| 92 |
for idx, row in df.iterrows():
|
| 93 |
print(row)
|
| 94 |
+
|
| 95 |
+
# we will return t2 adc dwi t2_anatomy_reader1 adc_tumor_reader1
|
| 96 |
+
images_list = ["t2", "adc", "dwi", "t2_anatomy_reader1", "adc_tumor_reader1"]
|
| 97 |
+
|
| 98 |
+
images_data = {image_name: nib.load(images_folder / row[image_name]) for image_name in images_list}
|
| 99 |
+
print("example_shape", images_data["t2"].shape)
|
| 100 |
+
for i in range(images_data["t2"].shape[2]):
|
| 101 |
+
|
| 102 |
break
|
| 103 |
|
| 104 |
elif self.config.name == "3d":
|