annotate Resources/Samples/OrthancClient/Vtk/main.cpp @ 835:a15ad019bbec

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 02 Jun 2014 12:21:50 +0200
parents 2d0a347e8cfc
children 6e7e5ed91c2d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
531
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
689
2d0a347e8cfc switch to 2014
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 656
diff changeset
3 * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
531
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Belgium
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * Permission is hereby granted, free of charge, to any person
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * obtaining a copy of this software and associated documentation
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * files (the "Software"), to deal in the Software without
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * restriction, including without limitation the rights to use, copy,
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * modify, merge, publish, distribute, sublicense, and/or sell copies
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * of the Software, and to permit persons to whom the Software is
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * furnished to do so, subject to the following conditions:
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 *
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * The above copyright notice and this permission notice shall be
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * included in all copies or substantial portions of the Software.
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * SOFTWARE.
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 **/
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #include <iostream>
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 #include <vtkRenderWindow.h>
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 #include <vtkImageData.h>
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 #include <vtkPiecewiseFunction.h>
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #include <vtkFixedPointVolumeRayCastMapper.h>
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #include <vtkColorTransferFunction.h>
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #include <vtkVolumeProperty.h>
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 #include <vtkRenderWindowInteractor.h>
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #include <vtkRenderer.h>
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 #include <vtkSmartPointer.h>
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 #include <vtkOpenGLRenderer.h>
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 #include <vtkInteractorStyleTrackballCamera.h>
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
588
a0001c222b32 refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 531
diff changeset
42 #include <orthanc/OrthancCppClient.h>
531
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 void Display(OrthancClient::Series& series)
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 {
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 /**
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 * Load the 3D image from Orthanc into VTK.
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 **/
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 vtkSmartPointer<vtkImageData> image = vtkSmartPointer<vtkImageData>::New();
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 image->SetDimensions(series.GetWidth(), series.GetHeight(), series.GetInstanceCount());
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 image->SetScalarType(VTK_SHORT);
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 image->AllocateScalars();
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 if (series.GetWidth() != 0 &&
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 series.GetHeight() != 0 &&
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 series.GetInstanceCount() != 0)
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 {
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 series.Load3DImage(image->GetScalarPointer(0, 0, 0), Orthanc::PixelFormat_SignedGrayscale16,
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 2 * series.GetWidth(), 2 * series.GetHeight() * series.GetWidth());
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 }
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 image->SetSpacing(series.GetVoxelSizeX(),
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 series.GetVoxelSizeY(),
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 series.GetVoxelSizeZ());
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 /**
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 * The following code is based on the VTK sample for MIP
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 * http://www.vtk.org/Wiki/VTK/Examples/Cxx/VolumeRendering/MinIntensityRendering
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 **/
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 // Create a transfer function mapping scalar value to opacity
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 double range[2];
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 image->GetScalarRange(range);
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 vtkSmartPointer<vtkPiecewiseFunction> opacityTransfer =
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 vtkSmartPointer<vtkPiecewiseFunction>::New();
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 opacityTransfer->AddSegment(range[0], 0.0, range[1], 1.0);
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 vtkSmartPointer<vtkColorTransferFunction> colorTransfer =
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 vtkSmartPointer<vtkColorTransferFunction>::New();
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 colorTransfer->AddRGBPoint(0, 1.0, 1.0, 1.0);
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 colorTransfer->AddRGBPoint(range[1], 1.0, 1.0, 1.0);
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 vtkSmartPointer<vtkVolumeProperty> property =
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 vtkSmartPointer<vtkVolumeProperty>::New();
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 property->SetScalarOpacity(opacityTransfer);
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 property->SetColor(colorTransfer);
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 property->SetInterpolationTypeToLinear();
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 // Create a Maximum Intensity Projection rendering
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 vtkSmartPointer<vtkFixedPointVolumeRayCastMapper> mapper =
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 vtkSmartPointer<vtkFixedPointVolumeRayCastMapper>::New();
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 mapper->SetBlendModeToMaximumIntensity();
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 mapper->SetInput(image);
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 vtkSmartPointer<vtkVolume> volume = vtkSmartPointer<vtkVolume>::New();
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 volume->SetMapper(mapper);
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 volume->SetProperty(property);
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkOpenGLRenderer>::New();
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 renderer->AddViewProp(volume);
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 renderer->SetBackground(0.1, 0.2, 0.3); // Background color dark blue
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 vtkSmartPointer<vtkInteractorStyleTrackballCamera> style =
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 vtkSmartPointer<vtkRenderWindow> window = vtkSmartPointer<vtkRenderWindow>::New();
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 window->AddRenderer(renderer);
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 vtkSmartPointer<vtkRenderWindowInteractor> interactor = vtkSmartPointer<vtkRenderWindowInteractor>::New();
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 interactor->SetRenderWindow(window);
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 interactor->SetInteractorStyle(style);
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 interactor->Start();
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 }
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 int main()
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 {
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 try
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 {
588
a0001c222b32 refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 531
diff changeset
124 // The following explicit initialization is not required, except
a0001c222b32 refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 531
diff changeset
125 // if you wish to specify the full path to the shared library
a0001c222b32 refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 531
diff changeset
126 OrthancClient::Initialize();
531
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 // Use the commented code below if you know the identifier of a
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 // series that corresponds to a 3D image.
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 /*
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 {
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 OrthancClient::OrthancConnection orthanc("http://localhost:8042");
588
a0001c222b32 refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 531
diff changeset
134 OrthancClient::Series series(orthanc, "dc5ec3d9-6e1a7b2c-73a829f0-64c609f6-ef976a97");
531
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 Display(series);
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 return 0;
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 }
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 */
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 // Try and find a 3D image inside the local store
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 OrthancClient::OrthancConnection orthanc("http://localhost:8042");
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 for (unsigned int i = 0; i < orthanc.GetPatientCount(); i++)
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 {
591
a00f626290db better api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 590
diff changeset
146 OrthancClient::Patient patient(orthanc.GetPatient(i));
531
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 std::cout << "Patient: " << patient.GetId() << std::endl;
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 for (unsigned int j = 0; j < patient.GetStudyCount(); j++)
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 {
591
a00f626290db better api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 590
diff changeset
151 OrthancClient::Study study(patient.GetStudy(j));
531
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 std::cout << " Study: " << study.GetId() << std::endl;
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 for (unsigned int k = 0; k < study.GetSeriesCount(); k++)
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 {
591
a00f626290db better api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 590
diff changeset
156 OrthancClient::Series series(study.GetSeries(k));
531
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 std::cout << " Series: " << series.GetId() << std::endl;
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 if (series.Is3DImage())
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 {
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 Display(series);
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 return 0;
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 }
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 else
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 {
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 std::cout << " => Not a 3D image..." << std::endl;
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 }
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 }
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 }
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 }
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 std::cout << "Unable to find a 3D image in the local Orthanc store" << std::endl;
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 return 0;
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 }
656
08eca5d86aad fixes to cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 591
diff changeset
176 catch (OrthancClient::OrthancClientException& e)
531
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 {
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 std::cerr << "EXCEPTION: [" << e.What() << "]" << std::endl;
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 return -1;
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 }
7f9467b5f33b samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 }