View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Medical Image Reader and Viewer

5.0
5.0 | 3 ratings Rate this file 106 Downloads (last 30 days) File Size: 918 KB File ID: #53745 Version: 3.82
image thumbnail

Medical Image Reader and Viewer

by

 

30 Oct 2015 (Updated )

A toolbox to handle reading, viewing, and writing dicom images, supporting simultaneous PET/MR

| Watch this File

File Information
Description

This toolbox can read and write medical imaging data in dicom format with the 'readImages' function. The output of this function is a structure containing attributes of the image or volume. This structure can then be used as input into other functions in the toolbox.
This toolbox supports:
 - reading and writing of dicom data
 - mapping of volume voxel locations
 - oblique slice alignment and registration
 - manual 3D image rotation
 - selecting and extracting single voxel coordinates
 - drawing 2D or 3D region-of-interest masks
 - coregistered image viewing supports PET/CT and PET/MR

Syntax:
CT = readImages([CT_ImageDirectoryPath]);
PET = readImages([PET_ImageDirectoryPath]);
VolumeViewer3D(CT,PET)
VolumeViewer3D(CT,PET,'align','trim')
coords = VolumeViewer3D(PET,CT,'getCoords');
mask = VolumeViewer3D(PET,CT,'drawROI');

Acknowledgements

Freeze Colors / Unfreeze Colors and Dicom To N If Ti Converter, N If Ti Tool And Viewer inspired this file.

Required Products Image Processing Toolbox
Statistics and Machine Learning Toolbox
MATLAB
MATLAB release MATLAB 8.5 (R2015a)
MATLAB Search Path
/
/html
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (17)
08 Mar 2017 Josh

Josh (view profile)

The function was looking for a dicom field that did not exist in those TCIA images. I added a check to avoid this - try the new version. Thanks for pointing this out.

Comment only
07 Mar 2017 quix

quix (view profile)

Hi, nice toolbox!

I tried to read in an image from The Cancer Imaging Archive (TCIA) but was unable to. The message is 'File read error, try again with another file'. The message is repeated for any single slice I choose in the series.

The data can be retrieved here: https://public.cancerimagingarchive.net/ncia/externalLinks.jsf?collectionName=QIN-HEADNECK, Subject ID: QIN-HEADNECK-0003

Comment only
07 Mar 2017 Marc Golombeck

Josh, thank you for the hint. I just doubled each font size and now I have a nice display. I am using your viewer on my iMac 27" with 2560 x 1440 pixels. The original fonts display was really tiny and hard to read. Now it works fine.

Thank your for this helpful toolbox which I am using for my research work!

Comment only
03 Mar 2017 Josh

Josh (view profile)

Thanks for the feedback. The viewer was tested at high DPI and normal 1080 resolution. What size is your display?

The quick fix would be to do a ctrl-F search through VolumeViewer3D.m for 'FontSize' and change all the necessary field values. Let me know which value works best for the screen you are using.

Comment only
02 Mar 2017 Marc Golombeck

Is there any chance to increase the font size of the sliders, value outputs and handles in the 3D Viewer window? Unfortunately on my machine everything is pretty small on the screen. But besides that drawback the 3D Viewer is superb!

09 Jul 2016 Josh Schaefferkoetter

@Joaquin
I'll consider adding these to the next version. Thanks for the feedback!

Comment only
08 Jul 2016 Joaquin Lopez

Just in case it is useful for others,
With Matlab2014a I needed to add a try/catch in VolumeViewer3D.m (line 3372)
try
if s.matlab.desktop.HighDPISupport
hAxOffset = 0.0005;
vAxOffset = 0.0005;
end
catch
hAxOffset = 0.0007;
vAxOffset = 0.001;
end

Comment only
08 Jul 2016 Joaquin Lopez

