Skip to content

Commit

Permalink
OS independent paths fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
dkazanc committed Apr 27, 2018
1 parent a06705a commit 587e451
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 27 deletions.
7 changes: 5 additions & 2 deletions matlab/Model2DGeneratorDemo.m
Expand Up @@ -9,7 +9,9 @@

close all;clc;clear;
% adding paths
addpath('../functions/models/'); addpath('compiled/'); addpath('supplem/');
pathtoModels = sprintf(['..' filesep 'functions' filesep 'models' filesep], 1i);
addpath(pathtoModels);
addpath('compiled'); addpath('supplem');

ModelNo = 4; % Select a model from Phantom2DLibrary.dat
% Define phantom dimensions
Expand All @@ -18,7 +20,8 @@
% Generate 2D phantom:
curDir = pwd;
mainDir = fileparts(curDir);
pathTP = strcat(mainDir,'/functions/models/Phantom2DLibrary.dat'); % path to TomoPhantom parameters file
pathtoLibrary = sprintf([filesep 'functions' filesep 'models' filesep 'Phantom2DLibrary.dat'], 1i);
pathTP = strcat(mainDir, pathtoLibrary); % path to TomoPhantom parameters file
[G] = TomoP2DModel(ModelNo,N,pathTP);
figure; imagesc(G, [0 1]); daspect([1 1 1]); colormap hot;
%%
Expand Down
13 changes: 9 additions & 4 deletions matlab/Model2D_tGeneratorDemo.m
Expand Up @@ -9,7 +9,9 @@

close all;clc;clear;
% adding paths
addpath('../functions/models/'); addpath('compiled/'); addpath('supplem/');
pathtoModels = sprintf(['..' filesep 'functions' filesep 'models' filesep], 1i);
addpath(pathtoModels);
addpath('compiled'); addpath('supplem');

ModelNo = 100; % Select a model from Phantom2DLibrary.dat
% Define phantom dimensions
Expand All @@ -18,7 +20,8 @@
% Generate 2D+t phantom:
curDir = pwd;
mainDir = fileparts(curDir);
pathTP = strcat(mainDir,'/functions/models/Phantom2DLibrary.dat'); % path to TomoPhantom parameters file
pathtoLibrary = sprintf([filesep 'functions' filesep 'models' filesep 'Phantom2DLibrary.dat'], 1i);
pathTP = strcat(mainDir, pathtoLibrary); % path to TomoPhantom parameters file
[G] = TomoP2DModel(ModelNo,N,pathTP);
figure(1); imagesc(G, [0 1]); daspect([1 1 1]); title('2D+t model, t=3 here'); colormap hot;
%%
Expand All @@ -30,7 +33,8 @@
% Generate 2D phantom:
curDir = pwd;
mainDir = fileparts(curDir);
pathTP = strcat(mainDir,'/functions/models/Phantom2DLibrary.dat'); % path to TomoPhantom parameters file
pathtoLibrary = sprintf([filesep 'functions' filesep 'models' filesep 'Phantom2DLibrary.dat'], 1i);
pathTP = strcat(mainDir, pathtoLibrary); % path to TomoPhantom parameters file
[G] = TomoP2DModel(ModelNo,N,pathTP);

angles = linspace(0,180,N); % projection angles
Expand All @@ -53,7 +57,8 @@
timeFrames = 25; %must be the same as in model
curDir = pwd;
mainDir = fileparts(curDir);
pathTP = strcat(mainDir,'/functions/models/Phantom2DLibrary.dat'); % path to TomoPhantom parameters file
pathtoLibrary = sprintf([filesep 'functions' filesep 'models' filesep 'Phantom2DLibrary.dat'], 1i);
pathTP = strcat(mainDir, pathtoLibrary); % path to TomoPhantom parameters file
[G] = TomoP2DModel(ModelNo,N,pathTP);

angles = linspace(0,180,N); % projection angles
Expand Down
7 changes: 5 additions & 2 deletions matlab/Model3DGeneratorDemo.m
Expand Up @@ -7,7 +7,9 @@

