Datasets:
YongchengYAO
commited on
Commit
·
77df0c8
1
Parent(s):
206fdcc
update
Browse files- OAIZIB-CM.py +7 -9
OAIZIB-CM.py
CHANGED
@@ -32,8 +32,8 @@ class OAIZIBCMDataset(GeneratorBasedBuilder):
|
|
32 |
" - CartiMorph: https://github.com/YongchengYAO/CartiMorph\n"
|
33 |
" - CartiMorph Toolbox: https://github.com/YongchengYAO/CartiMorph-Toolbox\n"
|
34 |
" - https://github.com/YongchengYAO/CMT-AMAI24paper\n\n"
|
35 |
-
"Please cite the following if you use the dataset:\n"
|
36 |
-
"
|
37 |
"title = {CartiMorph: A framework for automated knee articular cartilage morphometrics},\n"
|
38 |
"journal = {Medical Image Analysis},\n"
|
39 |
"author = {Yongcheng Yao and Junru Zhong and Liping Zhang and Sheheryar Khan and Weitian Chen},\n"
|
@@ -67,11 +67,11 @@ class OAIZIBCMDataset(GeneratorBasedBuilder):
|
|
67 |
)
|
68 |
|
69 |
def _split_generators(self, dl_manager):
|
70 |
-
#
|
71 |
base_dir = os.path.dirname(__file__)
|
72 |
-
# Construct absolute paths for the CSV files.
|
73 |
train_csv_path = os.path.join(base_dir, "train.csv")
|
74 |
test_csv_path = os.path.join(base_dir, "test.csv")
|
|
|
75 |
train_df = pd.read_csv(train_csv_path)
|
76 |
test_df = pd.read_csv(test_csv_path)
|
77 |
return [
|
@@ -95,12 +95,10 @@ class OAIZIBCMDataset(GeneratorBasedBuilder):
|
|
95 |
base_img_dir = ""
|
96 |
base_mask_dir = ""
|
97 |
|
98 |
-
# Iterate over each row in the CSV file; assume the CSV has 2 columns
|
99 |
for idx, row in df.iterrows():
|
100 |
-
|
101 |
-
|
102 |
-
mask_file = row[1]
|
103 |
-
# Construct full paths
|
104 |
img_path = os.path.join(base_img_dir, img_file)
|
105 |
mask_path = os.path.join(base_mask_dir, mask_file)
|
106 |
try:
|
|
|
32 |
" - CartiMorph: https://github.com/YongchengYAO/CartiMorph\n"
|
33 |
" - CartiMorph Toolbox: https://github.com/YongchengYAO/CartiMorph-Toolbox\n"
|
34 |
" - https://github.com/YongchengYAO/CMT-AMAI24paper\n\n"
|
35 |
+
"Please cite the following if you use the dataset:\n\n"
|
36 |
+
"@article{YAO2024103035,\n"
|
37 |
"title = {CartiMorph: A framework for automated knee articular cartilage morphometrics},\n"
|
38 |
"journal = {Medical Image Analysis},\n"
|
39 |
"author = {Yongcheng Yao and Junru Zhong and Liping Zhang and Sheheryar Khan and Weitian Chen},\n"
|
|
|
67 |
)
|
68 |
|
69 |
def _split_generators(self, dl_manager):
|
70 |
+
# Use the directory of the current script to locate CSV files reliably.
|
71 |
base_dir = os.path.dirname(__file__)
|
|
|
72 |
train_csv_path = os.path.join(base_dir, "train.csv")
|
73 |
test_csv_path = os.path.join(base_dir, "test.csv")
|
74 |
+
|
75 |
train_df = pd.read_csv(train_csv_path)
|
76 |
test_df = pd.read_csv(test_csv_path)
|
77 |
return [
|
|
|
95 |
base_img_dir = ""
|
96 |
base_mask_dir = ""
|
97 |
|
98 |
+
# Iterate over each row in the CSV file; assume the CSV has 2 columns: 'image' and 'mask'
|
99 |
for idx, row in df.iterrows():
|
100 |
+
img_file = row["image"]
|
101 |
+
mask_file = row["mask"]
|
|
|
|
|
102 |
img_path = os.path.join(base_img_dir, img_file)
|
103 |
mask_path = os.path.join(base_mask_dir, mask_file)
|
104 |
try:
|