MATLAB: How to superimpose the image

superimposed

Hi, I have 5 types of result as shown in code below;
if true
% code
end
TPSshrink=imerode(TPS,ones(4));
TPS_=TPSshrink;
TPSth=TPS_;
TPSth(TPS_<(CTV3))=0;
%2arraywithouterror
TwoDref=TwoD;
TwoDth=TwoDref;
TwoDth(TwoDref<(CTV3))=0;
%2Darraywitherror
TwoDerror=TwoD1;
TwoD1th=TwoDerror;
TwoD1th(TwoDerror<(CTV3))=0;
%NAL
TwoDNAL=TwoD2;
TwoD2th=TwoDNAL;
TwoD2th(TwoDNAL<(CTV3))=0;
%eNAL
TwoDeNAL=TwoD3;
TwoD3th=TwoDeNAL;
TwoD3th(TwoDeNAL<(CTV3))=0;
The images of the result are shown as above. TPSth in the code is the TPS dose map, TwoDth in the code is the measured reference dose map in the attached image.
So the problem now, I would like to superimposed the TwoDth, TwoDth1, TwoDth2 and TwoDth3 on TPSth to see how the dose map from TwoD able to cover the dose map from TPS.
Thanks for the help.

Best Answer

load example1.mat
TPSshrink=imerode(TPSth,ones(4));
TPS_=TPSshrink;
TPSth=TPS_;
CTV3 = 5 ;
TPSth(TPS_<(CTV3))=0;
%2arraywithouterror
TwoDref=TwoDth;
TwoDth=TwoDref;
TwoDth(TwoDref<(CTV3))=0;
%2Darraywitherror
TwoDerror=TwoD1th;
TwoD1th=TwoDerror;
TwoD1th(TwoDerror<(CTV3))=0;
%NAL
TwoDNAL=TwoD2th;
TwoD2th=TwoDNAL;
TwoD2th(TwoDNAL<(CTV3))=0;
%eNAL
TwoDeNAL=TwoD3th;
TwoD3th=TwoDeNAL;
TwoD3th(TwoDeNAL<(CTV3))=0;
[y1,x1] = find(TPSth) ; idx1 = boundary(x1,y1) ;
[y2,x2] = find(TwoDth) ; idx2 = boundary(x2,y2) ;
[y3,x3] = find(TwoD1th) ; idx3 = boundary(x3,y3) ;
[y4,x4] = find(TwoD2th) ; idx4 = boundary(x4,y4) ;
[y5,x5] = find(TwoD3th) ; idx5 = boundary(x5,y5) ;
%
figure
hold on
plot(x1(idx1),y1(idx1),'r') ;
plot(x2(idx2),y2(idx2),'b') ;
plot(x3(idx3),y3(idx3),'g') ;
plot(x4(idx4),y4(idx4),'m') ;
plot(x5(idx5),y5(idx5),'k') ;
legend('TPSth', 'TwoDth','TwoD1th','TwoD2th','TwoD3th')