MATLAB: Location pixel and slice

image analysisimage processingimage segmentation

Hi everyone.
Please help me. Now i have 20 slice image PET(dicom format dimension 256×256). How to determine:
1) The extrat location of pixel value with range 10000-32000 every slice.
Example: [rows, column, PixelValue]=
Below is my code to read all the 20 slice:
first_to_read = 1; last_to_read = 20; num_to_read = last_to_read – first_to_read + 1; for file_idx = 1 : num_to_read img_number = file_idx + first_to_read – 1; filename = fullfile('D:\Images PET and CT\PET', sprintf('PET_I1001_PT%03d.dcm', img_number)); X(:, : , 1, file_idx) = dicomread(filename); end
Help me..

Best Answer

If you had only a 2D question, you could use find, but for some odd reason, it doesn't support more than 3D, so I've made a FEX submission for a similar goal as yours: findND.
[r,c,slice]=findND(X>10000 & X<32000);
val=X(X(:)>10000 & X(:)<32000);
Alternatively:
X_temp=X;
X_temp(X>10000 & X<32000)=0;
[r,c,slice,val]=findND(X_temp);
Related Question