Hi everyone.
Please help me. Now i have 20 slice image PET(dicom format dimension 256x256). 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..

댓글 수: 1

mohd akmal masud
mohd akmal masud 2017년 12월 13일
One more thing the slice no.
Example:
[[rows, column, PixelValue, Slice]=

댓글을 달려면 로그인하십시오.

 채택된 답변

Rik
Rik 2017년 12월 13일
편집: Rik 2017년 12월 13일

0 개 추천

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);

댓글 수: 12

mohd akmal masud
mohd akmal masud 2017년 12월 13일
ok thanks sir. but does mean val in command val=X(X(:)>10000 & X(:)<32000); ??
Rik
Rik 2017년 12월 13일
The colon transforms the matrix to a vector, so X(:)>10000 will result in a binary vector, which is 1 for positions where the value is larger than 10000, and 0 where X is smaller. Then you can use the logical for the aptly named logical indexing. The reason I did it like this is that I was too lazy to check what the result would be without the colons, and this will make sure you have val in the shape of a vector.
So in short, val is the PixelValue at (r,c,slice).
PS I added an alternative to my answer.
mohd akmal masud
mohd akmal masud 2017년 12월 13일
Very good explanation. thank you so much.
mohd akmal masud
mohd akmal masud 2017년 12월 14일
Dear Rik,
From your code, I have done got all the pixel and the location. Can you help me to build up the volume of that ?? Meaning i want to show them the combine voxel to one volume.
Rik
Rik 2017년 12월 14일
Additional question sent by mail:
This function work very well. Now if i want to know the location of Z, is it correct that is my code? [X,Y,Z,slice]=findND(X>10000 & X<32000); val=X(X(:)>10000 & X(:)<32000); Another question is, if i have get the location pixel X, Y, Z location, how to draw the image by location pixel that i get??
Rik
Rik 2017년 12월 14일
The slice is already the z-coordinate. Is that what you mean by building up a volume? Or do you mean something else?
How would you want your visualization to be? You could use isosurface, then you don't even need the previous part (unless you use it in further processing of course).
mohd akmal masud
mohd akmal masud 2017년 12월 14일
yes, i mean building up a volume
Rik
Rik 2017년 12월 14일
You already have a volume: your data was loaded to 3D to begin with. It is not clear to me what you mean with building up a volume, so you will have to explain what it is you want to do, otherwise I can't help you.
I would also suggest looking into the isosurface function (you can plot the result with patch).
ok, i will look isosurface function
mohd akmal masud
mohd akmal masud 2017년 12월 14일
thanks rik
Sorry all, another question i have but i wrote at this space. please help me
Dear all,
this is my code to view CT image by slice
P = zeros(256, 256, 72);
for K = 1 : 72
petname = sprintf('I4%03d.dcm', K);
P(:,:,K) = dicomread(petname);
end
imshow3D(P)
then, this is my code for view SPECT image by slice,
Noted: all my 42 slice SPECT image stored in one file.
[spect map]=dicomread('128x128');
info = dicominfo('128x128');
gp=info.SliceThickness;
spect=(squeeze(spect));%smooth3
aa=size(spect);aa=aa(3);
imshow3D(spect);
Anybody can help me to fuse both SPECT and CT images for all slice?
Rik
Rik 2019년 3월 24일
Please post this as a separate question.
Note that image fusing is only possible if you have the full positional information for both scans. Only then is it possible to resample one scan to the coordinate grid of the other.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

질문:

2017년 12월 13일

댓글:

Rik
2019년 3월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by