Skip to content
Snippets Groups Projects
Commit fa93584b authored by Tamino Huxohl's avatar Tamino Huxohl
Browse files

revice documentation of dataset module

parent c513d919
No related branches found
No related tags found
No related merge requests found
"""
Module containing the default MuMapDataset definition.
A dataset that maps a reconstruction to an attenuation map.
"""
from __future__ import annotations
import os
......
"""
Module containing normalization methods either as functions
or transformers.
or transforms.
"""
from typing import Any, Callable, Optional, Tuple
......@@ -19,7 +19,7 @@ def norm_max(tensor: Tensor) -> Tensor:
return (tensor - tensor.min()) / (tensor.max() - tensor.min())
def norm_mean(tensor: Tensor):
def norm_mean(tensor: Tensor) -> Transform:
"""
Perform mean normalization on a tensor.
......@@ -28,7 +28,7 @@ def norm_mean(tensor: Tensor):
return tensor / tensor.mean()
def norm_gaussian(tensor: Tensor):
def norm_gaussian(tensor: Tensor) -> Transform:
"""
Perform Gaussian normalization on a tensor.
......
"""
Module containing the MuMapPatchDataset which transforms
the MuMapDataset in a way that patches of the reconstructions
and attenuation maps are returned.
"""
import math
import random
......@@ -55,6 +60,18 @@ class MuMapPatchDataset(MuMapDataset):
self.generate_patches()
def copy(self, split_name: str):
"""
Copy the dataset and modify the split.
Parameters
----------
split_name: str
the name of the split the copy is about
Returns
-------
MuMapPatchDataset
"""
kwargs = self.kwargs.copy()
kwargs["split_name"] = split_name
return MuMapPatchDataset(
......@@ -105,6 +122,13 @@ class MuMapPatchDataset(MuMapDataset):
self.patches.append((_id, z, y, x, padding))
def __getitem__(self, index: int):
"""
Get a reconstruction attenuation map patch pair by index.
Parameters
----------
index: int
"""
_id, z, y, x, padding = self.patches[index]
ps = self.patch_size
ps_z = self.patch_size_z
......
"""
Module containing transforms for dataset.
This can be pre-processing steps such as padding or cropping and augmentations
applied during training time.
"""
import math
from typing import List, Tuple
......
"""
Dataset utility method.
Currently, the only available method aligns images at
their central slice.
"""
from typing import Tuple
import numpy as np
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment