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, filename=None)[source]¶ The NetworkRun contains the entire Run state for a Network execution. It has a working copy of the network, but also includes all temporary data required for the execution. These objects are meant to be single use.
-
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 (
-
draw_network
(name='network_layout', img_format='svg', draw_dimension=False, expand_macro=False)[source]¶ Output a dot file and try to convert it to an image file.
Parameters: img_format (str) – extension of the image format to convert to Returns: path of the image created or None if failed Return type: str or None
-
-
class
fastr.
Link
(source, target, parent, 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
-