niftynet.engine.application_factory module

Loading modules from a string representing the class name or a short name that matches the dictionary item defined in this module

class niftynet.engine.application_factory.ApplicationFactory

Bases: niftynet.engine.application_factory.ModuleFactory

Import an application from niftynet.application or from user specified string

SUPPORTED = {'net_autoencoder': 'niftynet.application.autoencoder_application.AutoencoderApplication', 'net_segment': 'niftynet.application.segmentation_application.SegmentationApplication', 'net_gan': 'niftynet.application.gan_application.GANApplication'}
type_str = 'application'
class niftynet.engine.application_factory.ApplicationNetFactory

Bases: niftynet.engine.application_factory.ModuleFactory

Import a network from niftynet.network or from user specified string

SUPPORTED = {'holisticnet': 'niftynet.network.holistic_net.HolisticNet', 'highres3dnet': 'niftynet.network.highres3dnet.HighRes3DNet', 'highres3dnet_small': 'niftynet.network.highres3dnet_small.HighRes3DNetSmall', 'unet': 'niftynet.network.unet.UNet3D', 'highres3dnet_large': 'niftynet.network.highres3dnet_large.HighRes3DNetLarge', 'vae': 'niftynet.network.vae.VAE', 'toynet': 'niftynet.network.toynet.ToyNet', 'deepmedic': 'niftynet.network.deepmedic.DeepMedic', 'dense_vnet': 'niftynet.network.dense_vnet.DenseVNet', 'scalenet': 'niftynet.network.scalenet.ScaleNet', 'vnet': 'niftynet.network.vnet.VNet', 'simulator_gan': 'niftynet.network.simulator_gan.SimulatorGAN', 'simple_gan': 'niftynet.network.simple_gan.SimpleGAN'}
type_str = 'network'
class niftynet.engine.application_factory.LossAutoencoderFactory

Bases: niftynet.engine.application_factory.ModuleFactory

Import an autoencoder loss function from niftynet.layer or from user specified string

SUPPORTED = {'VariationalLowerBound': 'niftynet.layer.loss_autoencoder.variational_lower_bound'}
type_str = 'autoencoder loss'
class niftynet.engine.application_factory.LossGANFactory

Bases: niftynet.engine.application_factory.ModuleFactory

Import a GAN loss function from niftynet.layer or from user specified string

SUPPORTED = {'CrossEntropy': 'niftynet.layer.loss_gan.cross_entropy'}
type_str = 'GAN loss'
class niftynet.engine.application_factory.LossSegmentationFactory

Bases: niftynet.engine.application_factory.ModuleFactory

Import a segmentation loss function from niftynet.layer or from user specified string

SUPPORTED = {'L2Loss': 'niftynet.layer.loss_segmentation.l2_loss', 'Dice': 'niftynet.layer.loss_segmentation.dice', 'L1Loss': 'niftynet.layer.loss_segmentation.l1_loss', 'CrossEntropy': 'niftynet.layer.loss_segmentation.cross_entropy', 'SensSpec': 'niftynet.layer.loss_segmentation.sensitivity_specificity_loss', 'Huber': 'niftynet.layer.loss_segmentation.huber_loss', 'Dice_NS': 'niftynet.layer.loss_segmentation.dice_nosquare', 'GDSC': 'niftynet.layer.loss_segmentation.generalised_dice_loss', 'WGDL': 'niftynet.layer.loss_segmentation.generalised_wasserstein_dice_loss'}
type_str = 'segmentation loss'
class niftynet.engine.application_factory.ModuleFactory

Bases: object

General interface for importing a class by its name.

SUPPORTED = None
classmethod create(name)

import a class by name

type_str = 'object'
class niftynet.engine.application_factory.OptimiserFactory

Bases: niftynet.engine.application_factory.ModuleFactory

Import an optimiser from niftynet.engine.application_optimiser or from user specified string

SUPPORTED = {'adagrad': 'niftynet.engine.application_optimiser.Adagrad', 'adam': 'niftynet.engine.application_optimiser.Adam', 'momentum': 'niftynet.engine.application_optimiser.Momentum', 'gradientdescent': 'niftynet.engine.application_optimiser.GradientDescent'}
type_str = 'optimizer'
niftynet.engine.application_factory.select_module(module_name, type_str, lookup_table)

This function first tries to find the absolute module name by matching the static dictionary items, if not found, it tries to import the module by splitting the input module_name as module name and class name to be imported.

Parameters:moduel_name – string that matches the keys defined in lookup_table or an absolute class name: module.name.ClassName
Type_str:type of the module (currently used for better error display)
Lookup_table:defines a set of shorthands for absolute class name