Skip to content

Commit

Permalink
Merge pull request #78 from KVSlab/hotfix-prepare-output-surface
Browse files Browse the repository at this point in the history
Hotfix for prepare_output_surface
  • Loading branch information
hkjeldsberg authored Sep 28, 2022
2 parents def4a82 + 48bae90 commit d1dfad1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ workflows:
jobs:
install-and-test:
docker:
- image: cimg/python:3.9
- image: cimg/python:3.10.6
working_directory: ~/repo
steps:
- checkout
Expand All @@ -23,14 +23,15 @@ jobs:
# Export path
export PATH="$HOME/miniconda/bin:$PATH"
hash -r
# Set conda parameters
conda config --set always_yes yes --set changeps1 no
conda config --add channels conda-forge
conda config --set channel_priority strict
# Set up environment
conda create -n morphman morphman
conda install mamba
mamba create -n morphman morphman
# Activate environment
source activate morphman
Expand Down
6 changes: 3 additions & 3 deletions morphman/common/surface_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,10 @@ def prepare_output_surface(surface, original_surface, new_centerline, output_fil
# Get relevant points
tmp_points = points[region_id == i]

# Get normal
# Get slightly downscaled normal
tmp_normal = np.cross(tmp_points[0] - tmp_points[-1],
tmp_points[0] - tmp_points[tmp_points.shape[0] // 2])
normal = tmp_normal / np.sqrt(np.sum(tmp_normal ** 2))
normal = tmp_normal / np.sqrt(np.sum(tmp_normal ** 2) * 1.02)

# Get Center
center = np.mean(tmp_points, axis=0)
Expand All @@ -532,7 +532,7 @@ def prepare_output_surface(surface, original_surface, new_centerline, output_fil
in_dir = np.array(line.GetPoint(line.GetNumberOfPoints() - 5)) - \
np.array(line.GetPoint(line.GetNumberOfPoints() - 1))

in_dir = in_dir / np.sqrt(np.sum(in_dir ** 2))
in_dir = in_dir / np.sqrt(np.sum(in_dir ** 2) * 1.02)
angle = np.arccos(np.dot(in_dir, normal)) * 180 / np.pi
normal = -normal if 90 < angle < 270 else normal

Expand Down

0 comments on commit d1dfad1

Please sign in to comment.