How can I see the actual size of MRI slice?

Or any other picture.
In my axis (showing the MRI) the xmax and ymax are the number of pixels the image have.
Can I get the actual size of image in milimeters from metadata?
How can I set that axis so the y and x scales are shown in mm or inches?
Thanks.

 Accepted Answer

When you image() or imagesc(), you can tell it the data coordinates at which to put the centers of the lower-left and upper-right pixels. Do be careful though because it is the center, not the edges.

15 Comments

Uh!
I dont even know the physical measurments of slice to begin with.
Can it be set directly on axis in GUI property inspector?
Thanks.
You mentioned "metadata". Is the image a DICOM image? If so then information in the metadata should tell you the sizes involved, even if only the position and the pixel heights and widths.
The property inspector can set the axis XLimit and YLimit and so control the scaling of what is in the axis, but the inner image() object will be scaled within that size according to its XData and YData properties.
The only way you have of changing what shows up in the labels without changing the [XY]Limit and [XY]Data, would be to set the [XY]Label to the values you want -- to "lie". The XTick at location (say) 7 pixels can be told to present the text label "1.2mm" for example. Just don't expect zooming or data cursor to play nice if you do this.
Tomislav
Tomislav on 6 Nov 2012
Edited: Tomislav on 6 Nov 2012
I dont wat to fake dimensions.
Yes It's about DICOM images.
Can you tell me what line in metadata defines pixel distances in x and y direction?
Thanks.
See http://www.mathworks.com/matlabcentral/fileexchange/23455-dicom-directory-of-slices-to-3d-volume-image/content/dicom23D.m for PixelSpacing and see the PhysicalHeight and PhysicalWidth fields that can be returned there.
What if I dont have PixelSpacing or physical H or W in metadata?
Thanks
What do you have in the metadata ?
Note that the physical H and W are calculated by the routine I pointed to.
I understand that physical H and w are calculated from PixelSpacing.
Here is what I have when type info = dicominfo('0001.dcm'):
Filename: '0001.dcm'
FileModDate: '09-lis-2012 21:12:52'
FileSize: 21816
Format: 'DICOM'
FormatVersion: 3
Width: 127
Height: 165
BitDepth: 8
ColorType: 'grayscale'
FileMetaInformationGroupLength: 196
FileMetaInformationVersion: [2x1 uint8]
MediaStorageSOPClassUID: '1.2.840.10008.5.1.4.1.1.7'
MediaStorageSOPInstanceUID: '1.2.276.0.7230010.3.1.4.3310894256.1932.1349809972.4'
TransferSyntaxUID: '1.2.840.10008.1.2.1'
ImplementationClassUID: '1.2.276.0.7230010.3.0.3.5.4'
ImplementationVersionName: 'OFFIS_DCMTK_354'
SOPClassUID: '1.2.840.10008.5.1.4.1.1.7'
SOPInstanceUID: '1.2.276.0.7230010.3.1.4.3310894256.1932.1349809972.4'
StudyDate: '20121009'
SeriesDate: '20121009'
StudyTime: '191252'
SeriesTime: '191252'
AccessionNumber: ''
Modality: 'OT'
ConversionType: 'WSD'
Manufacturer: ''
InstitutionName: ''
ReferringPhysicianName: [1x1 struct]
StudyDescription: ''
SeriesDescription: ''
PatientName: [1x1 struct]
PatientID: ''
PatientBirthDate: ''
PatientBirthTime: ''
PatientSex: ''
StudyInstanceUID: '1.2.276.0.7230010.3.1.2.3310894256.1932.1349809972.5'
SeriesInstanceUID: '1.2.276.0.7230010.3.1.3.3310894256.1932.1349809972.6'
StudyID: ''
SeriesNumber: ''
InstanceNumber: ''
SamplesPerPixel: 1
PhotometricInterpretation: 'MONOCHROME2'
NumberOfFrames: 1
Rows: 165
Columns: 127
BitsAllocated: 8
BitsStored: 8
HighBit: 7
PixelRepresentation: 0
Modality: 'OT' stands for "other". Your file is marked as if it did not originate from MRI (Modality 'MR'), so it does not have information about the physical measurements.
Is it possible that this file is not the original data generated by the MRI machine?
The MRI slices are taken at well known medicine facility. It is original MRI data.
But it was for research purposes specially for faculty, so I guess it could lack some information because of that.
OK. Thank you all.
The DICOM images I used always filled in the manufacturer. The header for that image suggests to me it was created by a post-processing program rather by the device directly.
My bad:
I have converted the original dicom so it is result of that:
This is original:
Filename: '9113.dcm'
FileModDate: '20-ruj-2012 17:01:40'
FileSize: 161814
Format: 'DICOM'
FormatVersion: 3
Width: 192
Height: 248
BitDepth: 16
ColorType: 'grayscale'
FileMetaInformationGroupLength: 192
FileMetaInformationVersion: [2x1 uint8]
MediaStorageSOPClassUID: '1.2.840.10008.5.1.4.1.1.4'
MediaStorageSOPInstanceUID: '1.2.276.0.7238010.5.1.4.0.975.1348153299.2477'
TransferSyntaxUID: '1.2.840.10008.1.2.1'
ImplementationClassUID: '1.2.276.0.7238010.5.0.3.5.4'
ImplementationVersionName: 'OSIRIX'
SourceApplicationEntityTitle: 'DCF'
SpecificCharacterSet: 'ISO_IR 100'
ImageType: 'ORIGINAL\PRIMARY\M\ND\NORM'
InstanceCreationDate: '20120918'
InstanceCreationTime: '181507.171000'
SOPClassUID: '1.2.840.10008.5.1.4.1.1.4'
SOPInstanceUID: '1.2.276.0.7238010.5.1.4.0.975.1348153299.2477'
StudyDate: '20120918'
SeriesDate: '20120918'
AcquisitionDate: '20120918'
ContentDate: '20120918'
StudyTime: '180818.312000'
SeriesTime: '181507.156000'
AcquisitionTime: '181107.092500'
ContentTime: '181507.171000'
AccessionNumber: ''
Modality: 'MR'
Manufacturer: 'SIEMENS'
InstitutionName: 'KB-Dubrava'
InstitutionAddress: 'Avenija G. Suska bb 25,Zagreb,Dubrava,HR,10000'
ReferringPhysicianName: [1x1 struct]
StationName: 'MRC26479'
StudyDescription: 'MR L-S KRALJEZ.(NATIVNO)'
SeriesDescription: 'dicom_denis'
PerformingPhysicianName: [1x1 struct]
OperatorName: [1x1 struct]
ManufacturerModelName: 'OsiriX'
ReferencedPatientSequence: [1x1 struct]
ReferencedImageSequence: [1x1 struct]
PatientName: [1x1 struct]
PatientID: '648053'
IssuerOfPatientID: 'MEDAVIS'
PatientBirthDate: '19770129'
PatientSex: 'M'
PatientAge: '035Y'
PatientWeight: 90
PatientAddress: 'MEDVEDGRADSKA 22A 10000 ZAGREB'
MedicalRecordLocator: '12-39764'
BodyPartExamined: 'HEAD'
ScanningSequence: 'GR\IR'
SequenceVariant: 'SP\MP\OSP'
ScanOptions: 'IR\PFP'
MRAcquisitionType: '3D'
SequenceName: '*tfl3d1'
AngioFlag: 'N'
SliceThickness: 1
RepetitionTime: 1910
EchoTime: 3.5300
InversionTime: 1100
NumberOfAverages: 1
ImagingFrequency: 63.6758
ImagedNucleus: '1H'
EchoNumber: 1
MagneticFieldStrength: 1.5000
NumberOfPhaseEncodingSteps: 223
EchoTrainLength: 1
PercentSampling: 100
PercentPhaseFieldOfView: 75
PixelBandwidth: 130
DeviceSerialNumber: '26479'
SoftwareVersion: 'syngo MR B15'
ProtocolName: 't1_mpr_tra_p2_iso'
TransmitCoilName: 'Body'
AcquisitionMatrix: [4x1 uint16]
InPlanePhaseEncodingDirection: 'ROW'
FlipAngle: 15
VariableFlipAngleFlag: 'N'
SAR: 0.0216
dBdt: 0
PatientPosition: 'HFS'
Private_0019_10xx_Creator: 'SIEMENS MR HEADER'
Private_0019_1008: 'IMAGE NUM 4'
Private_0019_1009: '1.0'
Private_0019_100b: 2.3556e+005
Private_0019_100f: 'Fast'
Private_0019_1011: 'No'
Private_0019_1012: [3x1 int32]
Private_0019_1013: [3x1 int32]
Private_0019_1014: [3x1 double]
Private_0019_1015: [3x1 double]
Private_0019_1017: 0.8036
Private_0019_1018: 15000
StudyInstanceUID: '1.3.12.2.1107.5.2.30.26479.30000012091805010335900000018'
SeriesInstanceUID: '1.3.6.1.4.1.19291.2.1.2.3698460998831100008'
StudyID: '166767'
SeriesNumber: 5340
AcquisitionNumber: 1
InstanceNumber: 1
ImagePositionPatient: [3x1 double]
ImageOrientationPatient: [6x1 double]
FrameOfReferenceUID: '1.3.12.2.1107.5.2.30.26479.1.20120918180818437.0.0.0'
PositionReferenceIndicator: ''
SliceLocation: -61.1414
SamplesPerPixel: 1
PhotometricInterpretation: 'MONOCHROME2'
Rows: 248
Columns: 192
PixelSpacing: [2x1 double]
BitsAllocated: 16
BitsStored: 16
HighBit: 15
PixelRepresentation: 0
WindowCenter: 537
WindowWidth: 1079
RescaleIntercept: 0
RescaleSlope: 1
RescaleType: 'US'
FrameOfInterestDescription: '0'
Private_0029_10xx_Creator: 'SIEMENS CSA HEADER'
Private_0029_11xx_Creator: 'SIEMENS MEDCOM HEADER2'
Private_0029_1008: 'IMAGE NUM 4'
Private_0029_1009: '20120918'
Private_0029_1010: [9380x1 uint8]
Private_0029_1018: 'MR'
Private_0029_1019: '20120918'
Private_0029_1020: [54056x1 uint8]
Private_0029_1160: 'com'
RequestingPhysician: [1x1 struct]
RequestedProcedureDescription: 'GLAVA MR MOZGA'
PerformedProcedureStepStartDate: '20120918'
PerformedProcedureStepStartTime: '180818.390000'
PerformedProcedureStepID: 'MR20120918180818'
PerformedProcedureStepDescription: 'GLAVA^MR MOZGA'
Private_0051_10xx_Creator: 'SIEMENS MR HEADER'
Private_0051_1008: 'IMAGE NUM 4'
Private_0051_1009: '1.0'
Private_0051_100a: 'TA 03:55'
Private_0051_100b: '192p*256s'
Private_0051_100c: 'FoV 192*256'
Private_0051_100d: 'SP F63.3'
Private_0051_100e: 'Tra>Cor(-5.3)'
Private_0051_100f: 'T:HE1-4;NE2'
Private_0051_1011: 'p2'
Private_0051_1012: 'TP 0'
Private_0051_1013: '+LPH'
Private_0051_1015: 'E'
Private_0051_1016: 'p2 M/ND/NORM'
Private_0051_1017: 'SL 1.0i'
Private_0051_1019: 'A1/IR/PFP'
Note that at PixelSpacing is [2x1 double]. What does it mean?
Thanks.
[2 x 1 double] just means that it is a numeric vector whose values have not been displayed.
Tomislav
Tomislav on 7 Nov 2012
Edited: Tomislav on 7 Nov 2012
So there is no way I can know for sure dimensions of slice or the guy's head?
Or I need to into the vector and see the values by myself?
Thanks.
Thank you. It seems that spacing is exactly 1 mm from pixel to pixel. That was confusing.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!