Commit c795e05f authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

ENH: bring back option to have uniform density at surface

parent 1ae45c43
Pipeline #4857 canceled with stage
......@@ -32,7 +32,8 @@ parser.add_argument('-s2', '--second_rbf', default=7., type=float,
help='RBF Dipole size during the second optimisation step in mm (default: 7)')
parser.add_argument('-td', '--target_density',
help='GIFTI (.shape.gii) file with the target surface density in number of streamlines per vertex '
'(default: uniform per unit of cortical volume)')
'(default: uniform per unit of cortical volume).'
'Can be set to "white", "mid", or "pial" to be uniform on that surface.')
parser.add_argument('--ignore_bad_dyads', action='store_true',
help='ignore alignment constraint for voxels where the dyad is undefined')
args = parser.parse_args()
......@@ -76,6 +77,10 @@ white_surf = CorticalMesh.read(args.white)[surf_mask]
if args.target_density is None:
target_density = Cortex([white_surf, CorticalMesh.read(args.pial)[surf_mask]]).wedge_volume()
elif args.target_density in ('white', 'mid', 'pial'):
fn = getattr(args, 'mid_thickness' if args.target_density == 'mid' else args.target_density)
surf = CorticalMesh.read(fn)[surf_mask]
target_density = surf.size_faces()
else:
target_density_vertex = nib.load(args.target_density).darrays[0].data[surf_mask]
target_density = white_surf.graph_connection_point().T.dot(target_density_vertex) / 3.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment