Change pixels to mm in axes in plot
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello, I have a table, I know that 1 pixel is 0.14mm. But if I plot some points from the table. The axes is in pixels. But I would like to have it in mm. How can I do it?
I was trying to use imred2D function, but as you can see I have a problem here.
Thank you so much for your answer.
Respuestas (1)
Meet
el 6 de Mzo. de 2023
Editada: Meet
el 6 de Mzo. de 2023
Hi,
Assuming that you are using the imshow method as shown in the code snippet, then that may not be the correct way of using it. You need to pass two arguments in the imshow function like imshow(A,RA) where A is the original image and RA is imref2d object.
Please refer the below example:
Create 2-D Spatial Referencing Object Knowing Image Size and Resolution
Read a 2-D grayscale image into the workspace.
m = dicominfo('knee1.dcm');
A = dicomread(m);
Create an imref2d object, specifying the size and the resolution of the pixels. The DICOM file contains a metadata field PixelSpacing that specifies the image resolution in each dimension in millimeters per pixel.
RA = imref2d(size(A),m.PixelSpacing(2),m.PixelSpacing(1))
RA =
imref2d with properties:
XWorldLimits: [0.1562 160.1562]
YWorldLimits: [0.1562 160.1562]
ImageSize: [512 512]
PixelExtentInWorldX: 0.3125
PixelExtentInWorldY: 0.3125
ImageExtentInWorldX: 160
ImageExtentInWorldY: 160
XIntrinsicLimits: [0.5000 512.5000]
YIntrinsicLimits: [0.5000 512.5000]
Display the image, specifying the spatial referencing object. The axes coordinates reflect the world coordinates.
figure
imshow(A,RA,'DisplayRange',[0 512])
0 comentarios
Ver también
Categorías
Más información sobre Lighting, Transparency, and Shading en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!