-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5ea9921
Showing
782 changed files
with
1,202,796 additions
and
0 deletions.
There are no files selected for viewing
184 changes: 184 additions & 0 deletions
184
Paper_Test_Code/Fig10/Theory_MultiTree_Snesim_nonconditon.m
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 |
---|---|---|
@@ -0,0 +1,184 @@ | ||
%% Theory test, multiple trees and original Snesim, unconditional | ||
% Fig. 10. Unconditional simulation realizations | ||
clear all;close all;clc | ||
tic; | ||
addpath('../../export_fig-master'); | ||
addpath(genpath('../../mGstat')); | ||
addpath('../../relycode'); | ||
|
||
% training image | ||
TI=channels; | ||
TI=TI(1:2:end,1:2:end); | ||
|
||
% Parameters setting | ||
options.n_mulgrids=1;; | ||
options.n_cond=[25 25 25 25];; | ||
options.n_template=[81 81 81 81]; | ||
|
||
options.plot_interval=1;; | ||
|
||
% set the data template and search tree | ||
global T; | ||
T = []; | ||
global ST; | ||
ST= []; | ||
global Bool; | ||
|
||
% Count the number of nodes for multiple search tree | ||
global num; | ||
num(4) = 0; | ||
|
||
global num2; | ||
num2(4) = 0; | ||
|
||
% Multiple search tree and original Snesim comparision | ||
Cal = {'MultiTree','OneTree'}; | ||
% Setting the size of work area | ||
SIMT = {60}; | ||
|
||
for i = 1:size(SIMT,2) | ||
for j = 1:size(Cal,2) | ||
Bool = Cal{j}; | ||
SIM=ones(SIMT{i},SIMT{i})*NaN; | ||
rng(1); | ||
% Simulate | ||
[out{i}{j},outresult{i}{j}]=mps_snesim(TI,SIM,options); | ||
outresult{i}{j}.out = out{i}{j}; | ||
end | ||
end | ||
toc; | ||
|
||
%% Plot simulation results | ||
figure; | ||
% Define color mapping matrix | ||
ColorMatrix=[0,139,0;255,255,0]; | ||
|
||
% Calculate color matrix | ||
RGB_RE1=TI2RGB(out{1}{1},ColorMatrix); | ||
RGB_RE2=TI2RGB(out{1}{2},ColorMatrix); | ||
|
||
% Plot multiple search trees realization | ||
axes1=subplot(1,2,1);imshow(RGB_RE1,ColorMatrix./255,'InitialMagnification','fit'); | ||
axis on; | ||
axis xy; | ||
title(axes1,{'(a) multiple search trees realization'},'FontSize',14,'position',... | ||
[30.200000000000003,-7.846491228070176,0]); | ||
|
||
% set(axes1,'Xlim',[0,60],'Ylim',[0,60],'Clim',[0 2]); | ||
set(axes1,'Xlim',[0,60],'Ylim',[0,60],'Clim',[0 2],'position',... | ||
[0.1600 0.1100 0.3347 0.8150]); | ||
colorbar('peer',axes1,'Ticks',[0.5 1.5],'fontsize',14,'position',... | ||
[0.83,0.11,0.025,0.123],'Visible','off'); | ||
|
||
% Plot original Snesim realization | ||
axes2=subplot(1,2,2);imshow(RGB_RE2,ColorMatrix./255,'InitialMagnification','fit'); | ||
axis on; | ||
axis xy; | ||
title(axes2,{'(b) original Snesim realization'},'FontSize',14,'position',... | ||
[30.200000000000003,-7.846491228070176,0]); | ||
% set(axes2,'Xlim',[0,60],'Ylim',[0,60],'Clim',[0 2]); | ||
set(axes2,'Xlim',[0,60],'Ylim',[0,60],'Clim',[0 2],'position',... | ||
[0.5200 0.1100 0.3347 0.8150]); | ||
colorbar('peer',axes2,'Ticks',[0.5 1.5],'TickLabels',... | ||
{'background','channel'},'fontsize',14,'position',... | ||
[0.855170549860202,0.111666666666668,0.017150046598325,0.123000000000001]); | ||
set(gcf,'position',[2085,464,1073,420]); | ||
|
||
% create ellipse | ||
annotation(gcf,'ellipse',... | ||
[0.235787511649581 0.257142857142857 0.0475302889095993 0.133333333333334],... | ||
'Color',[0 0 1],... | ||
'LineWidth',2,... | ||
'LineStyle','--'); | ||
|
||
% create ellipse | ||
annotation(gcf,'ellipse',... | ||
[0.30009319664492 0.538095238095242 0.0475302889095993 0.133333333333335],... | ||
'Color',[0 0 1],... | ||
'LineWidth',2,... | ||
'LineStyle','--'); | ||
|
||
% create ellipse | ||
annotation(gcf,'ellipse',... | ||
[0.601118359739048 0.445238095238099 0.0475302889095993 0.133333333333334],... | ||
'Color',[0 0 1],... | ||
'LineWidth',2,... | ||
'LineStyle','--'); | ||
|
||
% create ellipse | ||
annotation(gcf,'ellipse',... | ||
[0.656104380242308 0.538095238095243 0.0475302889095992 0.133333333333335],... | ||
'Color',[0 0 1],... | ||
'LineWidth',2,... | ||
'LineStyle','--'); | ||
|
||
% create ellipse | ||
annotation(gcf,'ellipse',... | ||
[0.600186393289839 0.254761904761907 0.0475302889095994 0.133333333333334],... | ||
'Color',[0 0 1],... | ||
'LineWidth',2,... | ||
'LineStyle','--'); | ||
|
||
% create textbox | ||
annotation(gcf,'textbox',... | ||
[0.215284249767008 0.255373346095801 0.0421013420633694 0.0960076062851533],... | ||
'Color',[0 0 1],... | ||
'String',{'a'},... | ||
'FontWeight','bold',... | ||
'FontSize',18,... | ||
'EdgeColor','none'); | ||
|
||
% create ellipse | ||
annotation(gcf,'ellipse',... | ||
[0.244175209692451 0.440476190476192 0.0475302889095992 0.133333333333335],... | ||
'Color',[0 0 1],... | ||
'LineWidth',2,... | ||
'LineStyle','--'); | ||
|
||
% create textbox | ||
annotation(gcf,'textbox',... | ||
[0.226467847157502 0.529182869905328 0.0435916550646241 0.0960076062851533],... | ||
'Color',[0 0 1],... | ||
'String',{'b'},... | ||
'FontWeight','bold',... | ||
'FontSize',18,... | ||
'EdgeColor','none'); | ||
|
||
% create textbox | ||
annotation(gcf,'textbox',... | ||
[0.289841565703633 0.657754298476758 0.0421013420633694 0.0960076062851533],... | ||
'Color',[0 0 1],... | ||
'String',{'c'},... | ||
'FontWeight','bold',... | ||
'FontSize',18,... | ||
'EdgeColor','none'); | ||
|
||
% create textbox | ||
annotation(gcf,'textbox',... | ||
[0.575023299161228 0.255373346095803 0.0421013420633695 0.0960076062851533],... | ||
'Color',[0 0 1],... | ||
'String',{'a'},... | ||
'FontWeight','bold',... | ||
'FontSize',18,... | ||
'EdgeColor','none'); | ||
|
||
% create textbox | ||
annotation(gcf,'textbox',... | ||
[0.579683131407267 0.524420965143424 0.043591655064624 0.0960076062851533],... | ||
'Color',[0 0 1],... | ||
'String',{'b'},... | ||
'FontWeight','bold',... | ||
'FontSize',18,... | ||
'EdgeColor','none'); | ||
|
||
% create textbox | ||
annotation(gcf,'textbox',... | ||
[0.650512581547061 0.657754298476759 0.0421013420633695 0.0960076062851533],... | ||
'Color',[0 0 1],... | ||
'String',{'c'},... | ||
'FontWeight','bold',... | ||
'FontSize',18,... | ||
'EdgeColor','none'); | ||
|
||
% Fig. 10. Unconditional simulation realizations | ||
export_fig non-conditional_simulation.png -m2.5 |
148 changes: 148 additions & 0 deletions
148
Paper_Test_Code/Fig11/Theory_MultiTree_Snesim_conditon.m
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 |
---|---|---|
@@ -0,0 +1,148 @@ | ||
%% Theory test, multiple trees and original Snesim, conditional | ||
% Fig. 11. Hard data and conditional simulation realizations | ||
clear all;close all;clc | ||
tic; | ||
addpath('../../export_fig-master'); | ||
addpath(genpath('../../mGstat')); | ||
addpath('../../relycode'); | ||
% training image | ||
TI=channels; | ||
TI=TI(1:2:end,1:2:end); | ||
|
||
% Parameters setting | ||
options.n_mulgrids=1;; | ||
options.n_cond=[25 25 25 25];; | ||
options.n_template=[81 81 81 81]; | ||
|
||
options.plot_interval=1;; | ||
|
||
% set the data template and search tree | ||
global T; | ||
T = []; | ||
global ST; | ||
ST= []; | ||
global Bool; | ||
|
||
% Count the number of nodes for multiple search tree | ||
global num; | ||
num(4) = 0; | ||
|
||
global num2; | ||
num2(4) = 0; | ||
|
||
% Multiple search tree and original Snesim comparision | ||
Cal = {'MultiTree','OneTree'}; | ||
% generate random grid node with value: 0 and 1 | ||
i_node=get01(15,14); | ||
i_node(i_node==0)=NaN; % change 0 to NaN | ||
% Setting the size of work area | ||
SIMT = {60}; | ||
|
||
for i = 1:size(SIMT,2) | ||
for j = 1:size(Cal,2) | ||
Bool = Cal{j}; | ||
SIM=ones(SIMT{i},SIMT{i})*NaN; | ||
% Capture training images to 60*60 | ||
TIc = TI(33:92,33:92); | ||
SIM(:,1:6)=TIc(:,1:6); % Set work area 1:6 column to known | ||
% After 7th columns in the work area, the rows and columns are | ||
% sampled at an interval of 4 (taken from the intercepted TIc) | ||
SIM(1:4:end,7:4:end)=TIc(1:4:end,7:4:end); | ||
% fill i_node to the sampling points after | ||
% the 7th column in the work area, and omit some sampling points | ||
SIM(1:4:end,7:4:end)=SIM(1:4:end,7:4:end).*i_node; | ||
% if strcmp(Bool,'MultiTree') | ||
% parpool(4); | ||
% else | ||
% delete(gcp('nocreate')); | ||
% end | ||
rng(1); | ||
% Simulate | ||
t = 0; | ||
tic; | ||
[out{i}{j},outresult{i}{j}]=mps_snesim(TI,SIM,options); | ||
t = t+toc; | ||
fprintf(['run ',Bool,' spend: %d\n'],t); | ||
outresult{i}{j}.out = out{i}{j}; | ||
end | ||
end | ||
toc; | ||
|
||
%% Plot simulation results | ||
figure; | ||
% Define color mapping matrix | ||
ColorMatrix=[0,139,0;255,255,0]; | ||
ColorMatrixSIM=[0,139,0;255,255,0;255,255,255]; | ||
|
||
% Calculate color matrix | ||
RGB_RE1=TI2RGB(out{1}{1},ColorMatrix); | ||
RGB_RE2=TI2RGB(out{1}{2},ColorMatrix); | ||
% Set the simulating point to Nan in the sampling condition data to 2 | ||
SIM(isnan(SIM))=2; | ||
RGB_SIM=TI2RGB(SIM,ColorMatrixSIM); | ||
|
||
%% Plot sampling condition data | ||
set(gcf,'position',[138,495,1608,479]); | ||
axes1=subplot(1,3,1);imshow(RGB_SIM,ColorMatrixSIM./255,'InitialMagnification','fit'); | ||
axis on; | ||
axis xy; | ||
title(axes1,{'(a) conditioning data'},'FontSize',14,'position',... | ||
[30.43328498675075,-10.072202166064972,0]); | ||
set(axes1,'Xlim',[0,60],'Ylim',[0,60],'Clim',[0 3]); | ||
colorbar('peer',axes1,'Ticks',[0.5 1.5 2.5],... | ||
'TickLabels',{'background','channel','unknown'},'FontSize',14,'Visible','on'); | ||
|
||
% Plot multiple search trees realization | ||
axes2=subplot(1,3,2);imshow(RGB_RE1,ColorMatrix./255,'InitialMagnification','fit'); | ||
axis on; | ||
axis xy; | ||
title(axes2,{'(b) multiple search trees realization'},'FontSize',14,'position',... | ||
[30.43328498675075,-10.072202166064972,0]); | ||
set(axes2,'Xlim',[0,60],'Ylim',[0,60],'Clim',[0 2]); | ||
colorbar('peer',axes2,'Ticks',[0.5 1.5],'TickLabels',{'background','channel'},'Visible','off'); | ||
|
||
% Plot original Snesim realization | ||
axes3=subplot(1,3,3);imshow(RGB_RE2,ColorMatrix./255,'InitialMagnification','fit'); | ||
axis on; | ||
axis xy; | ||
title(axes3,{'(c) original Snesim realization'},'FontSize',14,'position',... | ||
[30.43328498675075,-10.072202166064972,0]); | ||
set(axes3,'Xlim',[0,60],'Ylim',[0,60],'Clim',[0 2]); | ||
colorbar('peer',axes3,'Ticks',[0.5 1.5],'TickLabels',... | ||
{'background','channel'},'Visible','off'); | ||
axes3.Position = [0.61385788449059,0.11,0.172257372696506,0.815]; | ||
|
||
% create textbox | ||
annotation(gcf,'textbox',... | ||
[0.42226368159204,0.275522778525647,0.029705573632514,0.099019609619589],... | ||
'Color',[0 0 1],... | ||
'String',{'a'},... | ||
'FontWeight','bold',... | ||
'FontSize',18,... | ||
'EdgeColor','none'); | ||
|
||
% create ellipse | ||
annotation(gcf,'ellipse',... | ||
[0.437567164179104,0.251559251559252,0.036313432835821,0.125891728832905],... | ||
'Color',[0 0 1],... | ||
'LineWidth',2,... | ||
'LineStyle','--'); | ||
|
||
% create ellipse | ||
annotation(gcf,'ellipse',... | ||
[0.633462686567163,0.246361746361746,0.036313432835821,0.128638253638253],... | ||
'Color',[0 0 1],... | ||
'LineWidth',2,... | ||
'LineStyle','--'); | ||
|
||
% create textbox | ||
annotation(gcf,'textbox',... | ||
[0.616915422885571 0.267172047836712 0.029705573632514 0.0990196096195894],... | ||
'Color',[0 0 1],... | ||
'String',{'a'},... | ||
'FontWeight','bold',... | ||
'FontSize',18,... | ||
'EdgeColor','none'); | ||
|
||
% Fig. 11. Hard data and conditional simulation realizations | ||
export_fig conditional_simulation.png -m2.5 |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
%% Fig. 12. Training image | ||
clear all;close all;clc | ||
addpath('../../export_fig-master'); | ||
addpath('../../relycode'); | ||
figure; | ||
% Set color mapping matrix | ||
ColorMatrix=[0,139,0;255,255,0]; | ||
|
||
% data = TI; % Here must give the data with TI. | ||
load('Gudao_Ti.mat'); | ||
% Calculate color matrix | ||
RGB_TI=TI2RGB(data,ColorMatrix); | ||
|
||
% Plot training image | ||
axes1=subplot(1,1,1);imshow(RGB_TI,ColorMatrix./255,'InitialMagnification','fit'); | ||
axis on; | ||
axis xy; | ||
set(axes1,'Xlim',[0,80],'Ylim',[0,80],'Clim',[0 2]); | ||
colorbar('peer',axes1,'Ticks',[0.5 1.5],'fontsize',14,'position',... | ||
[0.756,0.11,0.025,0.123],'TickLabels',{'background','channel'},'Visible','on'); | ||
set(gcf,'position',[2459,378,741,420]); | ||
|
||
% Fig. 12. Training image | ||
export_fig Gudao_TI.bmp -m2.5 |
Binary file not shown.
Oops, something went wrong.