close all;clc;clear;
% adding paths
addpath('../functions/models/'); addpath('compiled/'); addpath('supplem/');
pathtoModels = sprintf(['..' filesep 'functions' filesep 'models' filesep], 1i);
addpath(pathtoModels);
addpath('compiled'); addpath('supplem');

ModelNo = 10; % Select a model
% Define phantom dimensions
Expand All @@ -16,7 +18,8 @@
% generate 3D phantom (modify your PATH bellow):
curDir = pwd;
mainDir = fileparts(curDir);
pathTP = strcat(mainDir,'/functions/models/Phantom3DLibrary.dat'); % path to TomoPhantom parameters file
pathtoLibrary = sprintf([filesep 'functions' filesep 'models' filesep 'Phantom3DLibrary.dat'], 1i);
pathTP = strcat(mainDir, pathtoLibrary); % path to TomoPhantom parameters file
[G] = TomoP3DModel(ModelNo,N,pathTP);

% check 3 projections
Expand Down
10 changes: 7 additions & 3 deletions matlab/Model3D_tGeneratorDemo.m
Expand Up @@ -7,7 +7,9 @@

close all;clc;clear;
% adding paths
addpath('../functions/models/'); addpath('compiled/'); addpath('supplem/');
pathtoModels = sprintf(['..' filesep 'functions' filesep 'models' filesep], 1i);
addpath(pathtoModels);
addpath('compiled'); addpath('supplem');

ModelNo = 100; % Select a model
% Define phantom dimensions
Expand All @@ -16,7 +18,8 @@
% generate 4D phantom (modify your PATH bellow):
curDir = pwd;
mainDir = fileparts(curDir);
pathTP = strcat(mainDir,'/functions/models/Phantom3DLibrary.dat'); % path to TomoPhantom parameters file
pathtoLibrary = sprintf([filesep 'functions' filesep 'models' filesep 'Phantom3DLibrary.dat'], 1i);
pathTP = strcat(mainDir, pathtoLibrary); % path to TomoPhantom parameters file
[G] = TomoP3DModel(ModelNo,N,pathTP);

sliceM = round(0.5*N);
Expand All @@ -34,7 +37,8 @@
% generate 4D phantom (modify your PATH bellow):
curDir = pwd;
mainDir = fileparts(curDir);
pathTP = strcat(mainDir,'/functions/models/Phantom3DLibrary.dat'); % path to TomoPhantom parameters file
pathtoLibrary = sprintf([filesep 'functions' filesep 'models' filesep 'Phantom3DLibrary.dat'], 1i);
pathTP = strcat(mainDir, pathtoLibrary); % path to TomoPhantom parameters file
[G] = TomoP3DModel(ModelNo,N,pathTP);

%%
Expand Down
4 changes: 3 additions & 1 deletion matlab/Object2DGeneratorDemo.m
Expand Up @@ -6,7 +6,9 @@

close all;clc;clear;
% adding paths
addpath('../functions/models/'); addpath('compiled/'); addpath('supplem/');
pathtoModels = sprintf(['..' filesep 'functions' filesep 'models' filesep], 1i);
addpath(pathtoModels);
addpath('compiled'); addpath('supplem');

% Define object dimensions
N = 256; % x-y-z size (cubic image)
Expand Down
5 changes: 4 additions & 1 deletion matlab/Object3DGeneratorDemo.m
Expand Up @@ -6,7 +6,10 @@

close all;clc;clear;
% adding paths
addpath('../functions/models/'); addpath('compiled/'); addpath('supplem/');
pathtoModels = sprintf(['..' filesep 'functions' filesep 'models' filesep], 1i);
addpath(pathtoModels);
addpath('compiled'); addpath('supplem');


% Define phantom dimensions
N = 256; % x-y-z size (cubic image)
Expand Down
8 changes: 6 additions & 2 deletions matlab/SpectralPhantomDemo.m
Expand Up @@ -9,7 +9,10 @@

close all;clc;clear;
% adding paths
addpath('../functions/models/'); addpath('compiled/');
pathtoModels = sprintf(['..' filesep 'functions' filesep 'models' filesep], 1i);
addpath(pathtoModels);
addpath('compiled'); addpath('supplem');


