You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
Getting DICOM viewer to view DICOM images in order of sequence ID
8 views (last 30 days)
Show older comments
Hello, thanks for reading this,
I have a problem with getting DICOM images to be viewed in order. By this I mean view the image from the top, and have each consecutive slice be the next one down in the transverse plane.
I can view a directory using dicomread and a for loop, but when I do, the images do not appear in order in the transverse plane, they jump between multiple slices in a random order. I don't think this is MATLAB's fault; instead, I think the files were saved out of order when our machine saved the images to file.
I can import any of the sequenced files into ITK SNAP, and have the images appear in order of the sequence ID, but I haven't done much work outside of this. Is it possible for MATLAB to do something similar, which will allow me to view the DICOM images in order?
Thanks for your advice
Accepted Answer
Sean de Wolski
on 26 Jul 2013
There are a lot of good dicom reader and viewer apps on the File Exchange:
9 Comments
Brian
on 26 Jul 2013
Thanks for this, but the problem isn't viewing DICOM images, but rather viewing them in order.
I made myself a function that can read every file I have, and I can zip through them in a GUI I made using GUIDE, but the file 0001.dco, for example, is not continuous with file 0002.dcm, the next one in series can be 137.dcm. I know where the sequence id is in the header information, but I don't know how to make the images appear in sequence. Since ITK SNAP can, I assume the information can be read.
Matt Kindig
on 26 Jul 2013
Edited: Matt Kindig
on 26 Jul 2013
Have you tried dicominfo() on your images? There should be a field called SliceLocation or SliceNumber or something like this in the output from dicominfo. You can use dicominfo() to extract these numbers, and then rename the dicom files accordingly. I have had to do this multiple times.
doc dicominfo
Brian
on 26 Jul 2013
Thanks, I took a look at it but I had no idea how to process this information.
Instead, what I did was just go to ITK-SNAP and just save every axial slice as a image series, because that was outputted in order. From there, I just use map = imread and image(map) to view them.
Matt Kindig
on 27 Jul 2013
If your dicoms are more than 8-bit, though, the conversion to images will lead to a loss of information, no? I'm surprised that the dicominfo() didn't yield enough useful information.Can you post the full output of this function on one of your files?
Brian
on 8 Aug 2013
Hello, I apologize, I didn't know you answered this. I can post the information for an outputted DICOM file. Again, its not that I don't get useful information, its that I don't know where the sequence info is stored.
When I view the first image I have he following info outputted:
dicominfo('CT000000.DCM')
ans =
Filename: [1x83 char]
FileModDate: '04-Dec-2012 11:53:12'
FileSize: 541754
Format: 'DICOM'
FormatVersion: 3
Width: 512
Height: 512
BitDepth: 12
ColorType: 'grayscale'
FileMetaInformationGroupLength: 190
FileMetaInformationVersion: [2x1 uint8]
MediaStorageSOPClassUID: [1x25 char]
MediaStorageSOPInstanceUID: [1x42 char]
TransferSyntaxUID: '1.2.840.10008.1.2.1'
ImplementationClassUID: [1x26 char]
ImplementationVersionName: 'DCF 3.2.2c'
SourceApplicationEntityTitle: 'DCF'
SpecificCharacterSet: 'ISO_IR 100'
ImageType: [1x28 char]
InstanceCreationDate: '20121201'
InstanceCreationTime: '165019'
SOPClassUID: [1x25 char]
SOPInstanceUID: [1x42 char]
StudyDate: '20121201'
AcquisitionDate: '20121201'
ContentDate: '20121201'
AcquisitionDateTime: '20121201164902.060'
StudyTime: '164347'
AcquisitionTime: '164902'
ContentTime: '164903.077'
AccessionNumber: ''
Modality: 'CT'
Manufacturer: 'Philips'
InstitutionName: 'CIRCLE IMAGING'
InstitutionAddress: 'CHICAGO,IL.'
ReferringPhysicianName: [1x1 struct]
StationName: 'PHILIPS-495BABE'
StudyDescription: ''
SeriesDescription: 'CHEST 320'
InstitutionalDepartmentName: 'Radiology'
OperatorName: [1x1 struct]
ManufacturerModelName: 'Brilliance 64'
ReferencedImageSequence: [1x1 struct]
PatientName: [1x1 struct]
PatientID: '0320'
PatientBirthDate: ''
PatientSex: 'O'
PatientAge: ''
MedicalAlerts: ''
ScanOptions: 'HELIX'
SliceThickness: 1
KVP: 120
SpacingBetweenSlices: 1
DataCollectionDiameter: 500
SoftwareVersion: '2.6.1'
ProtocolName: 'PRE CHEST 3X3/Thorax'
ReconstructionDiameter: 342
GantryDetectorTilt: 0
TableHeight: 63
RotationDirection: 'CW'
ExposureTime: 813
XrayTubeCurrent: 177
Exposure: 144
FilterType: 'B'
ConvolutionKernel: 'B'
PatientPosition: 'FFS'
CTExposureSequence: [1x1 struct]
ExposureModulationType: 'ZDOM'
EstimatedDoseSaving: 40
CTDIvol: 9.3000
StudyInstanceUID: [1x39 char]
SeriesInstanceUID: [1x38 char]
StudyID: '56108'
SeriesNumber: 2
AcquisitionNumber: []
InstanceNumber: 18
ImagePositionPatient: [3x1 double]
ImageOrientationPatient: [6x1 double]
FrameOfReferenceUID: [1x38 char]
Laterality: ''
PositionReferenceIndicator: ''
SliceLocation: 43.6000
ImageComments: 'CHEST 320'
SamplesPerPixel: 1
PhotometricInterpretation: 'MONOCHROME2'
Rows: 512
Columns: 512
PixelSpacing: [2x1 double]
BitsAllocated: 16
BitsStored: 12
HighBit: 11
PixelRepresentation: 0
WindowCenter: [2x1 double]
WindowWidth: [2x1 double]
RescaleIntercept: -1024
RescaleSlope: 1
RequestedContrastAgent: ''
PreMedication: ''
PerformedProcedureStepID: '5610888'
Private_00e1_10xx_Creator: 'ELSCINT1'
Private_00e1_1001: 1
Private_00e1_1022: [2x1 double]
Private_00e1_1023: [2x1 double]
Private_00e1_1040: 'CHEST 320'
Private_00e1_1042: '453567-023322'
Private_00e1_1050: 10.3210
Private_00e1_1061: [1x26 char]
Private_00e1_1063: 'ENGLISH'
Private_01e1_10xx_Creator: 'ELSCINT1'
Private_01e1_1041: [64x1 uint16]
Private_01f1_10xx_Creator: 'ELSCINT1'
Private_01f1_1001: 'SPIRAL'
Private_01f1_1002: 'STANDARD'
Private_01f1_1003: 'E'
Private_01f1_1004: 'NORMAL'
Private_01f1_1005: 180
Private_01f1_1007: 49.2000
Private_01f1_1008: 437
Private_01f1_100a: 0
Private_01f1_100c: [2x1 double]
Private_01f1_100d: 0
Private_01f1_100e: 0
Private_01f1_1026: 0.9230
Private_01f1_1027: 0.7500
Private_01f1_1032: 'RIGHT_ON_LEFT'
Private_01f1_1042: 'No'
Private_01f1_1044: [322x1 uint16]
Private_01f1_1046: 0.6250
Private_01f1_1047: '3D'
Private_01f1_1049: 240
Private_01f1_104a: 'DOM'
Private_01f1_104b: '64x0.625'
Private_01f1_104c: 'NO'
Private_01f1_104d: 'YES'
Private_01f1_104e: 'Chest'
Private_01f7_10xx_Creator: 'ELSCINT1'
Private_01f7_1010: [2x1 uint8]
Private_01f7_1011: [276x1 uint16]
Private_01f7_1013: [68x1 uint16]
Private_01f7_1014: [54x1 uint16]
Private_01f7_1015: [94x1 uint16]
Private_01f7_1016: [20x1 uint16]
Private_01f7_1017: [4x1 uint16]
Private_01f7_1018: [114x1 uint16]
Private_01f7_1019: [1080x1 uint16]
Private_01f7_101a: [14x1 uint16]
Private_01f7_101b: [872x1 uint16]
Private_01f7_101c: [58x1 uint16]
Private_01f7_101e: [182x1 uint16]
Private_01f7_101f: [74x1 uint16]
Private_01f7_1022: [1x60 char]
Private_01f7_1023: [2x1 uint16]
Private_01f7_1025: [6x1 uint16]
Private_01f7_1027: [18x1 uint16]
Private_01f7_1029: [220x1 uint16]
Private_01f7_102b: [18x1 uint16]
Private_01f7_102c: [328x1 uint16]
Private_01f7_102d: [4x1 uint16]
Private_01f7_1030: [8x1 uint16]
Private_01f7_1031: [62x1 uint16]
Private_01f7_1070: [656x1 uint16]
Private_01f7_1074: [144x1 uint16]
Private_01f7_1075: [260x1 uint16]
Private_01f7_107f: [656x1 uint16]
Private_07a1_10xx_Creator: 'ELSCINT1'
Private_07a1_1010: '3.5'
Private_7fdf_10xx_Creator: 'ELSCINT1'
Matt Kindig
on 8 Aug 2013
It's the InstanceNumber field. The SeriesNumber field might also be useful--it is a unique number that is set for each of the various scanner reconstructions (scout view, bone windowing, soft tissue windowing, etc.). A sample renaming script could be as follows:
DicomDir = '/path/to/your/dicoms';
MyFiles = dir(fullfile(DicomDir, '*.dcm'));
for k=1:length(MyFiles),
oldFile = fullfile(DicomDir, MyFiles(k).name);
Info= dicominfo( oldFile);
newFile = sprintf('CT%d_%d.dcm', Info.SeriesNumber, Info.InstanceNumber);
copyfile( oldFile, fullfile(DicomDir, newFile));
end
And then delete all of the old CT*.dcm files.
Brian
on 14 Aug 2013
Thank you SO MUCH, I toyed around with this and finally got it to work. This works a lot better than saving images, not only because I don't have to do another conversion, but also because the coordinate field in the png pictures was very different. This eliminated my need for a geometry transformation.
Thanks!
More Answers (0)
See Also
Categories
Find more on DICOM Format in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)