Mercurial > hg > orthanc-client
comparison Samples/Basic/main.cpp @ 2:8f22ed9d48d5
cont
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 01 Jun 2015 13:59:12 +0200 |
parents | |
children | 6d59828e2662 |
comparison
equal
deleted
inserted
replaced
1:fd402e53d263 | 2:8f22ed9d48d5 |
---|---|
1 /** | |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * | |
6 * This program is free software: you can redistribute it and/or | |
7 * modify it under the terms of the GNU General Public License as | |
8 * published by the Free Software Foundation, either version 3 of the | |
9 * License, or (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, but | |
12 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 * General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 **/ | |
19 | |
20 | |
21 #include <iostream> | |
22 #include <orthanc/OrthancCppClient.h> | |
23 | |
24 int main() | |
25 { | |
26 try | |
27 { | |
28 // The following explicit initialization is not required, except | |
29 // if you wish to specify the full path to the shared library | |
30 OrthancClient::Initialize(); | |
31 | |
32 // Display the content of the local Orthanc instance | |
33 OrthancClient::OrthancConnection orthanc("http://localhost:8042"); | |
34 | |
35 for (unsigned int i = 0; i < orthanc.GetPatientCount(); i++) | |
36 { | |
37 OrthancClient::Patient patient(orthanc.GetPatient(i)); | |
38 std::cout << "Patient: " << patient.GetId() << std::endl; | |
39 | |
40 for (unsigned int j = 0; j < patient.GetStudyCount(); j++) | |
41 { | |
42 OrthancClient::Study study(patient.GetStudy(j)); | |
43 std::cout << " Study: " << study.GetId() << std::endl; | |
44 | |
45 for (unsigned int k = 0; k < study.GetSeriesCount(); k++) | |
46 { | |
47 OrthancClient::Series series(study.GetSeries(k)); | |
48 std::cout << " Series: " << series.GetId() << std::endl; | |
49 | |
50 if (series.Is3DImage()) | |
51 { | |
52 std::cout << " This is a 3D image whose voxel size is " | |
53 << series.GetVoxelSizeX() << " x " | |
54 << series.GetVoxelSizeY() << " x " | |
55 << series.GetVoxelSizeZ() << ", and slice thickness is " | |
56 << series.GetSliceThickness() << std::endl; | |
57 } | |
58 | |
59 for (unsigned int l = 0; l < series.GetInstanceCount(); l++) | |
60 { | |
61 std::cout << " Instance: " << series.GetInstance(l).GetId() << std::endl; | |
62 | |
63 // Load and display some raw DICOM tag | |
64 series.GetInstance(l).LoadTagContent("0020-000d"); | |
65 std::cout << " SOP instance UID: " << series.GetInstance(l).GetLoadedTagContent() << std::endl; | |
66 } | |
67 } | |
68 } | |
69 } | |
70 | |
71 OrthancClient::Finalize(); | |
72 | |
73 return 0; | |
74 } | |
75 catch (OrthancClient::OrthancClientException& e) | |
76 { | |
77 std::cerr << "EXCEPTION: [" << e.What() << "]" << std::endl; | |
78 return -1; | |
79 } | |
80 } |