Skip to content

Commit

Permalink
Merge pull request #45 from dkazanc/adaptring
Browse files Browse the repository at this point in the history
A better data model to supress ring artifacts
  • Loading branch information
dkazanc authored Nov 14, 2019
2 parents 3eee87a + ad14f2b commit 6df26dc
Show file tree
Hide file tree
Showing 44 changed files with 1,087 additions and 209 deletions.
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ language: python
matrix:
include:
- python: 2.7
env: NUMPY=1.14

env: NUMPY=1.14
- python: 2.7
env: NUMPY=1.15

Expand All @@ -28,20 +28,20 @@ install:
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
#- conda update -q conda
- conda update -q conda
- conda info -a
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION
- source activate test-environment
- conda install --yes numpy=$NUMPY pytest conda-build anaconda-client
- conda install -c conda-forge sparse
- conda config --set anaconda_upload no
- export VERSION=`date +%Y.%m`
- conda build src/Python/conda-recipe --numpy=$NUMPY --python=$TRAVIS_PYTHON_VERSION
- export VERSION=`date +%Y.%m`
- conda build conda-recipe --numpy=$NUMPY --python=$TRAVIS_PYTHON_VERSION
- conda install --channel /home/travis/miniconda/envs/test-environment/conda-bld/ tomobar --offline --override-channels

after_success:
- chmod +x src/Python/conda-recipe/conda_upload.sh
- test $TRAVIS_BRANCH = "master" && bash src/Python/conda-recipe/conda_upload.sh
- test $TRAVIS_BRANCH = "master" && bash conda-recipe/conda_upload.sh

script:
- python tests/test.py
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# Changelog
All notable changes to this project will be documented in this file.

## [2019.11]

### Added
- RING_WEIGHTS module in C which calculates a better ring model to use in non-quadratic data penalties
- Cmake and Cython wrappers
- run.sh to run Cmake based installation of Python wrappers

### Changed
- Installation process to use Cmake and Cython to wrap Python modules
- Demos and conda-build files moved to the main directory

## [2019.08]
### Added
- Autocropper to automatically crop the 3D projection data to reduce its size
Expand Down
32 changes: 32 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required (VERSION 3.0)

project(tomobar)

set (tomobar_VERSION $ENV{tomobar_VERSION} CACHE INTERNAL "tomobar modules" FORCE)
message(STATUS "tomobar_VERSION set to " ${tomobar_VERSION})

# set the Python variables for the Conda environment
option (BUILD_PYTHON_WRAPPER "Build Python Wrappers" ON)
option (CONDA_BUILD "Conda Build" OFF)

set(PYTHON_DEST_DIR "" CACHE PATH "Directory of the Python wrappers")
if (PYTHON_DEST_DIR)
set(PYTHON_DEST "${PYTHON_DEST_DIR}")
else()
set(PYTHON_DEST "${CMAKE_INSTALL_PREFIX}/python")
endif()
message(STATUS "Python wrappers will be installed in " ${PYTHON_DEST})

add_subdirectory(src)
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,7 @@
% See ReadMe for more information and references

close all;clc;clear;
% adding paths
fsep = '/';
% TomoPhantom paths (TomoPhantom needs to be compiled first)
pathtoTomoPhantom = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'Wrappers' fsep 'MATLAB' fsep 'compiled' fsep], 1i);
addpath(pathtoTomoPhantom);
pathtoTomoPhantom2 = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'Wrappers' fsep 'MATLAB' fsep 'supplem' fsep], 1i);
addpath(pathtoTomoPhantom2);
pathtoModels = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'PhantomLibrary' fsep 'models' fsep 'Phantom2DLibrary.dat'], 1i);
% Regularisation Toolkit path to compiled library (CCPi-RGTtk needs to be compiled first)
pathtoRGLtk = sprintf(['..' fsep 'supplementary' fsep 'CCPi-Regularisation-Toolkit' fsep 'Wrappers' fsep 'Matlab' fsep 'mex_compile' fsep 'installed'], 1i);
addpath(pathtoRGLtk);

