Filter löschen
Filter löschen

how can we get coordinates of non zero pixel in 3D image

4 Ansichten (letzte 30 Tage)
IKRAM jebali
IKRAM jebali am 1 Feb. 2017
I have a stack of 249 images (image of the skeleton of the aorta) it appears like points in some slices and like lines in another slices. I want to get for each slice the coordinates of the non zero value in the image (my images are binary). I tried the command Find but it gives me just the coordinates and i don't know at which slice it corresponds.

Antworten (2)

KSSV
KSSV am 1 Feb. 2017
Bearbeitet: KSSV am 1 Feb. 2017
find gives you row and col position along with the value you asked to seek. You can run a loop on each matrix and use find as
[row,col,v] = find(I(:,:,1)~=0)
Or alternatively you can try find on 3D matrix using:
[r,c,v] = ind2sub(size(I),find(I ~= 0));
  3 Kommentare
Image Analyst
Image Analyst am 17 Dez. 2018
Of WHAT point? You have the coordinates of all the points. If you want one certain special point, you're going to have to identify it somehow so we know which one it is.
Sayan Bhattacharya
Sayan Bhattacharya am 18 Dez. 2018
Bearbeitet: Sayan Bhattacharya am 18 Dez. 2018
Image Analyst,
Like in the following figure, let's say its size is 100x100 that's rows & columns.
If we are moving lets say from 1st row to the last row in a loop can you please help me get the code for identifying the co-ordinates of that point where there is 1st non zero pixel encountered?

Melden Sie sich an, um zu kommentieren.


IKRAM jebali
IKRAM jebali am 1 Feb. 2017
Bearbeitet: KSSV am 1 Feb. 2017
Thank you for your answer. I tried these two commands but it doesn't give me what I want to get. And when I use a loop it gives no value for r,c and v (an empty scalar).
For i=1:249
[r c v]=find (I (:,:,i))
end
This is the loop I've tried.
  3 Kommentare
IKRAM jebali
IKRAM jebali am 1 Feb. 2017
this is my code skel = load_nii('CT10seg_skel.img'); skel=skel.img; for i=1:249 [x y v]=find(skel(:,:,i)==0); end
IKRAM jebali
IKRAM jebali am 1 Feb. 2017
Thank you for your answer, I think maybe the problem is with my image.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Geometric Transformation and Image Registration finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by