-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Projection from 2D -> 1D for common lines (#67)
- Loading branch information
Showing
4 changed files
with
156 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
from .project_fourier import project_fourier | ||
from .project_real import project_real | ||
from .project_real import project_volume_real, project_image_real |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
import torch | ||
|
||
from libtilt.projection.project_real import project_real | ||
from libtilt.projection.project_real import project_image_real, project_volume_real | ||
|
||
|
||
def test_real_space_projection(): | ||
def test_real_space_projection_3d(): | ||
volume_shape = (2, 10, 10) | ||
volume = torch.arange(2*10*10).reshape(volume_shape).float() | ||
rotation_matrix = torch.eye(3).reshape(1, 3, 3) | ||
projection = project_real(volume, rotation_matrices=rotation_matrix) | ||
projection = project_volume_real(volume, rotation_matrices=rotation_matrix) | ||
assert torch.allclose(projection.squeeze(), torch.sum(volume, dim=0)) | ||
|
||
|
||
def test_real_space_projection_2d(): | ||
image_shape = (8, 12) | ||
image = torch.arange(8 * 12).reshape(image_shape).float() | ||
rotation_matrix = torch.eye(2).reshape(1, 2, 2) | ||
projection = project_image_real(image, rotation_matrices=rotation_matrix) | ||
assert torch.allclose(projection.squeeze(), torch.sum(image, dim=0)) |