Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use naturalneighbour interpolation instead of linear barycentric #306

Merged
merged 6 commits into from
Jul 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removed epsilon and unused variables
Jordan DeKraker committed Jun 26, 2024
commit 35806ce2c57bc071d705d1284b94a7027eeba33d
4 changes: 0 additions & 4 deletions hippunfold/config/snakebids.yml
Original file line number Diff line number Diff line change
@@ -608,10 +608,6 @@ unfold_vol_ref:
- '2.5'
orient: RPI

unfold_crop_epsilon_fractions:
- 0
- 0
- 0.0625 #1/16

# space for uniform unfolded grid:
# currently only used for interpolating hipp subfields on surface
2 changes: 0 additions & 2 deletions hippunfold/workflow/rules/warps.smk
Original file line number Diff line number Diff line change
@@ -168,7 +168,6 @@ rule create_warps_hipp:
labelmap=get_labels_for_laplace,
params:
gm_labels=lambda wildcards: config["laplace_labels"]["AP"]["gm"],
epsilon=lambda wildcards: config["unfold_crop_epsilon_fractions"],
resources:
mem_mb=16000,
output:
@@ -294,7 +293,6 @@ rule create_warps_dentate:
labelmap=get_labels_for_laplace,
params:
gm_labels=lambda wildcards: config["laplace_labels"]["PD"]["sink"],
epsilon=lambda wildcards: config["unfold_crop_epsilon_fractions"],
resources:
mem_mb=16000,
output:
25 changes: 5 additions & 20 deletions hippunfold/workflow/scripts/create_warps.py
Original file line number Diff line number Diff line change
@@ -105,26 +105,7 @@ def summary(name, array):
coord_flat_pd_unnorm = coord_flat_pd * unfold_dims[1]
coord_flat_io_unnorm = coord_flat_io * unfold_dims[2]

# get unfolded grid (from 0 to 1, not world coords), using meshgrid:
# note: indexing='ij' to swap the ordering of x and y
epsilon = snakemake.params.epsilon
(unfold_gx, unfold_gy, unfold_gz) = np.meshgrid(
np.linspace(
0 + float(epsilon[0]), unfold_dims[0] - float(epsilon[0]), unfold_dims[0]
),
np.linspace(
0 + float(epsilon[1]), unfold_dims[1] - float(epsilon[1]), unfold_dims[1]
),
np.linspace(
0 + float(epsilon[2]), unfold_dims[2] - float(epsilon[2]), unfold_dims[2]
),
indexing="ij",
)
summary("unfold_gx", unfold_gx)
summary("unfold_gy", unfold_gy)
summary("unfold_gz", unfold_gz)

# perform the interpolation
# get unfolded grid

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually looks like noise is added here - so just need to move the comment

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, unfolded_gx unfolded_gy unfolded_gz were no longer used, so I removed them. This also means that epsilon is no longer used, and i believe its no longer needed

points = np.stack(
[
@@ -137,6 +118,10 @@ def summary(name, array):
],
axis=1,
)
summary("points", points)


# perform the interpolation

interp_ap = naturalneighbor.griddata(
points,