pathmainFunc = sprintf(['..' fsep 'main_func'], 1i);
addpath(pathmainFunc);
pathSupp = sprintf(['..' fsep 'supplementary'], 1i);
addpath(pathSupp);
adding_paths % ading all required paths (modify if required)
%%
fprintf('\n %s\n', 'Generating a phantom and projection data using the TomoPhantom package...');
ModelNo = 14; % Select a model from Phantom2DLibrary.dat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,9 @@
% See ReadMe for more information and references

close all;clc;clear;
% adding paths
fsep = '/';

% Regularisation Toolkit path to compiled library (CCPi-RGTtk needs to be compiled first)
pathtoRGLtk = sprintf(['..' fsep 'supplementary' fsep 'CCPi-Regularisation-Toolkit' fsep 'Wrappers' fsep 'Matlab' fsep 'mex_compile' fsep 'installed'], 1i);
addpath(pathtoRGLtk);

pathmainFunc = sprintf(['..' fsep 'main_func'], 1i);
addpath(pathmainFunc);
pathSupp = sprintf(['..' fsep 'supplementary'], 1i);
addpath(pathSupp);
adding_paths % ading all required paths (modify if required)
%%
load ../../../data/RealDataDend.mat
load ../../data/RealDataDend.mat
sinoRD = sinoRD';
figure; imshow(sinoRD, [ ]); colormap hot; title('Sinogram');
%%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,7 @@
% See ReadMe for more information and links

close all;clc;clear;
% adding paths
fsep = '/';
% TomoPhantom paths (TomoPhantom needs to be compiled first)
pathtoTomoPhantom = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'Wrappers' fsep 'MATLAB' fsep 'compiled' fsep], 1i);
addpath(pathtoTomoPhantom);
pathtoTomoPhantom2 = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'Wrappers' fsep 'MATLAB' fsep 'supplem' fsep], 1i);
addpath(pathtoTomoPhantom2);
pathtoModels = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'PhantomLibrary' fsep 'models' fsep 'Phantom2DLibrary.dat'], 1i);
% Regularisation Toolkit path to compiled library (CCPi-RGTtk needs to be compiled first)
pathtoRGLtk = sprintf(['..' fsep 'supplementary' fsep 'CCPi-Regularisation-Toolkit' fsep 'Wrappers' fsep 'Matlab' fsep 'mex_compile' fsep 'installed'], 1i);
addpath(pathtoRGLtk);

pathmainFunc = sprintf(['..' fsep 'main_func'], 1i);
addpath(pathmainFunc);
pathSupp = sprintf(['..' fsep 'supplementary'], 1i);
addpath(pathSupp);
adding_paths % ading all required paths (modify if required)
%%
fprintf('\n %s\n', 'Generating a phantom and projection data using the TomoPhantom package...');
ModelNo = 4; % Select a model from Phantom2DLibrary.dat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,7 @@
% See ReadMe for more information and links

close all;clc;clear;
% adding paths
fsep = '/';
% TomoPhantom paths (TomoPhantom needs to be compiled first)
pathtoTomoPhantom = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'Wrappers' fsep 'MATLAB' fsep 'compiled' fsep], 1i);
addpath(pathtoTomoPhantom);
pathtoTomoPhantom2 = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'Wrappers' fsep 'MATLAB' fsep 'supplem' fsep], 1i);
addpath(pathtoTomoPhantom2);
pathtoModels = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'PhantomLibrary' fsep 'models' fsep 'Phantom2DLibrary.dat'], 1i);
% Regularisation Toolkit path to compiled library (CCPi-RGTtk needs to be compiled first)
pathtoRGLtk = sprintf(['..' fsep 'supplementary' fsep 'CCPi-Regularisation-Toolkit' fsep 'Wrappers' fsep 'Matlab' fsep 'mex_compile' fsep 'installed'], 1i);
addpath(pathtoRGLtk);

pathmainFunc = sprintf(['..' fsep 'main_func'], 1i);
addpath(pathmainFunc);
pathSupp = sprintf(['..' fsep 'supplementary'], 1i);
addpath(pathSupp);
adding_paths % ading all required paths (modify if required)
%%
fprintf('\n %s\n', 'Generating a phantom and projection data using the TomoPhantom package...');
ModelNo = 4; % Select a model from Phantom2DLibrary.dat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,7 @@
% See ReadMe for more information and links

