|
27 | 27 | .. autofunction:: init_bold_surf_wf
|
28 | 28 | .. autofunction:: init_wb_vol_surf_wf
|
29 | 29 | .. autofunction:: init_wb_surf_surf_wf
|
30 |
| -.. autofunction:: init_bold_surf_wb_wf |
31 | 30 | .. autofunction:: init_bold_fsLR_resampling_wf
|
32 | 31 | .. autofunction:: init_bold_grayords_wf
|
33 | 32 | .. autofunction:: init_goodvoxels_bold_mask_wf
|
@@ -836,199 +835,6 @@ def init_wb_surf_surf_wf(
|
836 | 835 | return workflow
|
837 | 836 |
|
838 | 837 |
|
839 |
| -def init_bold_surf_wb_wf( |
840 |
| - space: str, |
841 |
| - density: ty.Literal['10k', '32k', '41k'], |
842 |
| - omp_nthreads: int, |
843 |
| - mem_gb: float, |
844 |
| - name: str = 'bold_surf_wb_wf', |
845 |
| -): |
846 |
| - """Resample BOLD time series to surface using the Connectome Workbench. |
847 |
| -
|
848 |
| - This workflow is modified from ``init_bold_fsLR_resampling_wf``. |
849 |
| -
|
850 |
| - Workflow Graph |
851 |
| - .. workflow:: |
852 |
| - :graph2use: colored |
853 |
| - :simple_form: yes |
854 |
| -
|
855 |
| - from fmriprep.workflows.bold.resampling import init_bold_surf_wb_wf |
856 |
| - wf = init_bold_surf_wb_wf( |
857 |
| - space='onavg', |
858 |
| - density='10k', |
859 |
| - omp_nthreads=1, |
860 |
| - mem_gb=1, |
861 |
| - ) |
862 |
| - Parameters |
863 |
| - ---------- |
864 |
| - space : :class:`str` |
865 |
| - Surface template space, such as ``"onavg"`` or ``"fsLR"``. |
866 |
| - density : :class:`str` |
867 |
| - Either ``"10k"``, ``"32k"``, or ``"41k"``, representing the number of vertices |
868 |
| - per hemisphere. |
869 |
| - omp_nthreads : :class:`int` |
870 |
| - Maximum number of threads an individual process may use. |
871 |
| - mem_gb : :class:`float` |
872 |
| - Size of BOLD file in GB. |
873 |
| - name : :class:`str` |
874 |
| - Name of workflow (default: ``bold_surf_wb_wf``). |
875 |
| -
|
876 |
| - Inputs |
877 |
| - ------ |
878 |
| - bold_file : :class:`str` |
879 |
| - Path to BOLD file resampled into T1 space |
880 |
| - white : :class:`list` of :class:`str` |
881 |
| - Path to left and right hemisphere white matter GIFTI surfaces. |
882 |
| - pial : :class:`list` of :class:`str` |
883 |
| - Path to left and right hemisphere pial GIFTI surfaces. |
884 |
| - midthickness : :class:`list` of :class:`str` |
885 |
| - Path to left and right hemisphere midthickness GIFTI surfaces. |
886 |
| - midthickness_resampled : :class:`list` of :class:`str` |
887 |
| - Path to left and right hemisphere midthickness GIFTI surfaces resampled into the output |
888 |
| - space. |
889 |
| - sphere_reg_fsLR : :class:`list` of :class:`str` |
890 |
| - Path to left and right hemisphere sphere.reg GIFTI surfaces, mapping from subject to fsLR. |
891 |
| - volume_roi : :class:`str` or Undefined |
892 |
| - Pre-calculated goodvoxels mask. Not required. |
893 |
| -
|
894 |
| - Outputs |
895 |
| - ------- |
896 |
| - bold_resampled : :class:`list` of :class:`str` |
897 |
| - Path to BOLD series resampled as functional GIFTI files in template space. |
898 |
| -
|
899 |
| - """ |
900 |
| - import templateflow.api as tf |
901 |
| - from niworkflows.engine.workflows import LiterateWorkflow as Workflow |
902 |
| - from niworkflows.interfaces.utility import KeySelect |
903 |
| - |
904 |
| - from fmriprep.interfaces.workbench import VolumeToSurfaceMapping |
905 |
| - |
906 |
| - workflow = Workflow(name=name) |
907 |
| - |
908 |
| - space_str = 'onavg [@onavg]' if space == 'onavg' else space |
909 |
| - workflow.__desc__ = f"""\ |
910 |
| -The BOLD time-series were resampled onto the {space_str} space |
911 |
| -using the Connectome Workbench [@hcppipelines]. |
912 |
| -""" |
913 |
| - |
914 |
| - inputnode = pe.Node( |
915 |
| - niu.IdentityInterface( |
916 |
| - fields=[ |
917 |
| - 'bold_file', |
918 |
| - 'white', |
919 |
| - 'pial', |
920 |
| - 'midthickness', |
921 |
| - 'midthickness_resampled', |
922 |
| - 'sphere_reg_fsLR', |
923 |
| - 'volume_roi', |
924 |
| - ] |
925 |
| - ), |
926 |
| - name='inputnode', |
927 |
| - ) |
928 |
| - |
929 |
| - hemisource = pe.Node( |
930 |
| - niu.IdentityInterface(fields=['hemi']), |
931 |
| - name='hemisource', |
932 |
| - iterables=[('hemi', ['L', 'R'])], |
933 |
| - ) |
934 |
| - |
935 |
| - joinnode = pe.JoinNode( |
936 |
| - niu.IdentityInterface(fields=['bold_resampled']), |
937 |
| - name='joinnode', |
938 |
| - joinsource='hemisource', |
939 |
| - ) |
940 |
| - |
941 |
| - outputnode = pe.Node( |
942 |
| - niu.IdentityInterface(fields=['bold_resampled']), |
943 |
| - name='outputnode', |
944 |
| - ) |
945 |
| - |
946 |
| - # select white, midthickness and pial surfaces based on hemi |
947 |
| - select_surfaces = pe.Node( |
948 |
| - KeySelect( |
949 |
| - fields=[ |
950 |
| - 'white', |
951 |
| - 'pial', |
952 |
| - 'midthickness', |
953 |
| - 'midthickness_resampled', |
954 |
| - 'sphere_reg_fsLR', |
955 |
| - 'template_sphere', |
956 |
| - ], |
957 |
| - keys=['L', 'R'], |
958 |
| - ), |
959 |
| - name='select_surfaces', |
960 |
| - run_without_submitting=True, |
961 |
| - ) |
962 |
| - select_surfaces.inputs.template_sphere = [ |
963 |
| - str(sphere) |
964 |
| - for sphere in tf.get( |
965 |
| - template=space, |
966 |
| - space=('fsLR' if space != 'fsLR' else None), |
967 |
| - density=density, |
968 |
| - suffix='sphere', |
969 |
| - extension='.surf.gii', |
970 |
| - ) |
971 |
| - ] |
972 |
| - |
973 |
| - # RibbonVolumeToSurfaceMapping.sh |
974 |
| - # Line 85 thru ... |
975 |
| - volume_to_surface = pe.Node( |
976 |
| - VolumeToSurfaceMapping(method='ribbon-constrained'), |
977 |
| - name='volume_to_surface', |
978 |
| - mem_gb=mem_gb * 3, |
979 |
| - n_procs=omp_nthreads, |
980 |
| - ) |
981 |
| - metric_dilate = pe.Node( |
982 |
| - MetricDilate(distance=10, nearest=True), |
983 |
| - name='metric_dilate', |
984 |
| - mem_gb=1, |
985 |
| - n_procs=omp_nthreads, |
986 |
| - ) |
987 |
| - resample_to_template = pe.Node( |
988 |
| - MetricResample(method='ADAP_BARY_AREA', area_surfs=True), |
989 |
| - name='resample_to_template', |
990 |
| - mem_gb=1, |
991 |
| - n_procs=omp_nthreads, |
992 |
| - ) |
993 |
| - # ... line 89 |
994 |
| - |
995 |
| - workflow.connect([ |
996 |
| - (inputnode, select_surfaces, [ |
997 |
| - ('white', 'white'), |
998 |
| - ('pial', 'pial'), |
999 |
| - ('midthickness', 'midthickness'), |
1000 |
| - ('midthickness_resampled', 'midthickness_resampled'), |
1001 |
| - ('sphere_reg_fsLR', 'sphere_reg_fsLR'), |
1002 |
| - ]), |
1003 |
| - (hemisource, select_surfaces, [('hemi', 'key')]), |
1004 |
| - # Resample BOLD to native surface, dilate and mask |
1005 |
| - (inputnode, volume_to_surface, [ |
1006 |
| - ('bold_file', 'volume_file'), |
1007 |
| - ('volume_roi', 'volume_roi'), |
1008 |
| - ]), |
1009 |
| - (select_surfaces, volume_to_surface, [ |
1010 |
| - ('midthickness', 'surface_file'), |
1011 |
| - ('white', 'inner_surface'), |
1012 |
| - ('pial', 'outer_surface'), |
1013 |
| - ]), |
1014 |
| - (select_surfaces, metric_dilate, [('midthickness', 'surf_file')]), |
1015 |
| - (volume_to_surface, metric_dilate, [('out_file', 'in_file')]), |
1016 |
| - # Resample BOLD to output space and mask |
1017 |
| - (select_surfaces, resample_to_template, [ |
1018 |
| - ('sphere_reg_fsLR', 'current_sphere'), |
1019 |
| - ('template_sphere', 'new_sphere'), |
1020 |
| - ('midthickness', 'current_area'), |
1021 |
| - ('midthickness_resampled', 'new_area'), |
1022 |
| - ]), |
1023 |
| - (metric_dilate, resample_to_template, [('out_file', 'in_file')]), |
1024 |
| - # Output |
1025 |
| - (resample_to_template, joinnode, [('out_file', 'bold_resampled')]), |
1026 |
| - (joinnode, outputnode, [('bold_resampled', 'bold_resampled')]), |
1027 |
| - ]) # fmt:skip |
1028 |
| - |
1029 |
| - return workflow |
1030 |
| - |
1031 |
| - |
1032 | 838 | def init_bold_fsLR_resampling_wf(
|
1033 | 839 | grayord_density: ty.Literal['91k', '170k'],
|
1034 | 840 | omp_nthreads: int,
|
|
0 commit comments