Skip to content

Commit

Permalink
if input spacing same as resampling spacing then skip resampling
Browse files Browse the repository at this point in the history
  • Loading branch information
wasserth committed Jan 23, 2024
1 parent 9c35040 commit 40427de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* add `--fastest` argument
* allow `mps` as device (but not working yet)
* add inline python version requirement for `requests` package
* if input spacing same as resampling spacing then skip resampling


## Release 2.0.5
Expand Down
4 changes: 4 additions & 0 deletions totalsegmentator/resampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ def change_spacing(img_in, new_spacing=1.25, target_shape=None, order=0, nr_cpus
else:
zoom = img_spacing / new_spacing

if np.array_equal(img_spacing, new_spacing):
# print("Input spacing is equal to new spacing. Return image without resampling.")
return img_in

# copy very important; otherwise new_affine changes will also be in old affine
new_affine = np.copy(img_in.affine)

Expand Down

0 comments on commit 40427de

Please sign in to comment.