ModelNo = 11;
% Define phantom dimension
Expand All @@ -18,7 +21,8 @@
% generate the 2D phantom:
curDir = pwd;
mainDir = fileparts(curDir);
pathTP = strcat(mainDir,'/functions/models/Phantom2DLibrary.dat'); % path to TomoPhantom parameters file
pathtoLibrary = sprintf([filesep 'functions' filesep 'models' filesep 'Phantom2DLibrary.dat'], 1i);
pathTP = strcat(mainDir, pathtoLibrary); % path to TomoPhantom parameters file
[G] = TomoP2DModel(ModelNo,N,pathTP);

% create 4 phantoms with dedicated materials
Expand Down
31 changes: 19 additions & 12 deletions matlab/install/compile_mex.m
@@ -1,25 +1,32 @@
% compile mex files once from Matlab running this script

cd ../
fsep = filesep;
UpPath = sprintf(['..' fsep], 1i);
cd(UpPath);

mkdir compiled
cd ../functions/

PathFunc = sprintf(['..' fsep 'functions' fsep], 1i);
cd(PathFunc);

Pathmove = sprintf(['..' fsep 'matlab' fsep 'compiled' fsep], 1i);

fprintf('%s \n', 'Building functions...');
mex TomoP2DModel.c TomoP2DModel_core.c utils.c CFLAGS="\$CFLAGS -fopenmp -Wall -std=c99" LDFLAGS="\$LDFLAGS -fopenmp"
movefile TomoP2DModel.mex* ../matlab/compiled/
movefile('TomoP2DModel.mex*',Pathmove);
mex TomoP2DObject.c TomoP2DModel_core.c utils.c CFLAGS="\$CFLAGS -fopenmp -Wall -std=c99" LDFLAGS="\$LDFLAGS -fopenmp"
movefile TomoP2DObject.mex* ../matlab/compiled/
movefile('TomoP2DObject.mex*',Pathmove);
mex TomoP2DModelSino.c TomoP2DModelSino_core.c utils.c CFLAGS="\$CFLAGS -fopenmp -Wall -std=c99" LDFLAGS="\$LDFLAGS -fopenmp"
movefile TomoP2DModelSino.mex* ../matlab/compiled/
movefile('TomoP2DModelSino.mex*',Pathmove);
mex TomoP2DObjectSino.c TomoP2DModelSino_core.c utils.c CFLAGS="\$CFLAGS -fopenmp -Wall -std=c99" LDFLAGS="\$LDFLAGS -fopenmp"
movefile TomoP2DObjectSino.mex* ../matlab/compiled/
movefile('TomoP2DObjectSino.mex*',Pathmove);
mex TomoP3DModel.c TomoP3DModel_core.c utils.c CFLAGS="\$CFLAGS -fopenmp -Wall -std=c99" LDFLAGS="\$LDFLAGS -fopenmp"
movefile TomoP3DModel.mex* ../matlab/compiled/
movefile('TomoP3DModel.mex*',Pathmove);
mex TomoP3DObject.c TomoP3DModel_core.c utils.c CFLAGS="\$CFLAGS -fopenmp -Wall -std=c99" LDFLAGS="\$LDFLAGS -fopenmp"
movefile TomoP3DObject.mex* ../matlab/compiled/
mex BackProjCPU.c CFLAGS="\$CFLAGS -fopenmp -Wall -std=c99" LDFLAGS="\$LDFLAGS -fopenmp"
movefile BackProjCPU.mex* ../matlab/compiled/
movefile('TomoP3DObject.mex*',Pathmove);
% mex BackProjCPU.c CFLAGS="\$CFLAGS -fopenmp -Wall -std=c99" LDFLAGS="\$LDFLAGS -fopenmp"
% movefile BackProjCPU.mex* ../matlab/compiled/
fprintf('%s \n', 'All compiled!');

cd ../
cd matlab
cd(UpPath);
cd matlab

0 comments on commit 587e451

Please sign in to comment.