on_the_fly package¶
Submodules¶
on_the_fly.dataset module¶
-
class
on_the_fly.dataset.
BatchSliceDataset
(dataset, num_before, num_after, reflect=False)[source]¶ Bases:
object
Dataset slice data.
- Arguments:
tensors (Tensor): tensors that have the same size of the first dimension.
-
class
on_the_fly.dataset.
CroppingDataset
(dataset, remove_slices=0, remove_sides=0)[source]¶ Bases:
object
-
class
on_the_fly.dataset.
ImageDataset
(input_path_specifier, target_path_specifier, *, collapse_channels=False, labels=None)[source]¶ Bases:
torch.utils.data.dataset.Dataset
A dataset for images stored on disk.
-
num_labels
¶ The number of labels in this image stack.
If the stack is not labeled, this property access raises a RuntimeError.
- Returns
The number of labels in this image stack.
- Return type
int
-
-
class
on_the_fly.dataset.
ImageStack
(path_specifier, *, collapse_channels=False, labels=None)[source]¶ Bases:
object
A stack of images stored on disk.
An image stack describes a collection of images matching the file path specifier path_specifier.
The images can be tiff files, or any other image filetype supported by imageio.
The image paths are sorted using a natural sorting mechanism. So “scan1.tif” comes before “scan10.tif”.
Images can be retrieved by indexing into the stack. For example:
ImageStack("*.tif")[i]
These images are returned as torch tensors with three dimensions CxHxW.
-
num_labels
¶ The number of labels in this image stack.
If the stack is not labeled, this property access raises a RuntimeError.
- Returns
The number of labels in this image stack.
- Return type
int
-
on_the_fly.display module¶
on_the_fly.extract module¶
on_the_fly.geometry module¶
on_the_fly.normalize module¶
on_the_fly.on_the_fly module¶
Main module.
-
on_the_fly.on_the_fly.
documentation_example
(a, b)[source]¶ This sentence briefly describes the function.
For more information on docstrings, see:
This function returns a tuple containing the input parameters.
- Parameters
a – this is a first parameter (int)
b – this is the second parameter (string)
- Returns
a tuple
- Return type
(int, string)
on_the_fly.process module¶
on_the_fly.project module¶
on_the_fly.reconstruct module¶
on_the_fly.resample module¶
on_the_fly.subtract module¶
on_the_fly.tomo module¶
-
on_the_fly.tomo.
load_stack
(path, *, skip=1, squeeze=False)[source]¶ Load a stack of tiff files.
Make sure that the tiff files are sorted alphabetically, otherwise it is not going to look pretty..
- Parameters
path – path to directory containing tiff files
skip – read every skip image
squeeze – whether to remove any empty dimensions from image
- Returns
an np.array containing the values in the tiff files
- Return type
np.array
on_the_fly.train module¶
on_the_fly.unet module¶
-
class
on_the_fly.unet.
UNet
(n_channels, n_classes)[source]¶ Bases:
torch.nn.modules.module.Module
-
forward
(x)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
class
on_the_fly.unet.
UNetRegressionModel
(c_in, c_out, depth, width, loss_function, dilation, reflect, conv3d)[source]¶ Bases:
msd_pytorch.msd_model.MSDModel
-
class
on_the_fly.unet.
double_conv
(in_ch, out_ch)[source]¶ Bases:
torch.nn.modules.module.Module
(conv => BN => ReLU) * 2
-
forward
(x)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
class
on_the_fly.unet.
down
(in_ch, out_ch)[source]¶ Bases:
torch.nn.modules.module.Module
-
forward
(x)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
class
on_the_fly.unet.
inconv
(in_ch, out_ch)[source]¶ Bases:
torch.nn.modules.module.Module
-
forward
(x)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
class
on_the_fly.unet.
outconv
(in_ch, out_ch)[source]¶ Bases:
torch.nn.modules.module.Module
-
forward
(x)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
class
on_the_fly.unet.
up
(in_ch, out_ch, bilinear=False)[source]¶ Bases:
torch.nn.modules.module.Module
-
forward
(x1, x2)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
Module contents¶
Top-level package for On the fly machine learning for improving image resolution in tomography.