Plotting average intensity for multiple trajectories which have different lengths(Image Processing,Partcle tracking)
5 views (last 30 days)
Show older comments
I have an output data of particle tracking through imageJ. In this data, there are columns of trajectory number, frame number, xyz coordinates, and intensity. Every trajectories are consist of a different number of frames with different starting point, and different value of intensity(m0 column refers to the intensity in attached data).
I'd like to plot average intensity of all trajectories over time. How can I address this? There are some error in my script.
data = xlsread('test.csv');
col1 = data(:, 1);
col2 = data(:, 2);
col3 = data(:, 3);
col4 = data(:, 4);
col5 = data(:, 5);
col6 = data(:, 6);
col7 = data(:, 7);
% Align all trajectory to same start time, 0.
TCount = max(col1(:)); %Trajectory count
hold on
for i=[1:TCount]
v=col2(col1==i);
new_col2{i,:}=v(:)-v(1); %substrating initial time(to shift to 0)
new_col6{i,:}=col6(col1==i);
plot(new_col2{i,:},new_col6{i,:})
end
hold off
xlabel('x'); ylabel('y');
% Average; all trajectories have different length.
for z=1:TCount
temp(z)=max(new_col2{z}(:));
end
traj_max=max(temp); %Maximum number of each trajectories
average_int=zeros(traj_max); %save in the matrix(159,159 in this example)
for i=1:traj_max %(1~159) Maximal trajectory
temp_1=0;
temp_2=0;
for z=1:TCount % All trajectory
if temp(z)<=i %Is the current trajectory is smaller or equal than certain value
temp_2=1+temp_2; %Counting; the number of trajectories at certain frame
temp_1=new_col6{z}(i)+temp_1; % collect the intensity trajectory <<---------error line
end
end
average_int(i)=temp_1/temp_2;
end
plot(average_int)
0 Comments
Answers (0)
See Also
Categories
Find more on Image Filtering and Enhancement in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!