Skip to content

Commit

Permalink
merge with main
Browse files Browse the repository at this point in the history
  • Loading branch information
ioangatop committed May 6, 2024
2 parents 23190fb + 124ee87 commit c68ffea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 1 addition & 4 deletions docs/DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ Add a new dependency to the `core` submodule:<br>
`pdm add <package_name>`

Add a new dependency to the `vision` submodule:<br>
`pdm add -G vision <package_name>`

After adding a new dependency, you also need to update the `pdm.lock` file:<br>
`pdm update`
`pdm add -G vision -G all <package_name>`

For more information about managing dependencies please look [here](https://pdm-project.org/latest/usage/dependency/#manage-dependencies).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class TotalSegmentator2D(base.ImageSegmentation):
}
"""Dataset version and split to the expected size."""

_sample_every_n_slices: int | None = None
"""The amount of slices to sub-sample per 3D CT scan image."""

_resources_full: List[structs.DownloadResource] = [
structs.DownloadResource(
filename="Totalsegmentator_dataset_v201.zip",
Expand Down Expand Up @@ -161,7 +164,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)
Expand Down Expand Up @@ -199,7 +202,8 @@ 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))
if slide_idx % (self._sample_every_n_slices or 1) == 0
]
return indices

Expand Down

0 comments on commit c68ffea

Please sign in to comment.