close all;clc;clear;
% adding paths
fsep = '/';
% TomoPhantom paths (TomoPhantom needs to be compiled first)
pathtoTomoPhantom = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'Wrappers' fsep 'MATLAB' fsep 'compiled' fsep], 1i);
addpath(pathtoTomoPhantom);
pathtoTomoPhantom2 = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'Wrappers' fsep 'MATLAB' fsep 'supplem' fsep], 1i);
addpath(pathtoTomoPhantom2);
pathtoModels = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'PhantomLibrary' fsep 'models' fsep 'Phantom2DLibrary.dat'], 1i);
% Regularisation Toolkit path to compiled library (CCPi-RGTtk needs to be compiled first)
pathtoRGLtk = sprintf(['..' fsep 'supplementary' fsep 'CCPi-Regularisation-Toolkit' fsep 'Wrappers' fsep 'Matlab' fsep 'mex_compile' fsep 'installed'], 1i);
addpath(pathtoRGLtk);

pathmainFunc = sprintf(['..' fsep 'main_func'], 1i);
addpath(pathmainFunc);
pathSupp = sprintf(['..' fsep 'supplementary'], 1i);
addpath(pathSupp);
adding_paths % ading all required paths (modify if required)
%%
fprintf('\n %s\n', 'Generating a phantom and projection data using the TomoPhantom package...');
ModelNo = 4; % Select a model from Phantom2DLibrary.dat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,7 @@
% See ReadMe for more information and links

close all;clc;clear;
% adding paths
fsep = '/';
% TomoPhantom paths (TomoPhantom needs to be compiled first)
pathtoTomoPhantom = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'Wrappers' fsep 'MATLAB' fsep 'compiled' fsep], 1i);
addpath(pathtoTomoPhantom);
pathtoTomoPhantom2 = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'Wrappers' fsep 'MATLAB' fsep 'supplem' fsep], 1i);
addpath(pathtoTomoPhantom2);
pathtoModels = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'PhantomLibrary' fsep 'models' fsep 'Phantom2DLibrary.dat'], 1i);
% Regularisation Toolkit path to compiled library (CCPi-RGTtk needs to be compiled first)
pathtoRGLtk = sprintf(['..' fsep 'supplementary' fsep 'CCPi-Regularisation-Toolkit' fsep 'Wrappers' fsep 'Matlab' fsep 'mex_compile' fsep 'installed'], 1i);
addpath(pathtoRGLtk);

pathmainFunc = sprintf(['..' fsep 'main_func'], 1i);
addpath(pathmainFunc);
pathSupp = sprintf(['..' fsep 'supplementary'], 1i);
addpath(pathSupp);
adding_paths % ading all required paths (modify if required)
%%
fprintf('\n %s\n', 'Generating a phantom and projection data using the TomoPhantom package...');
ModelNo = 4; % Select a model from Phantom2DLibrary.dat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,7 @@
% See ReadMe for more information and links

close all;clc;clear;
% adding paths
fsep = '/';
% TomoPhantom paths (TomoPhantom needs to be compiled first)
pathtoTomoPhantom = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'Wrappers' fsep 'MATLAB' fsep 'compiled' fsep], 1i);
addpath(pathtoTomoPhantom);
pathtoTomoPhantom2 = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'Wrappers' fsep 'MATLAB' fsep 'supplem' fsep], 1i);
addpath(pathtoTomoPhantom2);
pathtoModels = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'PhantomLibrary' fsep 'models' fsep 'Phantom2DLibrary.dat'], 1i);
% Regularisation Toolkit path to compiled library (CCPi-RGTtk needs to be compiled first)
pathtoRGLtk = sprintf(['..' fsep 'supplementary' fsep 'CCPi-Regularisation-Toolkit' fsep 'Wrappers' fsep 'Matlab' fsep 'mex_compile' fsep 'installed'], 1i);
addpath(pathtoRGLtk);

pathmainFunc = sprintf(['..' fsep 'main_func'], 1i);
addpath(pathmainFunc);
pathSupp = sprintf(['..' fsep 'supplementary'], 1i);
addpath(pathSupp);

adding_paths % ading all required paths (modify if required)
%%
% Generate 3D phantom:
fprintf('\n %s\n', 'Generating a phantom using the TomoPhantom package...');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,7 @@
% See ReadMe for more information and links

