Skip to content

Commit 817481c

Browse files
got rid of dpipe
1 parent 3fcfd6a commit 817481c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

amid/luna25.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import numpy as np
66
import pandas as pd
77
import SimpleITK as sitk
8-
from dpipe.im.box import limit_box
9-
from dpipe.itertools import collect
108

119
from .internals import Dataset, field, licenses, register
1210

@@ -107,8 +105,8 @@ def sex(self, i):
107105
return self._data_column_value(i, 'Gender')
108106

109107
@field
110-
@collect
111108
def nodules(self, i):
109+
nodules = []
112110
for row in self._data_rows(i).itertuples():
113111
coords = np.array([row.CoordX, row.CoordY, row.CoordZ])
114112
nodule_block_metadata = self.nodule_block_metadata(row.AnnotationID)
@@ -117,16 +115,17 @@ def nodules(self, i):
117115
direction = np.array(self._direction(i)[::4])
118116
center_voxel = ((coords[::-1] - image_origin) / self.spacing(i)) * direction
119117
bbox_start_point = ((nodule_block_metadata['origin'] - image_origin) / self.spacing(i)) * direction
120-
bbox = limit_box([bbox_start_point, bbox_start_point + np.array([64, 128, 128])], self.image(i).shape)
121-
yield LUNA25Nodule(
118+
bbox = [bbox_start_point, np.minimum(bbox_start_point + np.array([64, 128, 128]), self.image(i).shape)]
119+
nodules.append(LUNA25Nodule(
122120
coords=coords,
123121
lesion_id=row.LesionID,
124122
annotation_id=str(row.AnnotationID),
125123
nodule_id=str(row.NoduleID),
126124
malignancy=row.label,
127125
center_voxel=np.round(center_voxel).astype(int),
128126
bbox=np.round(bbox).astype(int),
129-
)
127+
))
128+
return nodules
130129

131130
def nodule_block_image(self, annotation_id):
132131
return np.load(self.root / f'luna25_nodule_blocks/image/{annotation_id}.npy')

0 commit comments

Comments
 (0)