Skip to content

Commit

Permalink
data_iterators.py: Remove [0] to properly unpack indexed data
Browse files Browse the repository at this point in the history
This fixes a bug introduced in d87fa5b. 

`[0]` refers specifically to `files = self._data[idx][0]`. By combining the indexes into a single link, the previous commit needed to remove the `[0]` index.
  • Loading branch information
joshuacwnewton authored Apr 19, 2024
1 parent 9945333 commit b2f1831
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nnunetv2/inference/data_iterators.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def __init__(self, list_of_lists: List[List[str]],

def generate_train_batch(self):
idx = self.get_indices()[0]
files, seg_prev_stage, ofile = self._data[idx][0]
files, seg_prev_stage, ofile = self._data[idx]
# if we have a segmentation from the previous stage we have to process it together with the images so that we
# can crop it appropriately (if needed). Otherwise it would just be resized to the shape of the data after
# preprocessing and then there might be misalignments
Expand Down Expand Up @@ -190,7 +190,7 @@ def __init__(self, list_of_images: List[np.ndarray],

def generate_train_batch(self):
idx = self.get_indices()[0]
image, seg_prev_stage, props, ofname = self._data[idx][0]
image, seg_prev_stage, props, ofname = self._data[idx]
# if we have a segmentation from the previous stage we have to process it together with the images so that we
# can crop it appropriately (if needed). Otherwise it would just be resized to the shape of the data after
# preprocessing and then there might be misalignments
Expand Down

0 comments on commit b2f1831

Please sign in to comment.