Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update TotalSegmentator2D dataset to fetch all the slices #416

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename method
ioangatop committed May 6, 2024
commit bab039be14f63669c0a7ec1dc138464011ae337d
Original file line number Diff line number Diff line change
@@ -161,7 +161,7 @@ def _get_masks_dir(self, sample_index: int) -> str:
sample_dir = self._samples_dirs[sample_index]
return os.path.join(self._root, sample_dir, "segmentations")

def _get_sample_total_slices(self, sample_index: int) -> int:
def _get_number_of_slices_per_sample(self, sample_index: int) -> int:
"""Returns the total amount of slices of a sample."""
image_path = self._get_image_path(sample_index)
return io.fetch_total_nifti_slices(image_path)
@@ -199,7 +199,7 @@ def _create_indices(self) -> List[Tuple[int, int]]:
indices = [
(sample_idx, slide_idx)
for sample_idx in self._get_split_indices()
for slide_idx in range(self._get_sample_total_slices(sample_idx))
for slide_idx in range(self._get_number_of_slices_per_sample(sample_idx))
]
return indices