現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
How can I obtain voxel coordinates and corresponding intensity value of all voxels in a MRI image?
13 ビュー (過去 30 日間)
古いコメントを表示
Hi I have medical MRI images. I wish to obtain all voxel coordinates as 3 columns with the 4th column giving the corresponding intensity value.
1st column :- X coordinate
2nd column :- Y coordinate
3rd column :- Z coordinate
4th column :- corresponding intensity value
Is there any function that can automatically do that ? The file format is DICOM file. Your help is appreciated
回答 (1 件)
Image Analyst
2015 年 12 月 11 日
Yes, use meshgrid and (:). Something like (untested)
[x, y, z] = meshgrid(1:columns, 1:rows, 1:slices);
out4Column = [x,y,z, yourImage(:)];
15 件のコメント
Sara Salimi
2015 年 12 月 11 日
編集済み: Sara Salimi
2015 年 12 月 11 日
Dear Image Analyst, Thanks for your answer. I'm a beginner in matlab. How can I load MRI image and how can apply this command for that image Voxels? I know we can load the image by dicomread() command. But I don know how can I apply those command to find the position and intensity of voxels? I need to extract coordinates and intensity for each voxel. I have attached one of the files. Could you please help me? Once again Thanks a lot for your help.
Walter Roberson
2015 年 12 月 11 日
out4Column = [x,y,z, yourImage(:)]; should be
out4Column = [x(:), y(:), z(:), yourImage(:)];
Walter Roberson
2015 年 12 月 11 日
Once you have your 4D array, say X, then you can get the results you are looking for by:
idx = find(X);
[row, col, page] = ind2sub(size(X), idx);
out4Column = [col(:), row(:), page(:), X(idx)];
Notice that I used col and then row rather than row and then col. In MATLAB, the rows correspond to Y (height) and the columns correspond to X (across)
The above lists only the non-zero values. If you want to include the 0 values as well, that can be done without much trouble.
The coordinates that would be used here are pixel coordinates. If you need the values in real-world coordinates, it will be necessary to extract some header information from the dicom files to figure out how pixels corresponds to x and y and z.
Sara Salimi
2015 年 12 月 13 日
Dear Walter, many thanks for your answer, I tried the code for a folder of MRI images and it was successful. It gave me out4Column with 4 columns. Could you please explain what is idx = find(X)? Is X(idx) the amount of intensity for the voxel? Is the first column as col number and second column as row number? Nevertheless I appreciate your help.
Thanks
Walter Roberson
2015 年 12 月 13 日
"k = find(X) returns a vector containing the linear indices of each nonzero element in array X."
I did code the first column of the output as column number (which corresponds to X), then the second as row number (which corresponds to Y), then the third as page number (which corresponds to Z), then the fourth as the intensity.
It is not common to create a table of values such as this: most of the time that you need this kind of information, it is easier to deal with it as separate variables then as a single matrix. Mostly a table like this is useful for writing the values out to a file.
Keep in mind that the size of the table might be up to 4 times larger than the size of the image array itself, if none of the values in the image are 0.
Sara Salimi
2015 年 12 月 13 日
Dear Walter, Once again Thanks alot for your help.
I really appreciate it.
Regards
Sara
Sara Salimi
2015 年 12 月 15 日
Hi again,
I changed the code for another folder which includes 22 dicom image; however, it gives this error "Subscripted assignment dimension mismatch.
Error in TempTest (line 10) X(:,:,1,p) = dicomread(filename); "
I also changed the image array size to 22 (number of images in the folder). Before I change the folder, it was working for dicom image downloaded from Dicom example files ,what is the problem? :(
Thanks for your help in advance
Walter Roberson
2015 年 12 月 15 日
Some of your images are a different size. You should assign the result of dicomread() to a variable and then test the size() of the result to determine whether it fits into the array. See my code in http://uk.mathworks.com/matlabcentral/answers/258988-loading-mutiple-dicom-images#answer_202284
Sara Salimi
2015 年 12 月 17 日
Hi Walter, I checked the size of files, you are absolutely right, It shows which of my images is corrupt. For the next step, what should I solve this issue and resize all dicom files with a same size?
I really appreciate your help :)
Image Analyst
2015 年 12 月 17 日
Contact the manufacturer or person that made your images to find out why they're different sizes.
Vasantha Lakshmi
2017 年 3 月 9 日
I need to get the voxel coordinates and intensity values of mri image which are of .mha format.How can I get it?
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)