From ff3860200093685777f17d79f1e8b1b642a33fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20P=C3=A9rez-Garc=C3=ADa?= Date: Sat, 11 Feb 2023 16:17:28 +0000 Subject: [PATCH] Remove Visible Human Project datasets --- docs/source/datasets.rst | 33 ------------ src/torchio/datasets/__init__.py | 4 -- src/torchio/datasets/visible_human.py | 77 --------------------------- 3 files changed, 114 deletions(-) delete mode 100644 src/torchio/datasets/visible_human.py diff --git a/docs/source/datasets.rst b/docs/source/datasets.rst index e22e60713..fa0a39ed5 100644 --- a/docs/source/datasets.rst +++ b/docs/source/datasets.rst @@ -115,39 +115,6 @@ MNI .. autoclass:: BITE3 -.. currentmodule:: torchio.datasets.visible_human - - -Visible Human Project ---------------------- - -The `Visible Human Project `_ -is an effort to create a detailed data set of cross-sectional photographs of -the human body, in order to facilitate anatomy visualization applications. -It is used as a tool for the progression of medical findings, in which these -findings link anatomy to its audiences. -A male and a female cadaver were cut into thin slices which were then -photographed and digitized (from `Wikipedia `_). - -:class:`VisibleMale` -~~~~~~~~~~~~~~~~~~~~ - -.. autoclass:: VisibleMale -.. plot:: - - import torchio as tio - tio.datasets.VisibleMale('Shoulder').plot() - - -:class:`VisibleFemale` -~~~~~~~~~~~~~~~~~~~~~~ - -.. autoclass:: VisibleFemale -.. plot:: - - import torchio as tio - tio.datasets.VisibleFemale('Shoulder').plot() - ITK-SNAP -------- diff --git a/src/torchio/datasets/__init__.py b/src/torchio/datasets/__init__.py index 363d074d6..9df142352 100644 --- a/src/torchio/datasets/__init__.py +++ b/src/torchio/datasets/__init__.py @@ -19,8 +19,6 @@ from .rsna_miccai import RSNAMICCAI from .rsna_spine_fracture import RSNACervicalSpineFracture from .slicer import Slicer -from .visible_human import VisibleFemale -from .visible_human import VisibleMale __all__ = [ @@ -39,8 +37,6 @@ 'Sheep', 'Pediatric', 'ICBM2009CNonlinearSymmetric', - 'VisibleFemale', - 'VisibleMale', 'OrganMNIST3D', 'NoduleMNIST3D', 'AdrenalMNIST3D', diff --git a/src/torchio/datasets/visible_human.py b/src/torchio/datasets/visible_human.py deleted file mode 100644 index beb839963..000000000 --- a/src/torchio/datasets/visible_human.py +++ /dev/null @@ -1,77 +0,0 @@ -import tempfile -from typing import Tuple - -from .. import ScalarImage -from ..data.subject import _RawSubjectCopySubject -from ..download import download_and_extract_archive -from ..utils import get_torchio_cache_dir - - -class VisibleHuman(_RawSubjectCopySubject): - - URL = 'https://mri.radiology.uiowa.edu/website_documents/visible_human_tar_files/{}{}.tar.gz' # noqa: E501, FS003 - PARTS: Tuple[str, ...] - - def __init__(self, part: str): - self.part = self._parse_part(part) - if not self.cache_part_dir.is_dir(): - tempdir = tempfile.gettempdir() - filename = f'{self.__class__.__name__}-{self.part}.tar.gz' - download_and_extract_archive( - self.url, - tempdir, - filename=filename, - extract_root=self.cache_class_dir, - remove_finished=True, - ) - super().__init__({self.part.lower(): ScalarImage(self.cache_part_dir)}) - - @property - def cache_class_dir(self): - return get_torchio_cache_dir() / self.__class__.__name__ - - @property - def cache_part_dir(self): - return self.cache_class_dir / self.part - - @property - def url(self): - return self.URL.format(self.PREFIX, self.part) - - def _parse_part(self, part: str) -> str: - part_capital = part.capitalize() - if part_capital not in self.PARTS: # type: ignore[assignment] - message = f'Part "{part}" not in available parts: {self.PARTS}' - raise ValueError(message) - return part_capital - - -class VisibleMale(VisibleHuman): - """Visible Male CT Datasets. - - Args: - part: Can be ``'Head'``, ``'Hip'``, ``'Pelvis'`` or ``'Shoulder'``. - """ - - PREFIX = 'VHMCT1mm_' - PARTS = ( - 'Head', - 'Hip', - 'Pelvis', - 'Shoulder', - ) - - -class VisibleFemale(VisibleHuman): - """Visible Female CT Datasets. - - Args: - part: Can be ``'Ankle'``, ``'Head'``, ``'Hip'``, ``'Knee'``, - ``'Pelvis'`` or ``'Shoulder'``. - """ - - PREFIX = 'VHF-' - PARTS = VisibleMale.PARTS + ( - 'Ankle', - 'Knee', - )