Mercurial > hg > orthanc-book
comparison Sphinx/source/faq/matlab.rst @ 103:af1e13dac7e6
raw dicom in matlab
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 13 Jun 2017 20:35:14 +0200 |
parents | 5ffea09f47a3 |
children | 86e92d0cc53e |
comparison
equal
deleted
inserted
replaced
102:5ffea09f47a3 | 103:af1e13dac7e6 |
---|---|
38 imagesc(slice) | 38 imagesc(slice) |
39 | 39 |
40 # Annotate the graph with the patient name and ID | 40 # Annotate the graph with the patient name and ID |
41 tags = loadjson(urlread([ URL '/instances/' instance '/tags?simplify' ])); | 41 tags = loadjson(urlread([ URL '/instances/' instance '/tags?simplify' ])); |
42 title([ 'This is a slice from patient ' tags.PatientID ' (' tags.PatientName ')' ]) | 42 title([ 'This is a slice from patient ' tags.PatientID ' (' tags.PatientName ')' ]) |
43 | |
44 | |
45 Opening the raw DICOM file | |
46 -------------------------- | |
47 | |
48 Here is another sample Matlab/Octave script explaining how to download | |
49 the raw DICOM file corresponding to one given instance stored in | |
50 Orthanc, then decode this DICOM file using Matlab/Octave:: | |
51 | |
52 SERIES = 'ae164c84-e5bd0366-ba937a6d-65414092-f294d6b6'; | |
53 URL = 'http://demo.orthanc-server.com/'; | |
54 | |
55 # Get information about the instances in this DICOM series | |
56 instances = loadjson(urlread([ URL '/series/' SERIES '/instances' ])); | |
57 | |
58 # Select one slice from the series | |
59 instance = instances{1}.ID | |
60 | |
61 # Download the raw DICOM file and store it as a file named "instance.dcm" | |
62 urlwrite([ URL '/instances/' instance '/file' ], 'instance.dcm'); | |
63 | |
64 if exist('OCTAVE_VERSION', 'builtin') ~= 0 | |
65 # If running Octave instead of Matlab, load the "dicom" package from Octave Forge | |
66 pkg load image | |
67 pkg load dicom | |
68 endif | |
69 | |
70 # Decode the downloaded DICOM file | |
71 im = dicomread('instance.dcm'); | |
72 imagesc(im) | |
73 | |
74 .. highlight:: bash | |
75 | |
76 **Note:** If running Octave, you will have to manually install the | |
77 `dicom package from Octave Forge | |
78 <https://octave.sourceforge.io/dicom/index.html>`__. Download the | |
79 source code of the package, make sure the ``libgdcm2-dev`` and | |
80 ``octave-image`` packages are installed (for Ubuntu 16.04), then type | |
81 the following command to install the ``dicom`` package:: | |
82 | |
83 $ octave --no-gui --eval "pkg install ./dicom-0.2.0.tar.gz" |