[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Selecting data from a matrix using a mask
From: |
samsetch |
Subject: |
Selecting data from a matrix using a mask |
Date: |
Wed, 25 May 2011 07:43:19 -0700 (PDT) |
Hello I am new to Octave but am trying to use it as a tool to analyze paired
matrices that are created as an output from a MetriPol microscope system.
The output given is two 1024x1360 matricies, one containing vales from
0-180 (angles) the other 0-0.8 (sindelta)
The idea is to create a mask from the angle data with a threshold of say 100
degrees. I then aim to lables the points less than 100 degrees as 1 the rest
0's. I then want to use this mask to analyze the sindelta matrix and pick
out the points that relate to these 1's.
After discussion with a colleague who was experienced in MATLAB he came up
with this code:
% runs a masking of sindelta vaules given a orientation threshold
% x is the orientation data 0-180 range
x
threshold=100;
[row,col]=find(x>threshold);
lengthrow=length(row);
% looping through all x,y coords that are >100 and zero-ing them.
Thresholding data
for t=1:lengthrow
x(row(t),col(t))=0;
end
x=(x>0);
figure(1)
image(x)
[row1,col1]=find(x==1);
% load data sindelta call it y
lengthrow1=length(row1);
sizex=size(x);
yselectregions=zeros(sizex(1),sizex(2))
% making image containing only sindelta values that match with the
orientation %data<threshol
for t=1:lengthrow
yselectregions(row1(t),col1(t))=y(row1(t),col1(t));
end
figure(2)
image(yselectregions)
However this is just creating a matrix of 0's
Any help with this problem would be greatly appreciated.
Thanks
Sam
--
View this message in context:
http://octave.1599824.n4.nabble.com/Selecting-data-from-a-matrix-using-a-mask-tp3549918p3549918.html
Sent from the Octave - General mailing list archive at Nabble.com.
- Selecting data from a matrix using a mask,
samsetch <=