Source code for WORC.resources.fastr_tests.CalcFeatures_test
#!/usr/bin/env python# Copyright 2017-2018 Biomedical Imaging Group Rotterdam, Departments of# Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.IS_TEST=True
[docs]defcreate_network():# Import the faster environment and set it upimportfastr# Create a new networknetwork=fastr.Network(id_='CalcFeatures_test')# Create a source node in the networksource_segmentation=network.create_source('ITKImageFile',id_='segmentation')source_image=network.create_source('ITKImageFile',id_='image')source_metadata=network.create_source('DicomImageFile',id_='metadata')source_parameters=network.create_source('ParameterFile',id_='parameters')# Create a new node in the network using toollistnode_calfeatures=network.create_node('CalcFeatures',id_="calcfeatures")# Create a link between the source output and an input of the addint nodenode_calfeatures.inputs['segmentation']=source_segmentation.outputnode_calfeatures.inputs['image']=source_image.outputnode_calfeatures.inputs['metadata']=source_metadata.outputnode_calfeatures.inputs['parameters']=source_parameters.output# Create a sink to save the datasink_features=network.create_sink('HDF5',id_='features')# Link the addint node to the sinksink_features.input=node_calfeatures.outputs['features']returnnetwork