close all;clc;clear;
% adding paths
fsep = '/';
% TomoPhantom paths (TomoPhantom needs to be compiled first)
pathtoTomoPhantom = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'Wrappers' fsep 'MATLAB' fsep 'compiled' fsep], 1i);
addpath(pathtoTomoPhantom);
pathtoTomoPhantom2 = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'Wrappers' fsep 'MATLAB' fsep 'supplem' fsep], 1i);
addpath(pathtoTomoPhantom2);
pathtoModels = sprintf(['..' fsep 'supplementary' fsep 'TomoPhantom' fsep 'PhantomLibrary' fsep 'models' fsep 'Phantom2DLibrary.dat'], 1i);
% Regularisation Toolkit path to compiled library (CCPi-RGTtk needs to be compiled first)
pathtoRGLtk = sprintf(['..' fsep 'supplementary' fsep 'CCPi-Regularisation-Toolkit' fsep 'Wrappers' fsep 'Matlab' fsep 'mex_compile' fsep 'installed'], 1i);
addpath(pathtoRGLtk);

pathmainFunc = sprintf(['..' fsep 'main_func'], 1i);
addpath(pathmainFunc);
pathSupp = sprintf(['..' fsep 'supplementary'], 1i);
addpath(pathSupp);

adding_paths % ading all required paths (modify if required)
%%
% Generate 3D phantom:
fprintf('\n %s\n', 'Generating a phantom using the TomoPhantom package...');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,7 @@
% See ReadMe for more information and links

close all;clc;clear;
% adding paths
fsep = '/';
% Regularisation Toolkit path to compiled library (CCPi-RGTtk needs to be compiled first)
pathtoRGLtk = sprintf(['..' fsep 'supplementary' fsep 'CCPi-Regularisation-Toolkit' fsep 'Wrappers' fsep 'Matlab' fsep 'mex_compile' fsep 'installed'], 1i);
addpath(pathtoRGLtk);

pathmainFunc = sprintf(['..' fsep 'main_func'], 1i);
addpath(pathmainFunc);
pathSupp = sprintf(['..' fsep 'supplementary'], 1i);
addpath(pathSupp);
pathtoData = sprintf(['..' fsep '..' fsep '..' fsep 'data'], 1i);
addpath(pathtoData);
adding_paths % ading all required paths (modify if required)
%%
fprintf('\n %s\n', 'Loading real data...');
[Sino3D, Weights3D, anglesRad, Detectors] = exportDemoRD2Data();
Expand Down
16 changes: 16 additions & 0 deletions Demos/Matlab/adding_paths.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
% adding paths
fsep = '/';
% TomoPhantom paths (TomoPhantom needs to be compiled first)
pathtoTomoPhantom = sprintf(['..' fsep '..' fsep 'src' fsep 'Matlab' fsep 'supplementary' fsep 'TomoPhantom' fsep 'Wrappers' fsep 'MATLAB' fsep 'compiled' fsep], 1i);
addpath(pathtoTomoPhantom);
pathtoTomoPhantom2 = sprintf(['..' fsep '..' fsep 'src' fsep 'Matlab' fsep 'supplementary' fsep 'TomoPhantom' fsep 'Wrappers' fsep 'MATLAB' fsep 'supplem' fsep], 1i);
addpath(pathtoTomoPhantom2);
pathtoModels = sprintf(['..' fsep '..' fsep 'src' fsep 'Matlab' fsep 'supplementary' fsep 'TomoPhantom' fsep 'PhantomLibrary' fsep 'models' fsep 'Phantom2DLibrary.dat'], 1i);
% Regularisation Toolkit path to compiled library (CCPi-RGTtk needs to be compiled first)
pathtoRGLtk = sprintf(['..' fsep '..' fsep 'src' fsep 'Matlab' fsep 'supplementary' fsep 'CCPi-Regularisation-Toolkit' fsep 'Wrappers' fsep 'Matlab' fsep 'mex_compile' fsep 'installed'], 1i);
addpath(pathtoRGLtk);

pathmainFunc = sprintf(['..' fsep '..' fsep 'src' fsep 'Matlab' fsep 'main_func'], 1i);
addpath(pathmainFunc);
pathSupp = sprintf(['..' fsep '..' fsep 'src' fsep 'Matlab' fsep 'supplementary'], 1i);
addpath(pathSupp);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 6df26dc

Please sign in to comment.