how to find pixel coordinate?

1 visualización (últimos 30 días)
mohd akmal masud
mohd akmal masud el 3 de En. de 2021
Comentada: mohd akmal masud el 4 de En. de 2021
Hi all, can help how to fing the max pixel coordinate? image as attached.
i try below command, row and column is 1. not correct answer. and the slice is 2823 that is max pixel value.
i = dicomread('MLEMITR2SUB24.dcm');
m = max(max(max(i)));
[r, c, slice] = find (m)
r =
1
c =
1
slice =
uint16
2823
anyone can help me?

Respuesta aceptada

KALYAN ACHARJYA
KALYAN ACHARJYA el 3 de En. de 2021
Editada: KALYAN ACHARJYA el 3 de En. de 2021
Note: Suggested to avoid "i" as a vaiable name, as it may conflict with inbuilt "i"
>> i
ans =
0.0000 + 1.0000i
Lets consider image_data as input data, in 2D case, you can directly used the find function, as
[r,c]=find(image_data==max(image_data));
In 3D or higher multidimentional case (Add more variable in LHS, as per dimension of the array), you may use ind2sub to get the desired result
idx=find(image_data==max(image_data(:)));
[rows,colm,sl_num]=ind2sub(size(image_data),idx)
It gives the indices of rows, columns and slice numbers of all maximum pixels elements.
  5 comentarios
mohd akmal masud
mohd akmal masud el 4 de En. de 2021
if i want to pixel value in slice number 50, is it like below the command?
pix_val=image_data(58,79, 50)
mohd akmal masud
mohd akmal masud el 4 de En. de 2021
yes, it work

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by