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.

get_slice_from_ds(i)[source]
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.

find_images()[source]
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.display.entry_main()[source]
on_the_fly.display.main(path, levels, skip, projections)[source]

on_the_fly.extract module

on_the_fly.extract.entry_main()[source]
on_the_fly.extract.main(input_dir, output_dir, volume_geometry, mask_volume_geometry)[source]

on_the_fly.geometry module

on_the_fly.geometry.calculate_mask_index(vg, mask_vg)[source]
on_the_fly.geometry.get_extents_shape(vg)[source]

on_the_fly.normalize module

on_the_fly.normalize.entry_main()[source]
on_the_fly.normalize.main(input_path, scan_type, rotation_angle, output_dir)[source]
on_the_fly.normalize.process_flexray(input_path)[source]
on_the_fly.normalize.process_tomcat(input_path)[source]

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.on_the_fly.hello_world()[source]

Say hello to world.

Returns

Nothing

Return type

NoneType

on_the_fly.process module

on_the_fly.process.entry_main()[source]
on_the_fly.process.main(input_dir, output_dir, weights_file, network, slab_size)[source]

on_the_fly.project module

on_the_fly.project.entry_main()[source]
on_the_fly.project.main(input_dir, output_dir, volume_geometry, mask_volume_geometry, projection_geometry, scan_type)[source]

on_the_fly.reconstruct module

on_the_fly.reconstruct.entry_main()[source]
on_the_fly.reconstruct.main(input_path, scan_type, output_dir, volume_geometry, projection_geometry, rot_center, angle_offset, mask_ratio)[source]
on_the_fly.reconstruct.reconstruct_flexray(proj, volume_geometry, projection_geometry)[source]
on_the_fly.reconstruct.reconstruct_simulation(proj, volume_geometry, projection_geometry)[source]
on_the_fly.reconstruct.reconstruct_tomcat(proj, angle_offset, rot_center)[source]

on_the_fly.resample module

on_the_fly.resample.bicubic(input_vol, output_dir, factor, up=True)[source]
on_the_fly.resample.entry_main()[source]
on_the_fly.resample.main(input_dir, output_dir, factor, direction, method)[source]

on_the_fly.subtract module

on_the_fly.subtract.entry_main()[source]
on_the_fly.subtract.main(a, b, output_dir)[source]

on_the_fly.tomo module

on_the_fly.tomo.astra2flex(proj)[source]
on_the_fly.tomo.fdk(proj_data, vol_geom, proj_geom)[source]
on_the_fly.tomo.flex2astra(proj)[source]
on_the_fly.tomo.load_geometry(path)[source]
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.tomo.load_tiffs(paths, squeeze=False, dtype=None)[source]
on_the_fly.tomo.proj2sino(proj)[source]
on_the_fly.tomo.project(vol_data, vol_geom, proj_geom)[source]
on_the_fly.tomo.save_geometry(path, geometry)[source]
on_the_fly.tomo.save_stack(path, data, *, prefix='output', exist_ok=True, parents=False)[source]
on_the_fly.tomo.sino2proj(proj)[source]

on_the_fly.train module

on_the_fly.train.entry_main()[source]
on_the_fly.train.main(_run, input_dir, target_dir, weights_file, network, slab_size, epochs)[source]
on_the_fly.train.save_network(model, path)[source]

on_the_fly.unet module

class on_the_fly.unet.UNet(n_channels, n_classes)[source]

Bases: torch.nn.modules.module.Module

clear_buffers()[source]
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.

on_the_fly.utils module

on_the_fly.utils.print_run(ex, path)[source]

Module contents

Top-level package for On the fly machine learning for improving image resolution in tomography.