diff --git a/setup.cfg b/setup.cfg index 16fedb74cdbc14c052433845e8d5d03160442184..4ccfa5784d0f57bd1d03b47dd9bd2eabc62238c5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,10 +4,10 @@ [metadata] name = pyronn-torch -description = Add a short description here! -author = Stephan Seitz -author-email = stephan.seitz@fau.de -license = mit +description = PyTorch bindings for PYRO-NN (https://github.com/csyben/PYRO-NN) +author = Stephan Seitz, Christopher Symben +author-email = stephan.seitz@fau.de, christopher.syben@fau.de +license = GPLv3 long-description = file: README.rst long-description-content-type = text/x-rst; charset=UTF-8 url = https://github.com/pyscaffold/pyscaffold/ diff --git a/setup.py b/setup.py index a46182bce241348d3ef4606c2baf003372dc9245..5038bb1a45162f8c52bd20b0c3b3fd101a990cd6 100644 --- a/setup.py +++ b/setup.py @@ -41,8 +41,6 @@ if __name__ == "__main__": [generated_file] + cuda_sources, extra_compile_args={'cxx': ['--std=c++14'], 'nvcc': ['-arch=sm_35']}) - - ], cmdclass={ 'build_ext': BuildExtension diff --git a/tests/test_projection.py b/tests/test_projection.py index 679553c2f9c76b1f9fe5d6c9731dc59535c309b7..f72f3cc20ff02e8226db1b36de3ad1d8ac22e6df 100644 --- a/tests/test_projection.py +++ b/tests/test_projection.py @@ -6,6 +6,9 @@ """ """ +import os + +import numpy as np import pytest import pyronn_torch @@ -18,6 +21,41 @@ def test_init(): @pytest.mark.parametrize('with_texture', ('with_texture', False)) @pytest.mark.parametrize('with_backward', ('with_backward', False)) def test_projection(with_texture, with_backward): + projector = pyronn_torch.ConeBeamProjector( + (128, 128, 128), + (2.0, 2.0, 2.0), + (-127.5, -127.5, -127.5), + (2, 480, 620), + [1.0, 1.0], + (0, 0), + np.array([[[-3.10e+2, -1.20e+03, 0.00e+00, 1.86e+5], + [-2.40e+2, 0.00e+00, 1.20e+03, 1.44e+5], + [-1.00e+00, 0.00e+00, 0.00e+00, 6.00e+2]], + [[-2.89009888e+2, -1.20522754e+3, -1.02473585e-13, + 1.86000000e+5], + [-2.39963440e+2, -4.18857765e+0, 1.20000000e+3, + 1.44000000e+5], + [-9.99847710e-01, -1.74524058e-2, 0.00000000e+0, + 6.00000000e+2]]]) + ) + + volume = projector.new_volume_tensor(requires_grad=True if with_backward else False) + + volume += 1. + result = projector.project_forward(volume, use_texture=with_texture) + + assert result is not None + if with_backward: + assert volume.requires_grad + assert result.requires_grad + + loss = result.mean() + loss.backward() + + +@pytest.mark.skipif('CI' in os.environ, reason="No conrad config on CI") +@pytest.mark.parametrize('with_backward', ('with_backward', False)) +def test_conrad_config(with_backward, with_texture=True): projector = pyronn_torch.ConeBeamProjector.from_conrad_config() volume = projector.new_volume_tensor(requires_grad=True if with_backward else False)