Imref2d or 3d show wrong resolution
3 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I am not sure what I am misunderstanding about the use of the Imref features. This came up when I was setting up some DICOM coordinates but can be shown with a simple example.
Let's say I know that the x and y direction coordinates for each voxel can be stated as
x_coord = 1:0.5:100;
and same for y. The first value is the first coordinate position, the middle is the pixel spacing, and last is the last coordinate given. This would give an image size of 199x199.
I then use imref2d:
R = imref2d([199 199], [1 100],[1 100])
which is giving the size, and the x/y world extents from min to maximum.
When this is inspected, it then says that the PixelExtentInWorldX is 0.4975 - obviously incorrect from what I stated above.
So my question is, are the world limits defined as inclusive for the minimum and exclusive for the maximum? To get the correct spacing I would have to specify:
R = imref2d([199 199], [1 100+0.5],[1 100+0.5])
i.e., add the pixel spacing to the end extent. This seems a bit messy when using imref3d, espcially when considering the use of it with imwarp.
Thanks, let me know if I should clarify anything
0 件のコメント
採用された回答
Julianna Mather
2020 年 9 月 28 日
編集済み: Julianna Mather
2020 年 9 月 28 日
The "world limits" you provide in the 2nd and 3rd arguments to imref2d measure from the outside of the pixels, not the centers.
You stated that the pixels have a width of 0.5 units, so the image raster starts on the left edge at 0.75 = (1 - 0.5/2) and goes to 100.25 = (100 + 0.5/2) on the right.
So you would call imref2d this way: R = imref2d([199 199], [0.75 100.25], [0.75 100.25]);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で 3-D Volumetric Image Processing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!