Skip to content

Commit

Permalink
Merge branch 'dev-v2.0.0' into hires-inject
Browse files Browse the repository at this point in the history
  • Loading branch information
akhanf authored Feb 12, 2025
2 parents ef9c6f5 + 3b6f5db commit 37bd22c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ jobs:
- name: Test manualseg bids, with path override
run: |
poetry run hippunfold test_data/bids_manualseg test_out participant -np --modality manualseg --path_manualseg test_data/bids_manualseg/sub-{subject}_hemi-{hemi}_dseg.nii.gz
poetry run hippunfold test_data/bids_dsegtissue test_out participant -np --modality dsegtissue --path_dsegtissue test_data/bids_dsegtissue/sub-{subject}_hemi-{hemi}_dseg.nii.gz
- name: Test manualseg bids, one hemisphere hemi
run: |
poetry run hippunfold test_data/bids_manualseg_1hemi test_out participant -np --modality manualseg --hemi L
poetry run hippunfold test_data/bids_dsegtissue_1hemi test_out participant -np --modality dsegtissue --hemi L
- name: Test T2w with T1w template registration
run: |
Expand Down
25 changes: 17 additions & 8 deletions hippunfold/workflow/rules/coords.smk
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ rule get_nan_mask:
suffix="mask.nii.gz",
space="corobl",
dir="{dir}",
desc="nan",
desc="{srcsink,src|sink}",
hemi="{hemi}",
label="{label}",
**inputs.subj_wildcards,
Expand All @@ -123,19 +123,28 @@ rule get_nan_mask:
"c3d {input} -background -1 -retain-labels {params} -binarize {output}"


rule get_src_sink_mask:
rule get_src_sink_sdt:
"""calculate signed distance transform (negative inside, positive outside)"""
input:
labelmap=get_labels_for_laplace,
params:
labels=get_src_sink_labels,
output:
mask=bids(
root=work,
datatype="coords",
suffix="mask.nii.gz",
space="corobl",
dir="{dir}",
desc="{srcsink,src|sink}",
desc="{srcsink}",
hemi="{hemi}",
label="{label}",
**inputs.subj_wildcards,
),
output:
sdt=bids(
root=work,
datatype="coords",
suffix="sdt.nii.gz",
space="corobl",
dir="{dir}",
desc="{srcsink}",
hemi="{hemi}",
label="{label}",
**inputs.subj_wildcards,
Expand All @@ -147,7 +156,7 @@ rule get_src_sink_mask:
group:
"subj"
shell:
"c3d {input} -background -1 -retain-labels {params} -binarize {output}"
"c3d {input} -sdt -o {output}"


rule get_src_sink_sdt:
Expand Down
2 changes: 2 additions & 0 deletions hippunfold/workflow/scripts/laplace_beltrami.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def get_terminal_indices_percentile(
def get_terminal_indices_threshold(
sdt, min_dist, max_dist, min_vertices, boundary_mask
):

"""
Gets the terminal (src/sink) vertex indices based on distance to the src/sink mask,
a boundary mask, and a minumum number of vertices. The distance from the mask is
Expand Down Expand Up @@ -248,6 +249,7 @@ def solve_laplace_beltrami_open_mesh(vertices, faces, boundary_conditions=None):
logger.info(f"# of src boundary vertices: {len(src_indices)}")
logger.info(f"# of sink boundary vertices: {len(sink_indices)}")


src_vals = [0 for i in range(len(src_indices))]
sink_vals = [1 for i in range(len(sink_indices))]

Expand Down

0 comments on commit 37bd22c

Please sign in to comment.