Very useful tool. I had to adapt it to read GE images from the cancer imaging archive, because some tags in the dicom info are vendor-specific. I used the dictionary from https://www.mathworks.com/matlabcentral/fileexchange/42997-dicom-to-nifti-converter--nifti-tool-and-viewer
I changed in all cases:
dict = dicm_dict('GE');
meta = dicm_hdr([imageDir '\' imageFile], dict);
instead of:
meta = dicominfo([imageDir '\' imageFile]);

07 Jun 2016 Peter Lakner

05 Jun 2016 Peter Lakner

Where/how should I share the data?

Comment only
04 Jun 2016 Josh Schaefferkoetter

@Peter
Thanks for the feedback. I wrote the code to prompt for new image data if any errors were found, this is convenient but makes it tricky to troubleshoot - maybe I'll think of a different way to handle this... In the meantime, if you can share your dicom data, I'll take a look.

Comment only
03 Jun 2016 Peter Lakner

Please ignore that last comment, I pressed enter by mistake. The current version does not seem to work for me, using the readImages function, even if I provide the directories it opens a file finder, and whenever I select a file it tells me there is a "File read error, try again with another file."

Comment only
03 Jun 2016 Peter Lakner

Hello, getting a file read error

Comment only
06 Feb 2016 Josh Schaefferkoetter

@Gabriel
The output variable is now initialized as a structure so should fix the problem. Let me know if it still doesn't work.

Comment only
05 Feb 2016 Gabriel Reynes

Looks nice program, but I have a similar problem as payam. After loading GE images with MATLAB 2015b:
Field assignment to a non-structure array object.

Error in VolumeViewer3D>parseInputs (line 397)
out.modality = 'VOL';

Error in VolumeViewer3D (line 36)
inStruct = parseInputs(varargin);

Comment only
13 Jan 2016 Josh Schaefferkoetter

@payam
I loaded several PET studies from the TCIA site, including the phantom data, and found a small bug related to the GE and Philips series naming convention; I couldn't reproduce your error though. With which specific data sets were you having issues?

Comment only
12 Jan 2016 Payam Ahmadvand

Hi,
The toolbox seems good.
I have tried to read a PET volume from TCIA (www.cancerimagingarchive.net/) using readImages. I faced this error:

Field assignment to a non-structure array object.

Error in readImages (line 82)
out.nSeries = nSeries;

Also the same error for phantom images. I am using Matlab 2015b.

Comment only
Updates
23 Nov 2015 1.1

faster and more efficient memory handling

23 Nov 2015 1.2

improved handling of large image matrices

01 Dec 2015 1.3

bug fixes

21 Dec 2015 1.4

performance improvements

22 Dec 2015 1.5

faster and more accurate interpolation

23 Dec 2015 1.6

updated examples

26 Dec 2015 1.7

minor tweaks and enhancements

26 Dec 2015 1.8

small bug fix

27 Dec 2015 1.9

fixed smoothing functionality

05 Jan 2016 2.0

minor tweaks

13 Jan 2016 2.0.1

GE and Philips series naming convention bug fix

24 Jan 2016 2.1

modified coregistration

06 Feb 2016 2.11

output structure initialization

08 Apr 2016 3.0

Ability to draw and output 2D or 3D mask

15 Apr 2016 3.01

updated examples

18 Apr 2016 3.01

updated examples

24 Apr 2016 3.02

UI formatted for high DPI displays

28 Jun 2016 3.1

corrected dicom tag writing

28 Jun 2016 3.11

housekeeping

16 Jul 2016 3.2

improved input and error handling

17 Jul 2016 3.21

improved input handling

18 Jul 2016 3.3

ability to combine 2D and 3D, and volume and mask inputs

09 Sep 2016 3.4

incomplete filename bug fix

13 Sep 2016 3.5

minor improvements

16 Sep 2016 3.6

faster image coregistration

16 Sep 2016 3.7

updated examples

18 Sep 2016 3.7.1

performance tweaks

01 Oct 2016 3.8

fixed bug for reading dicom files with no extension

03 Oct 2016 3.81

small bug with writing dicom

08 Mar 2017 3.82

bug with reading dicom

Contact us