Euniceyeee commited on
Commit
b3356b8
1 Parent(s): d644bcc

Update kidney-ct-abnormality.py

Browse files
Files changed (1) hide show
  1. kidney-ct-abnormality.py +10 -2
kidney-ct-abnormality.py CHANGED
@@ -50,7 +50,7 @@ class KidneyCTAbnormality(datasets.GeneratorBasedBuilder):
50
  features=datasets.Features(
51
  {
52
  "images": datasets.Sequence(datasets.Image()),
53
- "img_f64_array": datasets.Array3D(dtype = 'float64'),
54
  "label": datasets.ClassLabel(num_classes=2, names=LABELS),
55
  }
56
  ),
@@ -90,6 +90,8 @@ class KidneyCTAbnormality(datasets.GeneratorBasedBuilder):
90
 
91
  def _generate_examples(self, filepath, metadata):
92
  """Generate images and labels for splits."""
 
 
93
  for i, meta in enumerate(metadata):
94
  img_path = os.path.join(
95
  filepath,
@@ -100,9 +102,15 @@ class KidneyCTAbnormality(datasets.GeneratorBasedBuilder):
100
  img = sitk.ReadImage(img_path)
101
  img_array = sitk.GetArrayFromImage(img)
102
  img_array_c = img_array.astype('uint8')
 
 
 
 
 
 
103
  # img_array_cr = img_array_c.transpose(2, 0, 1)[..., np.newaxis]
104
  yield i, {
105
  "images": img_array_c,
106
- "img_f64_array": img_array,
107
  "label": meta["abnormality"],
108
  }
 
50
  features=datasets.Features(
51
  {
52
  "images": datasets.Sequence(datasets.Image()),
53
+ # "img_f64_array": datasets.Array3D(dtype = 'float64'),
54
  "label": datasets.ClassLabel(num_classes=2, names=LABELS),
55
  }
56
  ),
 
90
 
91
  def _generate_examples(self, filepath, metadata):
92
  """Generate images and labels for splits."""
93
+ h = 0
94
+ w = 0
95
  for i, meta in enumerate(metadata):
96
  img_path = os.path.join(
97
  filepath,
 
102
  img = sitk.ReadImage(img_path)
103
  img_array = sitk.GetArrayFromImage(img)
104
  img_array_c = img_array.astype('uint8')
105
+ if img_array_c.shape[0]>h:
106
+ h = img_array_c.shape[0]
107
+ print(h)
108
+ if img_array_c.shape[1]>w:
109
+ w = img_array_c.shape[1]
110
+ print(w)
111
  # img_array_cr = img_array_c.transpose(2, 0, 1)[..., np.newaxis]
112
  yield i, {
113
  "images": img_array_c,
114
+ # "img_f64_array": img_array,
115
  "label": meta["abnormality"],
116
  }