Skip to content

Commit c476983

Browse files
committed
remove/correct addpath for linux comptatibility
1 parent a06e6db commit c476983

File tree

4 files changed

+59
-33
lines changed

4 files changed

+59
-33
lines changed

Reco2D_IdealFFL.m

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,23 @@
44
%% 1. Define the access path to the required other packages.
55
% This are typically the sphericalHarmonics and ScannerDesign packages.
66
disp('1. Define the access path to the required other packages.')
7-
addpath(genpath('.'))
8-
addpath(genpath('..\SphericalHarmonics\'))
9-
addpath(genpath('..\ScannerDesign\'))
7+
8+
addpath(genpath(fullfile('.')))
9+
addpath(genpath(fullfile('..','SphericalHarmonics')))
10+
addpath(genpath(fullfile('..','ScannerDesign')))
1011

1112
%% 2. Loading the scanner model.
1213
% It is made of at least the spherical harmonics coefficient, the radius in which they are define and the nominal current used for the coil.
1314
disp('2. Loading the scanner''s coil codel')
1415
load('IdealFFL.mat');
1516

17+
% Scanner properties
18+
system.c11 = 2*Quadru_0.bc(1).coefficient(2,2)/Quadru_0.rhoReference*Quadru_0.current; % "Gradient" on the line
19+
system.aDx = Drive_X.bc(1).coefficient(1,1)*Drive_X.current;
20+
system.aDy = Drive_Y.bc(2).coefficient(1,1)*Drive_Y.current;
21+
fprintf('c11 %g T/m; aDx %g T; aDy %g T;\n',system.c11,system.aDx,system.aDx);
22+
fprintf('Drive peak translation x:%g m; y:%g m\n',system.aDx/system.c11,system.aDy/system.c11);
23+
1624
%% 3. Define all the other system parameters.
1725
% The spatial resolution of the phantom and the system matrix. The used frequencies, time vector, sampling frequencies, noise parameters etc. This is highly dependent on the scanner you want to model.
1826
disp('3. Define all the other system parameters.')
@@ -124,14 +132,14 @@
124132
disp('5. Define the time-varying amplitude applied on the different coils.')
125133
c1 = cos(2*pi*system.frequencyQuadrupol*calculation.time(:).');
126134
c2 = sin(2*pi*system.frequencyQuadrupol*calculation.time(:).');
127-
c3 = cos(0.5*2*pi*system.frequencyQuadrupol*calculation.time(:).');
128-
c4 = sin(0.5*2*pi*system.frequencyQuadrupol*calculation.time(:).');
135+
c3 = sin(0.5*2*pi*system.frequencyQuadrupol*calculation.time(:).');
136+
c4 = -cos(0.5*2*pi*system.frequencyQuadrupol*calculation.time(:).');
129137
c5 = sin(2*pi*system.frequencyDrive*calculation.time(:)');
130138

131139
c1_dt = cos(2*pi*system.frequencyQuadrupol*(calculation.time(:).'+calculation.dt));
132140
c2_dt = sin(2*pi*system.frequencyQuadrupol*(calculation.time(:).'+calculation.dt));
133-
c3_dt = cos(0.5*2*pi*system.frequencyQuadrupol*(calculation.time(:).'+calculation.dt));
134-
c4_dt = sin(0.5*2*pi*system.frequencyQuadrupol*(calculation.time(:).'+calculation.dt));
141+
c3_dt = sin(0.5*2*pi*system.frequencyQuadrupol*(calculation.time(:).'+calculation.dt));
142+
c4_dt = -cos(0.5*2*pi*system.frequencyQuadrupol*(calculation.time(:).'+calculation.dt));
135143
c5_dt = sin(2*pi*system.frequencyDrive*(calculation.time(:).'+calculation.dt));
136144

137145
system.coefSelection_Z = ones(1,system.numberOfTimePoints);
@@ -196,7 +204,7 @@
196204
%
197205
% figure
198206
% threshold = 3*10^-3;
199-
% for i=1:system.nbrPointPerDrivePeriod/20:system.numberOfTimePoints
207+
% for i=1:25:system.numberOfTimePoints
200208
% image = reshape(Babs(i,:),[system.sizeXSM,system.sizeYSM]);
201209
% imagesc(system.xSM,system.ySM,image);
202210
% xlabel('x axis /m')

Reco2D_IdealFFP.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
%% 1. Define the access path to the required other packages.
55
% This are typically the sphericalHarmonics and ScannerDesign packages.
66
disp('1. Define the access path to the required other packages.')
7-
addpath(genpath('.'))
8-
addpath(genpath('..\SphericalHarmonics\'))
9-
addpath(genpath('..\ScannerDesign\'))
7+
addpath(genpath(fullfile('.')))
8+
addpath(genpath(fullfile('..','SphericalHarmonics')))
9+
addpath(genpath(fullfile('..','ScannerDesign')))
1010

1111
%% 2. Loading the scanner model.
1212
% It is made of at least the spherical harmonics coefficient, the radius in which they are define and the nominal current used for the coil.

SignalEncoding.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
close all
77
clear all
88

9-
addpath('coreFunctions\')
9+
addpath(genpath(fullfile('.')))
1010

1111

1212
mu0 = 4*pi*1e-7; % permeability of the air.
@@ -17,18 +17,18 @@
1717
Ms = 0.6/mu0; %[A/m] Magnetisation at saturation from Magnetit. From the thesis. P54
1818
temperature = 310;
1919
%signal generation and procesing
20-
Fs = 25*10^6;%2.5e7; % [Hz] sampling frequency
20+
Fs = 1*10^6;%2.5e7; % [Hz] sampling frequency
2121
fStart = 2; % [-] staring frequency components to be displayed
22-
fStop = 500; % [-] Last frequency components to be displayed. Please respect the shanon theorem :)
22+
fStop = 80; % [-] Last frequency components to be displayed. Please respect the shanon theorem :)
2323
dt = 1/(50*10^6); %delta used to calculate the derivative. Used to compensate the "small" sampling frequencies
2424

2525
% MPI signal generation
2626
f = 25000; % [Hz] Frequency of the signal
27-
nbrPeriod = 10; % nbr of signal period
27+
nbrPeriod = 4; % nbr of signal period
2828
time = 0:1/Fs:nbrPeriod/f-1/Fs; % [s] time vector. Remove the last point as we start at zero.
2929
N = length(time); %Number of time points
30-
H0 = 31831;% [A/m] Drive field amplitude (31831 A/m to generate 40 mT)
31-
Hoffset = 1000;% [A/m] Offset field
30+
H0 = 31831/2;% [A/m] Drive field amplitude (31831 A/m to generate 40 mT)
31+
Hoffset = 1000*4;% [A/m] Offset field
3232
B0 = H0*mu0; % [T] - H = B/mu
3333

3434
% MPI scanner properties
@@ -40,7 +40,7 @@
4040
% Noise model
4141
kB = 1.380650424e-23; % [J/K] Boltzmann constant
4242
deltaF = 10*10^6; % [Hz] according to Weizenecker 2007 - A simulation study...
43-
Rp = 185 *10^-3; % [Ohm] according to Weizenecker 2007 - A simulation study...
43+
Rp = 0.0001*185 *10^-3; % [Ohm] according to Weizenecker 2007 - A simulation study...
4444
Scaling = 1000; % To easily scale the maximal voltage induced by the noise
4545
%% Particle Magnetization in function of the applied magnetic field
4646

@@ -105,8 +105,8 @@
105105
%% Spectrum
106106

107107
subplot(2,3,6)
108-
periodogram = fft(u);
109-
uhat = abs(2*periodogram(1:(end-1)/2+1));
108+
periodogram = fft(u)/size(u,1);
109+
uhat = abs((2*periodogram(1:(end-1)/2+1)));
110110
Fs = 1/(time(2)-time(1));
111111
freq = Fs/2*linspace(0,1,length(u)/2+1);
112112
semilogy(freq(fStart:fStop)/f,real(uhat(fStart:fStop)), 'o');

SignalGeneration.m

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
% "Entwicklung eines Spektrometers zur Analyse superparamagnetischer Eisenoxid-Nanopartikel für Magnetic-Particle-Imaging"
44
% Gael Bringout - Oct 2014
55

6-
%close all
6+
close all
77
clear all
88

9-
addpath('coreFunctions\')
9+
addpath(genpath(fullfile('.')))
1010

1111

1212
mu0 = 4*pi*1e-7; % permeability of the air.
@@ -17,17 +17,17 @@
1717
Ms = 0.6/mu0; %[A/m] Magnetisation at saturation from Magnetit. From the thesis. P54
1818
temperature = 310;
1919
%signal generation and procesing
20-
Fs = 25*10^6;%2.5e7; % [Hz] sampling frequency
20+
Fs = 10*10^6;%2.5e7; % [Hz] sampling frequency
2121
fStart = 2; % [-] staring frequency components to be displayed
22-
fStop = 500; % [-] Last frequency components to be displayed. Please respect the shanon theorem :)
22+
fStop = 800; % [-] Last frequency components to be displayed. Please respect the shanon theorem :)
2323
dt = 1/(50*10^6); %delta used to calculate the derivative. Used to compensate the "small" sampling frequencies
2424

2525
% MPI signal generation
2626
f = 25000; % [Hz] Frequency of the signal
27-
nbrPeriod = 10; % nbr of signal period
27+
nbrPeriod = 4; % nbr of signal period
2828
time = 0:1/Fs:nbrPeriod/f-1/Fs; % [s] time vector. Remove the last point as we start at zero.
2929
N = length(time); %Number of time points
30-
H0 = 31831;% [A/m] Drive field amplitude (31831 A/m to generate 40 mT)
30+
H0 = 31831/2;% [A/m] Drive field amplitude (31831 A/m to generate 40 mT)
3131
B0 = H0*mu0; % [T] - H = B/mu
3232

3333
% MPI scanner properties
@@ -39,14 +39,14 @@
3939
% Noise model
4040
kB = 1.380650424e-23; % [J/K] Boltzmann constant
4141
deltaF = 10*10^6; % [Hz] according to Weizenecker 2007 - A simulation study...
42-
Rp = 185 *10^-3; % [Ohm] according to Weizenecker 2007 - A simulation study...
42+
Rp = 0.0001*185 *10^-3; % [Ohm] according to Weizenecker 2007 - A simulation study...
4343
Scaling = 1000; % To easily scale the maximal voltage induced by the noise
4444
%% Particle Magnetization in function of the applied magnetic field
4545

4646
nbrPoint = 1000;
4747
a=zeros(nbrPoint,1);
4848
mu0 = 4*pi*1e-7; % permeability of the air.
49-
Hpart=linspace(-10000,10000,nbrPoint);
49+
Hpart=linspace(-31831,31831,nbrPoint);
5050
Bpart = Hpart.*mu0;
5151
Mpart=zeros(nbrPoint,1);
5252
for i=1:nbrPoint,
@@ -57,7 +57,8 @@
5757
subplot(2,3,1)
5858
hold off
5959
plot(Bpart, Mpart, 'k');
60-
xlim([-max(Bpart) max(Bpart)])
60+
%plot(a, Mpart, 'k');
61+
%xlim([-max(Bpart) max(Bpart)])
6162
xlabel('B / (T)')
6263
ylabel('M / (A/m)')
6364
title('Particle magnetisation curve');
@@ -104,10 +105,27 @@
104105
%% Spectrum
105106

106107
subplot(2,3,6)
107-
periodogram = fft(u);
108-
uhat = abs(2*periodogram(1:(end-1)/2+1));
108+
periodogram = fft(u)/size(u,1);
109+
uhat = abs((2*periodogram(1:(end-1)/2+1)));
109110
Fs = 1/(time(2)-time(1));
110111
freq = Fs/2*linspace(0,1,length(u)/2+1);
111-
semilogy(freq(fStart:fStop)/f,real(uhat(fStart:fStop)), 'o');
112+
plot(freq(fStart:fStop)/f,real(uhat(fStart:fStop)), 'o');
112113
title('Spectrum - # of harmonic');
113-
xlim([ 0 50])
114+
xlim([ 0 50])
115+
116+
% filter the results
117+
%figure; semilogy(abs(periodogram));
118+
i1 = find(freq == f);
119+
i2 = find(freq == 2*f);
120+
i3 = find(freq == 3*f);
121+
122+
AS = abs(fft(u));
123+
AS(i1) = AS(i1)/400;
124+
AS(size(u,1)-i1+2) = AS(i1);
125+
AS(i2) = AS(i2)/200;
126+
AS(size(u,1)-i2+2) = AS(i2);
127+
AS(i3) = AS(i3);
128+
AS(size(u,1)-i3+2) = AS(i3);
129+
130+
%ybis = ifft(AS);
131+
%figure;plot(time,real(ybis));

0 commit comments

Comments
 (0)