Filter löschen
Filter löschen

Can someone please help me with this code?

3 Ansichten (letzte 30 Tage)
Sigal Cohen
Sigal Cohen am 21 Aug. 2017
Hi, I hope it's not to much to ask, if it is - my apologies.
I have this code I'm trying to understand how it works. It's used for analyzing pictures (by comparing them to one another).
My first question is regarding the sum command; what does it do to the pictures?
Secondly, what does the fspecial command defines in this code?
clearvars -except Struct
program =2;
addpath(genpath('G:\DATA SUM\ISI\310815\Aug.31,2015 15.44.55\TimtomlineData'));
if program ==2
clear all
close all
clc
load('Cycle_1.mat');
Struct(1).file=Out_mat;
load('Cycle_2.mat');
Struct(2).file=Out_mat;
load('Cycle_3.mat');
Struct(3).file=Out_mat; %it goes on and on to 4,5,6,...
end
%%Process script
[R, C]=size(Struct);
[R1, C1, F1]=size(Struct(1).file);
AddVol=zeros(R1,C1,F1);
AddFrame=zeros(R1,C1);
sum1=sum(sum(Struct(1).file));
sum1=squeeze(sum1)';
sum1(1,1)=sum1(1,2);
figure,plot(sum1)
hold on
%%Post Processing
H = fspecial('average',[10 10]) ;
for i=1:C
AddVol=imadd(AddVol,(double(Struct(i).file./C)));
end
AddVol(:,:,1:8)=[];
[Row1, Col1, F3]=size(AddVol);
threesecframes=8*3-1;
% Avg data before stimuli
for j=1:threesecframes-1
AddFrame=imadd(AddFrame,(AddVol(:,:,j)./threesecframes));
end
K1=10000;
K2=1;
% Frame Division
for k=1:F3
DivideIM(:,:,k)=(imdivide(double(AddVol(:,:,k)),double(AddFrame)).*K1+K2);
end
% Filtering
for q=1:F3
FiltImdat(:,:,q)= imfilter(DivideIM(:,:,q),H,'circular' );
end
%%Division of Data
maxLev2=max(DivideIM(:));
minLev2=min(DivideIM(:));
figure,imshow3D(DivideIM,[minLev2 maxLev2]), colormap jet
%%Filtering Data
maxLev3=max(FiltImdat(:));
minLev3=min(FiltImdat(:));
figure,imshow3D(FiltImdat,[minLev3 maxLev3]), colormap jet
%%Maximum Intensity Projection
MaxIntensityProj=FiltImdat(:,:,26:33);
[R1,C1,L1]=size(MaxIntensityProj);
for f1=1:R1
for f2=1:C1
MaxPrj(f1,f2)= max(MaxIntensityProj(f1,f2,:));
end
end
figure,imagesc(MaxPrj),colormap jet, title('Max Intensity Projection')
% to get the blood vessel patterns:
% figure,imshow3D(Struct(3).file)
Thank you for your help,
Sigal.

Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by