lookup_file = op.join(fs_dir, 'FreeSurferColorLUT.txt') subjects_dir = op.join(fs_dir, 'subjects/') output_dir = './tessellate_tutorial' """ Inputs ====== Create the tessellation workflow and set inputs Here we will choose Gifti (gii) as the output format, because we want to able to view the surface in ConnectomeViewer. In you intend to view the meshes in gmsh or Blender, you should change the workflow creation to use stereolithographic (stl) format. """ tessflow = create_tessellation_flow(name='tessflow', out_format='gii') tessflow.inputs.inputspec.subject_id = 'fsaverage' tessflow.inputs.inputspec.subjects_dir = subjects_dir tessflow.inputs.inputspec.lookup_file = lookup_file """ We also create a conditional node to package the surfaces for ConnectomeViewer. Simply set cff to "False" to ignore this step. """ cff = True if cff: cff = pe.Node(interface=cmtk.CFFConverter(), name='cff') cff.inputs.out_file = 'Meshes.cff' """ Outputs =======
giftiLabels = pe.Node(interface=util.Merge(2), name="GiftiLabels") niftiVolumes = pe.Node(interface=util.Merge(3), name="NiftiVolumes") fiberDataArrays = pe.Node(interface=util.Merge(4), name="FiberDataArrays") gpickledNetworks = pe.Node(interface=util.Merge(2), name="NetworkFiles") """ We also create a workflow to calculate several network metrics on our resulting file, and another CFF converter which will be used to package these networks into a single file. """ networkx = create_networkx_pipeline(name='networkx') cmats_to_csv = create_cmats_to_csv_pipeline(name='cmats_to_csv') NxStatsCFFConverter = pe.Node(interface=cmtk.CFFConverter(), name="NxStatsCFFConverter") NxStatsCFFConverter.inputs.script_files = op.abspath(inspect.getfile(inspect.currentframe())) tessflow = create_tessellation_flow(name='tessflow', out_format='gii') tessflow.inputs.inputspec.lookup_file = lookup_file """ Connecting the workflow ======================= Here we connect our processing pipeline. Connecting the inputs, FreeSurfer nodes, and conversions -------------------------------------------------------- """ mapping = pe.Workflow(name='mapping') """ First, we connect the input node to the FreeSurfer input nodes.
Set the default directory and lookup table (LUT) paths """ fs_dir = os.environ['FREESURFER_HOME'] lookup_file = op.join(fs_dir,'FreeSurferColorLUT.txt') subjects_dir = op.join(fs_dir, 'subjects/') output_dir = './tessellate_tutorial' """ Inputs ====== Create the tessellation workflow and set inputs """ tessflow = create_tessellation_flow(name='tessflow') tessflow.inputs.inputspec.subject_id = 'fsaverage' tessflow.inputs.inputspec.subjects_dir = subjects_dir tessflow.inputs.inputspec.lookup_file = lookup_file """ Outputs ======= Create a datasink to organize the smoothed meshes Using regular-expression substitutions we can remove the extraneous folders generated by the mapnode. """ datasink = pe.Node(interface=nio.DataSink(), name="datasink") datasink.inputs.base_directory = 'meshes' datasink.inputs.regexp_substitutions = [('_smoother[\d]*/', '')]
giftiLabels = pe.Node(interface=util.Merge(2), name="GiftiLabels") niftiVolumes = pe.Node(interface=util.Merge(3), name="NiftiVolumes") fiberDataArrays = pe.Node(interface=util.Merge(4), name="FiberDataArrays") gpickledNetworks = pe.Node(interface=util.Merge(2), name="NetworkFiles") """ We also create a workflow to calculate several network metrics on our resulting file, and another CFF converter which will be used to package these networks into a single file. """ networkx = create_networkx_pipeline(name="networkx") cmats_to_csv = create_cmats_to_csv_pipeline(name="cmats_to_csv") NxStatsCFFConverter = pe.Node(interface=cmtk.CFFConverter(), name="NxStatsCFFConverter") NxStatsCFFConverter.inputs.script_files = op.abspath(inspect.getfile(inspect.currentframe())) tessflow = create_tessellation_flow(name="tessflow", out_format="gii") tessflow.inputs.inputspec.lookup_file = lookup_file """ Connecting the workflow ======================= Here we connect our processing pipeline. Connecting the inputs, FreeSurfer nodes, and conversions -------------------------------------------------------- """ mapping = pe.Workflow(name="mapping") """ First, we connect the input node to the FreeSurfer input nodes.
Set the default directory and lookup table (LUT) paths """ fs_dir = os.environ['FREESURFER_HOME'] lookup_file = op.join(fs_dir, 'FreeSurferColorLUT.txt') subjects_dir = op.join(fs_dir, 'subjects/') output_dir = './tessellate_tutorial' """ Inputs ====== Create the tessellation workflow and set inputs """ tessflow = create_tessellation_flow(name='tessflow') tessflow.inputs.inputspec.subject_id = 'fsaverage' tessflow.inputs.inputspec.subjects_dir = subjects_dir tessflow.inputs.inputspec.lookup_file = lookup_file """ Outputs ======= Create a datasink to organize the smoothed meshes Using regular-expression substitutions we can remove the extraneous folders generated by the mapnode. """ datasink = pe.Node(interface=nio.DataSink(), name="datasink") datasink.inputs.base_directory = 'meshes' datasink.inputs.regexp_substitutions = [('_smoother[\d]*/', '')] """