Fastr User Reference¶
-
fastr.
toollist
¶ A ToolManager containing all versions of all Tools loaded into the FASTR environment. The ToolManager can be indexed using the Tool id string or a tool id string and a version. For example if you have two versions (4.5 and 4.8) of a tool called Elastix:
>>> fastr.toollist['elastix.Elastix'] Tool Elastix v4.8 (Elastix Registration) Inputs | Outputs -------------------------------------------------------------------------------------------------- fixed_image (ITKImageFile) | directory (Directory) moving_image (ITKImageFile) | transform (ElastixTransformFile) parameters (ElastixParameterFile) | log_file (ElastixLogFile) fixed_mask (ITKImageFile) | moving_mask (ITKImageFile) | initial_transform (ElastixTransformFile) | priority (__Elastix_4.8_interface__priority__Enum__) | threads (Int) | >>> fastr.toollist['elastix.Elastix', '4.5'] Tool Elastix v4.5 (Elastix Registration) Inputs | Outputs -------------------------------------------------------------------------------------------------- fixed_image (ITKImageFile) | directory (Directory) moving_image (ITKImageFile) | transform (ElastixTransformFile) parameters (ElastixParameterFile) | log_file (ElastixLogFile) fixed_mask (ITKImageFile) | moving_mask (ITKImageFile) | initial_transform (ElastixTransformFile) | priority (__Elastix_4.5_interface__priority__Enum__) | threads (Int) |
-
fastr.
typelist
¶ A dictionary containing all types loaded into the FASTR environment. The keys are the typenames and the values are the classes.
-
class
fastr.
Network
(id_='unnamed_network', version=None)[source]¶ The Network class represents a workflow. This includes all Nodes (including ConstantNodes, SourceNodes and Sinks) and Links.
-
add_link
(link)[source]¶ Add a Link to the Network. Make sure the link is in the link list and the link parent is set to this Network
Parameters: link (
Link
) – link to addRaises: - FastrTypeError – if link is incorrectly typed
- FastrNetworkMismatchError – if the link already belongs to another Network
-
add_node
(node)[source]¶ Add a Node to the Network. Make sure the node is in the node list and the node parent is set to this Network
Parameters: node ( Node
) – node to addRaises: FastrTypeError – if node is incorrectly typed
-
create_link
(source, target, id_=None, collapse=None, expand=None)[source]¶ Create a link between two Nodes and add it to the current Network.
Parameters: - source (
BaseOutput
) – the output that is the source of the link - target (
BaseInput
) – the input that is the target of the link - id (str) – the id of the link
Returns: the created link
Type: - source (
-
create_node
(tool, id_=None, stepid=None, cores=None, memory=None, walltime=None, nodegroup=None)[source]¶ Create a Node in this Network. The Node will be automatically added to the Network.
Parameters: Returns: the newly created node
Return type:
-
create_sink
(datatype, id_=None, stepid=None)[source]¶ Create a SinkNode in this Network. The Node will be automatically added to the Network.
Parameters: Returns: the newly created sink node
Return type:
-
create_source
(datatype, id_=None, stepid=None, nodegroup=None, sourcegroup=None)[source]¶ Create a SourceNode in this Network. The Node will be automatically added to the Network.
Parameters: - datatype (
BaseDataType
) – The DataType of the source source_node - id (str) – The id of the source source_node to be created
- stepid (str) – The stepid to add the created source source_node to
- nodegroup (str) – The group the node belongs to, this can be important for FlowNodes and such, as they will have matching dimension names.
- sourcegroup (str) – DEPRECATED! The nodegroup this SourceNode will be added to
Returns: the newly created source source_node
Return type: SourceNode
- datatype (
-
-
class
fastr.
Link
(source, target, parent=None, id_=None, collapse=None, expand=None)[source]¶ Class for linking outputs (
BaseOutput
) to inputs (BaseInput
)Examples:
>>> import fastr >>> network = fastr.Network() >>> link1 = network.create_link( n1.ouputs['out1'], n2.inputs['in2'] ) link2 = Link() link2.source = n1.ouputs['out1'] link2.target = n2.inputs['in2']
-
source
¶ The source
BaseOutput
of the Link. Setting the source will automatically register the Link with the source BaseOutput. Updating source will also make sure the Link is unregistered with the previous source.Raises: FastrTypeError – if assigning a non BaseOutput
-
target
¶ The target
BaseInput
of the Link. Setting the target will automatically register the Link with the target BaseInput. Updating target will also make sure the Link is unregistered with the previous target.Raises: FastrTypeError – if assigning a non BaseInput
-
-
class
fastr.
Node
(tool, id_=None, parent=None, cores=None, memory=None, walltime=None)[source]¶ The class encapsulating a node in the network. The node is responsible for setting and checking inputs and outputs based on the description provided by a tool instance.
-
id_
= None¶ The Node id s a unique string identifying the Node
-
inputs
= None¶ A list of inputs of this Node
-
name
¶ Name of the Tool the Node was based on. In case a Toolless Node was used the class name is given.
-
outputs
= None¶ A list of outputs of this Node
-
-
class
fastr.
ConstantNode
(datatype, data, id_=None)[source]¶ Class encapsulating one output for which a value can be set. For example used to set a scalar value to the input of a node.
-
name
¶ Name of the Tool the Node was based on. In case a Toolless Node was used the class name is given.
-