Location pixel and slice
显示 更早的评论
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 个评论
One more thing the slice no.
Example:
[[rows, column, PixelValue, Slice]=
采纳的回答
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 个评论
ok thanks sir. but does mean val in command val=X(X(:)>10000 & X(:)<32000); ??
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.
Very good explanation. thank you so much.
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.
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??
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).
yes, i mean building up a volume
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
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?
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 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Discrete Data Plots 的更多信息
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
