Skip to content

Commit

Permalink
docs(all): inheritance of doc string
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianbalsiger committed Oct 16, 2020
1 parent 24985df commit 53a6d1a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
1 change: 0 additions & 1 deletion pymia/data/assembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def subjects_ready(self):

def add_batch(self, to_assemble: typing.Union[np.ndarray, typing.Dict[str, np.ndarray]], sample_indices: np.ndarray,
last_batch=False, **kwargs):
"""see :meth:`Assembler.add_batch`"""
if not isinstance(to_assemble, dict):
to_assemble = {'__prediction': to_assemble}

Expand Down
14 changes: 0 additions & 14 deletions pymia/data/creation/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,14 @@ def __init__(self, callbacks: typing.List[Callback]) -> None:
self.callbacks = callbacks

def on_start(self, params: dict):
"""See :meth:`.Callback.on_start`."""
for c in self.callbacks:
c.on_start(params)

def on_end(self, params: dict):
"""See :meth:`.Callback.on_end`."""
for c in self.callbacks:
c.on_end(params)

def on_subject(self, params: dict):
"""See :meth:`.Callback.on_subject`."""
for c in self.callbacks:
c.on_subject(params)

Expand All @@ -77,17 +74,14 @@ class MonitoringCallback(Callback):
"""Callback that monitors the dataset creation process by logging the progress to the console."""

def on_start(self, params: dict):
"""See :meth:`.Callback.on_start`."""
print('start dataset creation')

def on_subject(self, params: dict):
"""See :meth:`.Callback.on_subject`."""
index = params[defs.KEY_SUBJECT_INDEX]
subject_files = params[defs.KEY_SUBJECT_FILES]
print('[{}/{}] {}'.format(index + 1, len(subject_files), subject_files[index].subject))

def on_end(self, params: dict):
"""See :meth:`.Callback.on_end`."""
print('dataset creation finished')


Expand All @@ -102,7 +96,6 @@ def __init__(self, writer: wr.Writer) -> None:
self.writer = writer

def on_subject(self, params: dict):
"""See :meth:`.Callback.on_subject`."""
subject_files = params[defs.KEY_SUBJECT_FILES]
subject_index = params[defs.KEY_SUBJECT_INDEX]

Expand All @@ -125,13 +118,11 @@ def __init__(self, writer: wr.Writer) -> None:
self.reserved_for_shape = False

def on_start(self, params: dict):
"""See :meth:`.Callback.on_start`."""
subject_count = len(params[defs.KEY_SUBJECT_FILES])
self.writer.reserve(defs.LOC_SUBJECT, (subject_count,), str)
self.reserved_for_shape = False

def on_subject(self, params: dict):
"""See :meth:`.Callback.on_subject`."""
subject_files = params[defs.KEY_SUBJECT_FILES]
subject_index = params[defs.KEY_SUBJECT_INDEX]

Expand Down Expand Up @@ -165,15 +156,13 @@ def __init__(self, writer: wr.Writer, category=defs.KEY_IMAGES) -> None:
self.new_subject = False

def on_start(self, params: dict):
"""See :meth:`.Callback.on_start`."""
subject_count = len(params[defs.KEY_SUBJECT_FILES])
self.writer.reserve(defs.LOC_IMGPROP_SHAPE, (subject_count, 3), dtype=np.uint16)
self.writer.reserve(defs.LOC_IMGPROP_ORIGIN, (subject_count, 3), dtype=np.float)
self.writer.reserve(defs.LOC_IMGPROP_DIRECTION, (subject_count, 9), dtype=np.float)
self.writer.reserve(defs.LOC_IMGPROP_SPACING, (subject_count, 3), dtype=np.float)

def on_subject(self, params: dict):
"""See :meth:`.Callback.on_subject`."""
subject_index = params[defs.KEY_SUBJECT_INDEX]
properties = params[defs.KEY_PLACEHOLDER_PROPERTIES.format(self.category)] # type: conv.ImageProperties

Expand All @@ -194,7 +183,6 @@ def __init__(self, writer: wr.Writer) -> None:
self.writer = writer

def on_start(self, params: dict):
"""See :meth:`.Callback.on_start`."""
for category in params[defs.KEY_CATEGORIES]:
self.writer.write(defs.LOC_NAMES_PLACEHOLDER.format(category),
params[defs.KEY_PLACEHOLDER_NAMES.format(category)], dtype='str')
Expand All @@ -218,7 +206,6 @@ def get_subject_common(subject_file: subj.SubjectFile):
return os.path.commonpath([get_subject_common(sf) for sf in subject_files])

def on_start(self, params: dict):
"""See :meth:`.Callback.on_start`."""
subject_files = params[defs.KEY_SUBJECT_FILES]
self.file_root = self._get_common_path(subject_files)
if os.path.isfile(self.file_root): # only the case if only one file
Expand All @@ -230,7 +217,6 @@ def on_start(self, params: dict):
(len(subject_files), len(params[defs.KEY_PLACEHOLDER_NAMES.format(category)])), dtype='str')

def on_subject(self, params: dict):
"""See :meth:`.Callback.on_subject`."""
subject_index = params[defs.KEY_SUBJECT_INDEX]
subject_files = params[defs.KEY_SUBJECT_FILES]

Expand Down

0 comments on commit 53a6d1a

Please sign in to comment.