annotate Core/DicomNetworking/DicomUserConnection.cpp @ 2512:4dcafa8d6633

SystemToolbox::GenerateUuid moved to Toolbox::GenerateUuid
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 28 Mar 2018 15:20:50 +0200
parents 878b59270859
children 055d7d4a823f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1846
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1285
diff changeset
4 * Department, University Hospital of Liege, Belgium
2447
878b59270859 upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2382
diff changeset
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
136
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
11 *
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
12 * In addition, as a special exception, the copyright holders of this
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
13 * program give permission to link the code of its release with the
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
16 * the linked executables. You must obey the GNU General Public License
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
17 * in all respects for all of the code used other than "OpenSSL". If you
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
18 * modify file(s) with this exception, you may extend this exception to
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
19 * your version of the file(s), but you are not obligated to do so. If
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
20 * you do not wish to do so, delete this exception statement from your
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
21 * version. If you delete this exception statement from all source files
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
22 * in the program, then also delete it here.
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful, but
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * General Public License for more details.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 **/
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
766
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
34
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
35 /*=========================================================================
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
36
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
37 This file is based on portions of the following project:
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
38
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
39 Program: DCMTK 3.6.0
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
40 Module: http://dicom.offis.de/dcmtk.php.en
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
41
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
42 Copyright (C) 1994-2011, OFFIS e.V.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
43 All rights reserved.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
44
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
45 This software and supporting documentation were developed by
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
46
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
47 OFFIS e.V.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
48 R&D Division Health
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
49 Escherweg 2
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
50 26121 Oldenburg, Germany
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
51
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
52 Redistribution and use in source and binary forms, with or without
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
53 modification, are permitted provided that the following conditions
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
54 are met:
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
55
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
56 - Redistributions of source code must retain the above copyright
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
57 notice, this list of conditions and the following disclaimer.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
58
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
59 - Redistributions in binary form must reproduce the above copyright
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
60 notice, this list of conditions and the following disclaimer in the
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
61 documentation and/or other materials provided with the distribution.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
62
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
63 - Neither the name of OFFIS nor the names of its contributors may be
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
64 used to endorse or promote products derived from this software
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
65 without specific prior written permission.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
66
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
67 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
68 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
69 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
70 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
71 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
72 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
73 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
74 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
75 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
76 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
77 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
78
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
79 =========================================================================*/
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
80
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 763
diff changeset
81
2382
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
82 #include "../PrecompiledHeaders.h"
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 #include "DicomUserConnection.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
2382
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
85 #include "../DicomFormat/DicomArray.h"
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
86 #include "../Logging.h"
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
87 #include "../OrthancException.h"
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
88 #include "../DicomParsing/FromDcmtkBridge.h"
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
89 #include "../DicomParsing/ToDcmtkBridge.h"
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 #include <dcmtk/dcmdata/dcistrmb.h>
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 #include <dcmtk/dcmdata/dcistrmf.h>
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 #include <dcmtk/dcmdata/dcfilefo.h>
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
94 #include <dcmtk/dcmdata/dcmetinf.h>
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 #include <dcmtk/dcmnet/diutil.h>
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 #include <set>
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 #ifdef _WIN32
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 /**
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 * "The maximum length, in bytes, of the string returned in the buffer
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 * pointed to by the name parameter is dependent on the namespace provider,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 * but this string must be 256 bytes or less.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 * http://msdn.microsoft.com/en-us/library/windows/desktop/ms738527(v=vs.85).aspx
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 **/
2340
b5a04d983647 fix mingw build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2335
diff changeset
107 # define HOST_NAME_MAX 256
b5a04d983647 fix mingw build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2335
diff changeset
108 # include <winsock.h>
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 #endif
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111
918
ac8f68cbdbb6 build cont
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 725
diff changeset
112 #if !defined(HOST_NAME_MAX) && defined(_POSIX_HOST_NAME_MAX)
890
816dccaeb7cf Support of kFreeBSD
jodogne
parents: 831
diff changeset
113 /**
816dccaeb7cf Support of kFreeBSD
jodogne
parents: 831
diff changeset
114 * TO IMPROVE: "_POSIX_HOST_NAME_MAX is only the minimum value that
816dccaeb7cf Support of kFreeBSD
jodogne
parents: 831
diff changeset
115 * HOST_NAME_MAX can ever have [...] Therefore you cannot allocate an
816dccaeb7cf Support of kFreeBSD
jodogne
parents: 831
diff changeset
116 * array of size _POSIX_HOST_NAME_MAX, invoke gethostname() and expect
816dccaeb7cf Support of kFreeBSD
jodogne
parents: 831
diff changeset
117 * that the result will fit."
816dccaeb7cf Support of kFreeBSD
jodogne
parents: 831
diff changeset
118 * http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00128.html
816dccaeb7cf Support of kFreeBSD
jodogne
parents: 831
diff changeset
119 **/
816dccaeb7cf Support of kFreeBSD
jodogne
parents: 831
diff changeset
120 #define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
816dccaeb7cf Support of kFreeBSD
jodogne
parents: 831
diff changeset
121 #endif
816dccaeb7cf Support of kFreeBSD
jodogne
parents: 831
diff changeset
122
816dccaeb7cf Support of kFreeBSD
jodogne
parents: 831
diff changeset
123
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
124 static const char* DEFAULT_PREFERRED_TRANSFER_SYNTAX = UID_LittleEndianImplicitTransferSyntax;
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
125
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
126 /**
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
127 * "If we have more than 64 storage SOP classes, tools such as
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
128 * storescu will fail because they attempt to negotiate two
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
129 * presentation contexts for each SOP class, and there is a total
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
130 * limit of 128 contexts for one association."
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
131 **/
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
132 static const unsigned int MAXIMUM_STORAGE_SOP_CLASSES = 64;
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
133
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
134
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
135 namespace Orthanc
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 {
2069
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
137 // By default, the timeout for DICOM SCU (client) connections is set to 10 seconds
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
138 static uint32_t defaultTimeout_ = 10;
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
139
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 struct DicomUserConnection::PImpl
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 // Connection state
1186
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
143 uint32_t dimseTimeout_;
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
144 uint32_t acseTimeout_;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 T_ASC_Network* net_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 T_ASC_Parameters* params_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 T_ASC_Association* assoc_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 bool IsOpen() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 return assoc_ != NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 void CheckIsOpen() const;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155
1907
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
156 void Store(DcmInputStream& is,
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
157 DicomUserConnection& connection,
2222
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2202
diff changeset
158 const std::string& moveOriginatorAET,
1997
f9f2aa1cc594 "MoveOriginatorID" can be specified for /modalities/.../store
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
159 uint16_t moveOriginatorID);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 };
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 static void Check(const OFCondition& cond)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 {
1017
9d0c7301596e storescp modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 942
diff changeset
167 LOG(ERROR) << "DicomUserConnection: " << std::string(cond.text());
9d0c7301596e storescp modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 942
diff changeset
168 throw OrthancException(ErrorCode_NetworkProtocol);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 void DicomUserConnection::PImpl::CheckIsOpen() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 if (!IsOpen())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 {
1017
9d0c7301596e storescp modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 942
diff changeset
176 LOG(ERROR) << "DicomUserConnection: First open the connection";
9d0c7301596e storescp modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 942
diff changeset
177 throw OrthancException(ErrorCode_NetworkProtocol);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 void DicomUserConnection::CheckIsOpen() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 pimpl_->CheckIsOpen();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
188 static void RegisterStorageSOPClass(T_ASC_Parameters* params,
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
189 unsigned int& presentationContextId,
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
190 const std::string& sopClass,
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
191 const char* asPreferred[],
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
192 std::vector<const char*>& asFallback)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 {
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
194 Check(ASC_addPresentationContext(params, presentationContextId,
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
195 sopClass.c_str(), asPreferred, 1));
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
196 presentationContextId += 2;
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
197
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
198 if (asFallback.size() > 0)
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
199 {
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
200 Check(ASC_addPresentationContext(params, presentationContextId,
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
201 sopClass.c_str(), &asFallback[0], asFallback.size()));
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
202 presentationContextId += 2;
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
203 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 }
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
205
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
206
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
207 void DicomUserConnection::SetupPresentationContexts(const std::string& preferredTransferSyntax)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 {
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
209 // Flatten an array with the preferred transfer syntax
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
210 const char* asPreferred[1] = { preferredTransferSyntax.c_str() };
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
211
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
212 // Setup the fallback transfer syntaxes
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
213 std::set<std::string> fallbackSyntaxes;
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
214 fallbackSyntaxes.insert(UID_LittleEndianExplicitTransferSyntax);
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
215 fallbackSyntaxes.insert(UID_BigEndianExplicitTransferSyntax);
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
216 fallbackSyntaxes.insert(UID_LittleEndianImplicitTransferSyntax);
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
217 fallbackSyntaxes.erase(preferredTransferSyntax);
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
218
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
219 // Flatten an array with the fallback transfer syntaxes
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
220 std::vector<const char*> asFallback;
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
221 asFallback.reserve(fallbackSyntaxes.size());
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
222 for (std::set<std::string>::const_iterator
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
223 it = fallbackSyntaxes.begin(); it != fallbackSyntaxes.end(); ++it)
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
224 {
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
225 asFallback.push_back(it->c_str());
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
226 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
228 CheckStorageSOPClassesInvariant();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 unsigned int presentationContextId = 1;
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
230
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
231 for (std::list<std::string>::const_iterator it = reservedStorageSOPClasses_.begin();
942
b3f6fb1130cd fixes thanks to cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 930
diff changeset
232 it != reservedStorageSOPClasses_.end(); ++it)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 {
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
234 RegisterStorageSOPClass(pimpl_->params_, presentationContextId,
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
235 *it, asPreferred, asFallback);
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
236 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
238 for (std::set<std::string>::const_iterator it = storageSOPClasses_.begin();
942
b3f6fb1130cd fixes thanks to cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 930
diff changeset
239 it != storageSOPClasses_.end(); ++it)
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
240 {
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
241 RegisterStorageSOPClass(pimpl_->params_, presentationContextId,
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
242 *it, asPreferred, asFallback);
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
243 }
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
244
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
245 for (std::set<std::string>::const_iterator it = defaultStorageSOPClasses_.begin();
942
b3f6fb1130cd fixes thanks to cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 930
diff changeset
246 it != defaultStorageSOPClasses_.end(); ++it)
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
247 {
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
248 RegisterStorageSOPClass(pimpl_->params_, presentationContextId,
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
249 *it, asPreferred, asFallback);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
254 static bool IsGenericTransferSyntax(const std::string& syntax)
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
255 {
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
256 return (syntax == UID_LittleEndianExplicitTransferSyntax ||
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
257 syntax == UID_BigEndianExplicitTransferSyntax ||
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
258 syntax == UID_LittleEndianImplicitTransferSyntax);
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
259 }
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
260
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
261
1907
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
262 void DicomUserConnection::PImpl::Store(DcmInputStream& is,
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
263 DicomUserConnection& connection,
2222
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2202
diff changeset
264 const std::string& moveOriginatorAET,
1997
f9f2aa1cc594 "MoveOriginatorID" can be specified for /modalities/.../store
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
265 uint16_t moveOriginatorID)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 CheckIsOpen();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 DcmFileFormat dcmff;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 Check(dcmff.read(is, EXS_Unknown, EGL_noChange, DCM_MaxReadLength));
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
272 // Determine the storage SOP class UID for this instance
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
273 static const DcmTagKey DCM_SOP_CLASS_UID(0x0008, 0x0016);
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
274 OFString sopClassUid;
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
275 if (dcmff.getDataset()->findAndGetOFString(DCM_SOP_CLASS_UID, sopClassUid).good())
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
276 {
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
277 connection.AddStorageSOPClass(sopClassUid.c_str());
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
278 }
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
279
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
280 // Determine whether a new presentation context must be
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
281 // negotiated, depending on the transfer syntax of this instance
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
282 DcmXfer xfer(dcmff.getDataset()->getOriginalXfer());
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
283 const std::string syntax(xfer.getXferID());
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
284 bool isGeneric = IsGenericTransferSyntax(syntax);
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
285
2161
7219cdce7bba spelling: negociate -> negotiate
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
286 bool renegotiate;
1684
7dae55228b16 Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
287 if (isGeneric)
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
288 {
1684
7dae55228b16 Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
289 // Are we making a generic-to-specific or specific-to-generic change of
7dae55228b16 Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
290 // the transfer syntax? If this is the case, renegotiate the connection.
2161
7219cdce7bba spelling: negociate -> negotiate
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
291 renegotiate = !IsGenericTransferSyntax(connection.GetPreferredTransferSyntax());
1684
7dae55228b16 Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
292 }
7dae55228b16 Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
293 else
7dae55228b16 Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
294 {
2161
7219cdce7bba spelling: negociate -> negotiate
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
295 // We are using a specific transfer syntax. Renegotiate if the
1684
7dae55228b16 Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
296 // current connection does not match this transfer syntax.
2161
7219cdce7bba spelling: negociate -> negotiate
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
297 renegotiate = (syntax != connection.GetPreferredTransferSyntax());
1684
7dae55228b16 Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
298 }
7dae55228b16 Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
299
2161
7219cdce7bba spelling: negociate -> negotiate
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
300 if (renegotiate)
1684
7dae55228b16 Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1582
diff changeset
301 {
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
302 LOG(INFO) << "Change in the transfer syntax: the C-Store associated must be renegotiated";
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
303
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
304 if (isGeneric)
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
305 {
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
306 connection.ResetPreferredTransferSyntax();
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
307 }
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
308 else
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
309 {
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
310 connection.SetPreferredTransferSyntax(syntax);
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
311 }
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
312 }
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
313
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
314 if (!connection.IsOpen())
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
315 {
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
316 LOG(INFO) << "Renegotiating a C-Store association due to a change in the parameters";
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
317 connection.Open();
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
318 }
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
319
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320 // Figure out which SOP class and SOP instance is encapsulated in the file
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321 DIC_UI sopClass;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322 DIC_UI sopInstance;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323 if (!DU_findSOPClassAndInstanceInDataSet(dcmff.getDataset(), sopClass, sopInstance))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324 {
1582
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
325 throw OrthancException(ErrorCode_NoSopClassOrInstance);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 // Figure out which of the accepted presentation contexts should be used
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 int presID = ASC_findAcceptedPresentationContextID(assoc_, sopClass);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 if (presID == 0)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332 const char *modalityName = dcmSOPClassUIDToModality(sopClass);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333 if (!modalityName) modalityName = dcmFindNameOfUID(sopClass);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334 if (!modalityName) modalityName = "unknown SOP class";
1582
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
335 throw OrthancException(ErrorCode_NoPresentationContext);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 // Prepare the transmission of data
1907
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
339 T_DIMSE_C_StoreRQ request;
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
340 memset(&request, 0, sizeof(request));
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
341 request.MessageID = assoc_->nextMsgID++;
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
342 strncpy(request.AffectedSOPClassUID, sopClass, DIC_UI_LEN);
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
343 request.Priority = DIMSE_PRIORITY_MEDIUM;
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
344 request.DataSetType = DIMSE_DATASET_PRESENT;
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
345 strncpy(request.AffectedSOPInstanceUID, sopInstance, DIC_UI_LEN);
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
346
2222
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2202
diff changeset
347 if (!moveOriginatorAET.empty())
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2202
diff changeset
348 {
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2202
diff changeset
349 strncpy(request.MoveOriginatorApplicationEntityTitle,
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2202
diff changeset
350 moveOriginatorAET.c_str(), DIC_AE_LEN);
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2202
diff changeset
351 request.opts = O_STORE_MOVEORIGINATORAETITLE;
1907
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
352
1997
f9f2aa1cc594 "MoveOriginatorID" can be specified for /modalities/.../store
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
353 request.MoveOriginatorID = moveOriginatorID; // The type DIC_US is an alias for uint16_t
1907
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
354 request.opts |= O_STORE_MOVEORIGINATORID;
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
355 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357 // Finally conduct transmission of data
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 T_DIMSE_C_StoreRSP rsp;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359 DcmDataset* statusDetail = NULL;
1907
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
360 Check(DIMSE_storeUser(assoc_, presID, &request,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361 NULL, dcmff.getDataset(), /*progressCallback*/ NULL, NULL,
1186
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
362 /*opt_blockMode*/ DIMSE_BLOCKING, /*opt_dimse_timeout*/ dimseTimeout_,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 &rsp, &statusDetail, NULL));
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365 if (statusDetail != NULL)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367 delete statusDetail;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
370
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371
1366
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
372 namespace
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
373 {
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
374 struct FindPayload
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
375 {
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
376 DicomFindAnswers* answers;
1805
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
377 const char* level;
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
378 bool isWorklist;
1366
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
379 };
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
380 }
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
381
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
382
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383 static void FindCallback(
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384 /* in */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385 void *callbackData,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386 T_DIMSE_C_FindRQ *request, /* original find request */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387 int responseCount,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 T_DIMSE_C_FindRSP *response, /* pending response received */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 DcmDataset *responseIdentifiers /* pending response identifiers */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390 )
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 {
1366
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
392 FindPayload& payload = *reinterpret_cast<FindPayload*>(callbackData);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 if (responseIdentifiers != NULL)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 {
1805
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
396 if (payload.isWorklist)
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
397 {
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
398 ParsedDicomFile answer(*responseIdentifiers);
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
399 payload.answers->Add(answer);
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
400 }
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
401 else
1366
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
402 {
1805
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
403 DicomMap m;
2381
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2352
diff changeset
404 FromDcmtkBridge::ExtractDicomSummary(m, *responseIdentifiers);
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2352
diff changeset
405
1805
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
406 if (!m.HasTag(DICOM_TAG_QUERY_RETRIEVE_LEVEL))
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
407 {
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
408 m.SetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL, payload.level, false);
1805
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
409 }
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
410
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
411 payload.answers->Add(m);
1366
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
412 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
413 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
414 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
415
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
416
1707
9a04ad916831 more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1684
diff changeset
417 static void FixFindQuery(DicomMap& fixedQuery,
9a04ad916831 more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1684
diff changeset
418 ResourceType level,
9a04ad916831 more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1684
diff changeset
419 const DicomMap& fields)
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
420 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
421 std::set<DicomTag> allowedTags;
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
422
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
423 // WARNING: Do not add "break" or reorder items in this switch-case!
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
424 switch (level)
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
425 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
426 case ResourceType_Instance:
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
427 DicomTag::AddTagsForModule(allowedTags, DicomModule_Instance);
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
428
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
429 case ResourceType_Series:
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
430 DicomTag::AddTagsForModule(allowedTags, DicomModule_Series);
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
431
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
432 case ResourceType_Study:
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
433 DicomTag::AddTagsForModule(allowedTags, DicomModule_Study);
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
434
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
435 case ResourceType_Patient:
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
436 DicomTag::AddTagsForModule(allowedTags, DicomModule_Patient);
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
437 break;
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
438
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
439 default:
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
440 throw OrthancException(ErrorCode_InternalError);
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
441 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
442
2005
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
443 switch (level)
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
444 {
2005
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
445 case ResourceType_Patient:
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
446 allowedTags.insert(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_STUDIES);
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
447 allowedTags.insert(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES);
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
448 allowedTags.insert(DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES);
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
449 break;
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
450
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
451 case ResourceType_Study:
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
452 allowedTags.insert(DICOM_TAG_MODALITIES_IN_STUDY);
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
453 allowedTags.insert(DICOM_TAG_NUMBER_OF_STUDY_RELATED_SERIES);
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
454 allowedTags.insert(DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES);
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
455 allowedTags.insert(DICOM_TAG_SOP_CLASSES_IN_STUDY);
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
456 break;
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
457
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
458 case ResourceType_Series:
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
459 allowedTags.insert(DICOM_TAG_NUMBER_OF_SERIES_RELATED_INSTANCES);
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
460 break;
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
461
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
462 default:
9e021b2b348b Support of optional tags for counting resources in C-Find SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
463 break;
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
464 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
465
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
466 allowedTags.insert(DICOM_TAG_SPECIFIC_CHARACTER_SET);
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
467
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
468 DicomArray query(fields);
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
469 for (size_t i = 0; i < query.GetSize(); i++)
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
470 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
471 const DicomTag& tag = query.GetElement(i).GetTag();
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
472 if (allowedTags.find(tag) == allowedTags.end())
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
473 {
1707
9a04ad916831 more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1684
diff changeset
474 LOG(WARNING) << "Tag not allowed for this C-Find level, will be ignored: " << tag;
9a04ad916831 more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1684
diff changeset
475 }
9a04ad916831 more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1684
diff changeset
476 else
9a04ad916831 more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1684
diff changeset
477 {
9a04ad916831 more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1684
diff changeset
478 fixedQuery.SetValue(tag, query.GetElement(i).GetValue());
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
479 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
480 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
481 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
482
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
483
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
484 static ParsedDicomFile* ConvertQueryFields(const DicomMap& fields,
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
485 ModalityManufacturer manufacturer)
1429
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
486 {
2335
174c3616ab6d code review
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2319
diff changeset
487 // Fix outgoing C-Find requests issue for Syngo.Via and its
174c3616ab6d code review
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2319
diff changeset
488 // solution was reported by Emsy Chan by private mail on
174c3616ab6d code review
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2319
diff changeset
489 // 2015-06-17. According to Robert van Ommen (2015-11-30), the
174c3616ab6d code review
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2319
diff changeset
490 // same fix is required for Agfa Impax. This was generalized for
174c3616ab6d code review
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2319
diff changeset
491 // generic manufacturer since it seems to affect PhilipsADW,
174c3616ab6d code review
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2319
diff changeset
492 // GEWAServer as well:
174c3616ab6d code review
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2319
diff changeset
493 // https://bitbucket.org/sjodogne/orthanc/issues/31/
2319
ae6245053bcf made some manufacturer obsolete: MedInria (that was not used), Syngovia & AgfaImpax (replaced by GenericNoWildcardInDates) + added 'GenericNoWildcards'
amazy
parents: 2244
diff changeset
494
1429
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
495 switch (manufacturer)
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
496 {
2319
ae6245053bcf made some manufacturer obsolete: MedInria (that was not used), Syngovia & AgfaImpax (replaced by GenericNoWildcardInDates) + added 'GenericNoWildcards'
amazy
parents: 2244
diff changeset
497 case ModalityManufacturer_GenericNoWildcardInDates:
2352
3ab96768d144 Fix issue 52 (DICOM level security association problems)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2340
diff changeset
498 case ModalityManufacturer_GenericNoUniversalWildcard:
1429
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
499 {
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
500 std::auto_ptr<DicomMap> fix(fields.Clone());
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
501
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
502 std::set<DicomTag> tags;
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
503 fix->GetTags(tags);
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
504
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
505 for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); ++it)
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
506 {
2335
174c3616ab6d code review
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2319
diff changeset
507 // Replace a "*" wildcard query by an empty query ("") for
174c3616ab6d code review
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2319
diff changeset
508 // "date" or "all" value representations depending on the
174c3616ab6d code review
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2319
diff changeset
509 // type of manufacturer.
2352
3ab96768d144 Fix issue 52 (DICOM level security association problems)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2340
diff changeset
510 if (manufacturer == ModalityManufacturer_GenericNoUniversalWildcard ||
2335
174c3616ab6d code review
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2319
diff changeset
511 (manufacturer == ModalityManufacturer_GenericNoWildcardInDates &&
174c3616ab6d code review
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2319
diff changeset
512 FromDcmtkBridge::LookupValueRepresentation(*it) == ValueRepresentation_Date))
1429
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
513 {
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
514 const DicomValue* value = fix->TestAndGetValue(*it);
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
515
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
516 if (value != NULL &&
1737
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
517 !value->IsNull() &&
ec66a16aa398 removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
518 value->GetContent() == "*")
1429
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
519 {
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
520 fix->SetValue(*it, "", false);
1429
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
521 }
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
522 }
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
523 }
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
524
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
525 return new ParsedDicomFile(*fix);
1429
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
526 }
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
527
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
528 default:
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
529 return new ParsedDicomFile(fields);
1429
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
530 }
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
531 }
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
532
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
533
1805
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
534 static void ExecuteFind(DicomFindAnswers& answers,
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
535 T_ASC_Association* association,
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
536 DcmDataset* dataset,
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
537 const char* sopClass,
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
538 bool isWorklist,
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
539 const char* level,
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
540 uint32_t dimseTimeout)
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
541 {
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
542 assert(isWorklist ^ (level != NULL));
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
543
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
544 FindPayload payload;
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
545 payload.answers = &answers;
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
546 payload.level = level;
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
547 payload.isWorklist = isWorklist;
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
548
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
549 // Figure out which of the accepted presentation contexts should be used
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
550 int presID = ASC_findAcceptedPresentationContextID(association, sopClass);
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
551 if (presID == 0)
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
552 {
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
553 throw OrthancException(ErrorCode_DicomFindUnavailable);
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
554 }
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
555
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
556 T_DIMSE_C_FindRQ request;
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
557 memset(&request, 0, sizeof(request));
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
558 request.MessageID = association->nextMsgID++;
1907
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
559 strncpy(request.AffectedSOPClassUID, sopClass, DIC_UI_LEN);
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
560 request.Priority = DIMSE_PRIORITY_MEDIUM;
1805
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
561 request.DataSetType = DIMSE_DATASET_PRESENT;
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
562
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
563 T_DIMSE_C_FindRSP response;
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
564 DcmDataset* statusDetail = NULL;
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
565 OFCondition cond = DIMSE_findUser(association, presID, &request, dataset,
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
566 FindCallback, &payload,
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
567 /*opt_blockMode*/ DIMSE_BLOCKING,
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
568 /*opt_dimse_timeout*/ dimseTimeout,
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
569 &response, &statusDetail);
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
570
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
571 if (statusDetail)
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
572 {
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
573 delete statusDetail;
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
574 }
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
575
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
576 Check(cond);
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
577 }
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
578
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
579
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
580 void DicomUserConnection::Find(DicomFindAnswers& result,
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
581 ResourceType level,
1707
9a04ad916831 more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1684
diff changeset
582 const DicomMap& originalFields)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
583 {
1707
9a04ad916831 more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1684
diff changeset
584 DicomMap fields;
9a04ad916831 more tolerant c-find scp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1684
diff changeset
585 FixFindQuery(fields, level, originalFields);
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
586
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
587 CheckIsOpen();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
588
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
589 std::auto_ptr<ParsedDicomFile> query(ConvertQueryFields(fields, manufacturer_));
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
590 DcmDataset* dataset = query->GetDcmtkObject().getDataset();
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
591
1805
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
592 const char* clevel = NULL;
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
593 const char* sopClass = NULL;
1366
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
594
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
595 switch (level)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
596 {
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
597 case ResourceType_Patient:
1805
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
598 clevel = "PATIENT";
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
599 DU_putStringDOElement(dataset, DcmTagKey(0x0008, 0x0052), "PATIENT");
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
600 sopClass = UID_FINDPatientRootQueryRetrieveInformationModel;
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
601 break;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
602
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
603 case ResourceType_Study:
1805
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
604 clevel = "STUDY";
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
605 DU_putStringDOElement(dataset, DcmTagKey(0x0008, 0x0052), "STUDY");
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
606 sopClass = UID_FINDStudyRootQueryRetrieveInformationModel;
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
607 break;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
608
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
609 case ResourceType_Series:
1805
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
610 clevel = "SERIES";
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
611 DU_putStringDOElement(dataset, DcmTagKey(0x0008, 0x0052), "SERIES");
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
612 sopClass = UID_FINDStudyRootQueryRetrieveInformationModel;
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
613 break;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
614
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
615 case ResourceType_Instance:
1805
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
616 clevel = "INSTANCE";
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
617 if (manufacturer_ == ModalityManufacturer_ClearCanvas ||
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
618 manufacturer_ == ModalityManufacturer_Dcm4Chee)
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
619 {
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
620 // This is a particular case for ClearCanvas, thanks to Peter Somlo <peter.somlo@gmail.com>.
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
621 // https://groups.google.com/d/msg/orthanc-users/j-6C3MAVwiw/iolB9hclom8J
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
622 // http://www.clearcanvas.ca/Home/Community/OldForums/tabid/526/aff/11/aft/14670/afv/topic/Default.aspx
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
623 DU_putStringDOElement(dataset, DcmTagKey(0x0008, 0x0052), "IMAGE");
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
624 }
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
625 else
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
626 {
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
627 DU_putStringDOElement(dataset, DcmTagKey(0x0008, 0x0052), "INSTANCE");
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
628 }
519
1b2cdc855bd3 Parameter for PACS manufacturer, support for ClearCanvas
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
629
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
630 sopClass = UID_FINDStudyRootQueryRetrieveInformationModel;
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
631 break;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
632
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
633 default:
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
634 throw OrthancException(ErrorCode_ParameterOutOfRange);
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
635 }
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
636
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
637 // Add the expected tags for this query level.
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
638 // WARNING: Do not reorder or add "break" in this switch-case!
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
639 switch (level)
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
640 {
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
641 case ResourceType_Instance:
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
642 // SOP Instance UID
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
643 if (!fields.HasTag(0x0008, 0x0018))
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
644 DU_putStringDOElement(dataset, DcmTagKey(0x0008, 0x0018), "");
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
645
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
646 case ResourceType_Series:
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
647 // Series instance UID
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
648 if (!fields.HasTag(0x0020, 0x000e))
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
649 DU_putStringDOElement(dataset, DcmTagKey(0x0020, 0x000e), "");
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
650
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
651 case ResourceType_Study:
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
652 // Accession number
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
653 if (!fields.HasTag(0x0008, 0x0050))
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
654 DU_putStringDOElement(dataset, DcmTagKey(0x0008, 0x0050), "");
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
655
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
656 // Study instance UID
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
657 if (!fields.HasTag(0x0020, 0x000d))
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
658 DU_putStringDOElement(dataset, DcmTagKey(0x0020, 0x000d), "");
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
659
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
660 case ResourceType_Patient:
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
661 // Patient ID
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1366
diff changeset
662 if (!fields.HasTag(0x0010, 0x0020))
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
663 DU_putStringDOElement(dataset, DcmTagKey(0x0010, 0x0020), "");
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
664
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
665 break;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
666
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
667 default:
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
668 throw OrthancException(ErrorCode_ParameterOutOfRange);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
669 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
670
1805
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
671 assert(clevel != NULL && sopClass != NULL);
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
672 ExecuteFind(result, pimpl_->assoc_, dataset, sopClass, false, clevel, pimpl_->dimseTimeout_);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
673 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
674
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
675
1366
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
676 void DicomUserConnection::MoveInternal(const std::string& targetAet,
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
677 ResourceType level,
1366
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
678 const DicomMap& fields)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
679 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
680 CheckIsOpen();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
681
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
682 std::auto_ptr<ParsedDicomFile> query(ConvertQueryFields(fields, manufacturer_));
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
683 DcmDataset* dataset = query->GetDcmtkObject().getDataset();
1429
7366a0bdda6a attempt of fix for Syngo.Via
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
684
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
685 const char* sopClass = UID_MOVEStudyRootQueryRetrieveInformationModel;
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
686 switch (level)
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
687 {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
688 case ResourceType_Patient:
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
689 DU_putStringDOElement(dataset, DcmTagKey(0x0008, 0x0052), "PATIENT");
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
690 break;
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
691
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
692 case ResourceType_Study:
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
693 DU_putStringDOElement(dataset, DcmTagKey(0x0008, 0x0052), "STUDY");
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
694 break;
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
695
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
696 case ResourceType_Series:
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
697 DU_putStringDOElement(dataset, DcmTagKey(0x0008, 0x0052), "SERIES");
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
698 break;
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
699
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
700 case ResourceType_Instance:
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
701 if (manufacturer_ == ModalityManufacturer_ClearCanvas ||
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
702 manufacturer_ == ModalityManufacturer_Dcm4Chee)
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
703 {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
704 // This is a particular case for ClearCanvas, thanks to Peter Somlo <peter.somlo@gmail.com>.
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
705 // https://groups.google.com/d/msg/orthanc-users/j-6C3MAVwiw/iolB9hclom8J
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
706 // http://www.clearcanvas.ca/Home/Community/OldForums/tabid/526/aff/11/aft/14670/afv/topic/Default.aspx
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
707 DU_putStringDOElement(dataset, DcmTagKey(0x0008, 0x0052), "IMAGE");
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
708 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
709 else
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
710 {
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
711 DU_putStringDOElement(dataset, DcmTagKey(0x0008, 0x0052), "INSTANCE");
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
712 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
713 break;
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
714
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
715 default:
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
716 throw OrthancException(ErrorCode_ParameterOutOfRange);
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
717 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
718
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
719 // Figure out which of the accepted presentation contexts should be used
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
720 int presID = ASC_findAcceptedPresentationContextID(pimpl_->assoc_, sopClass);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
721 if (presID == 0)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
722 {
1582
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
723 throw OrthancException(ErrorCode_DicomMoveUnavailable);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
724 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
725
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
726 T_DIMSE_C_MoveRQ request;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
727 memset(&request, 0, sizeof(request));
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
728 request.MessageID = pimpl_->assoc_->nextMsgID++;
1907
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
729 strncpy(request.AffectedSOPClassUID, sopClass, DIC_UI_LEN);
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
730 request.Priority = DIMSE_PRIORITY_MEDIUM;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
731 request.DataSetType = DIMSE_DATASET_PRESENT;
1907
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
732 strncpy(request.MoveDestination, targetAet.c_str(), DIC_AE_LEN);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
733
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
734 T_DIMSE_C_MoveRSP response;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
735 DcmDataset* statusDetail = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
736 DcmDataset* responseIdentifiers = NULL;
2202
9b373b7d6713 Fix handling of encodings in C-FIND requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2161
diff changeset
737 OFCondition cond = DIMSE_moveUser(pimpl_->assoc_, presID, &request, dataset,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
738 NULL, NULL,
1186
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
739 /*opt_blockMode*/ DIMSE_BLOCKING,
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
740 /*opt_dimse_timeout*/ pimpl_->dimseTimeout_,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
741 pimpl_->net_, NULL, NULL,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
742 &response, &statusDetail, &responseIdentifiers);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
743
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
744 if (statusDetail)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
745 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
746 delete statusDetail;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
747 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
748
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
749 if (responseIdentifiers)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
750 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
751 delete responseIdentifiers;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
752 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
753
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
754 Check(cond);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
755 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
756
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
757
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
758 void DicomUserConnection::ResetStorageSOPClasses()
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
759 {
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
760 CheckStorageSOPClassesInvariant();
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
761
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
762 storageSOPClasses_.clear();
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
763 defaultStorageSOPClasses_.clear();
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
764
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
765 // Copy the short list of storage SOP classes from DCMTK, making
1805
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
766 // room for the 5 SOP classes reserved for C-ECHO, C-FIND, C-MOVE at (**).
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
767
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
768 std::set<std::string> uncommon;
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
769 uncommon.insert(UID_BlendingSoftcopyPresentationStateStorage);
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
770 uncommon.insert(UID_GrayscaleSoftcopyPresentationStateStorage);
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
771 uncommon.insert(UID_ColorSoftcopyPresentationStateStorage);
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
772 uncommon.insert(UID_PseudoColorSoftcopyPresentationStateStorage);
1805
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
773 uncommon.insert(UID_XAXRFGrayscaleSoftcopyPresentationStateStorage);
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
774
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
775 // Add the storage syntaxes for C-STORE
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
776 for (int i = 0; i < numberOfDcmShortSCUStorageSOPClassUIDs - 1; i++)
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
777 {
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
778 if (uncommon.find(dcmShortSCUStorageSOPClassUIDs[i]) == uncommon.end())
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
779 {
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
780 defaultStorageSOPClasses_.insert(dcmShortSCUStorageSOPClassUIDs[i]);
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
781 }
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
782 }
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
783
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
784 CheckStorageSOPClassesInvariant();
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
785 }
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
786
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
787
656
08eca5d86aad fixes to cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 519
diff changeset
788 DicomUserConnection::DicomUserConnection() :
08eca5d86aad fixes to cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 519
diff changeset
789 pimpl_(new PImpl),
666
b8383ac0b227 fix cppcheck warning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 662
diff changeset
790 preferredTransferSyntax_(DEFAULT_PREFERRED_TRANSFER_SYNTAX),
656
08eca5d86aad fixes to cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 519
diff changeset
791 localAet_("STORESCU"),
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
792 remoteAet_("ANY-SCP"),
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
793 remoteHost_("127.0.0.1")
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
794 {
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
795 remotePort_ = 104;
519
1b2cdc855bd3 Parameter for PACS manufacturer, support for ClearCanvas
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
796 manufacturer_ = ModalityManufacturer_Generic;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
797
2069
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
798 SetTimeout(defaultTimeout_);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
799 pimpl_->net_ = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
800 pimpl_->params_ = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
801 pimpl_->assoc_ = NULL;
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
802
1805
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
803 // SOP classes for C-ECHO, C-FIND and C-MOVE (**)
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
804 reservedStorageSOPClasses_.push_back(UID_VerificationSOPClass);
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
805 reservedStorageSOPClasses_.push_back(UID_FINDPatientRootQueryRetrieveInformationModel);
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
806 reservedStorageSOPClasses_.push_back(UID_FINDStudyRootQueryRetrieveInformationModel);
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
807 reservedStorageSOPClasses_.push_back(UID_MOVEStudyRootQueryRetrieveInformationModel);
1805
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
808 reservedStorageSOPClasses_.push_back(UID_FINDModalityWorklistInformationModel);
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
809
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
810 ResetStorageSOPClasses();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
811 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
812
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
813 DicomUserConnection::~DicomUserConnection()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
814 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
815 Close();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
816 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
817
772
31cc399c7762 RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 769
diff changeset
818
1427
d710ea64f0fd Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1371
diff changeset
819 void DicomUserConnection::SetRemoteModality(const RemoteModalityParameters& parameters)
772
31cc399c7762 RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 769
diff changeset
820 {
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
821 SetRemoteApplicationEntityTitle(parameters.GetApplicationEntityTitle());
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
822 SetRemoteHost(parameters.GetHost());
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
823 SetRemotePort(parameters.GetPort());
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
824 SetRemoteManufacturer(parameters.GetManufacturer());
772
31cc399c7762 RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 769
diff changeset
825 }
31cc399c7762 RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 769
diff changeset
826
31cc399c7762 RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 769
diff changeset
827
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
828 void DicomUserConnection::SetLocalApplicationEntityTitle(const std::string& aet)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
829 {
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
830 if (localAet_ != aet)
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
831 {
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
832 Close();
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
833 localAet_ = aet;
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
834 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
835 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
836
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
837 void DicomUserConnection::SetRemoteApplicationEntityTitle(const std::string& aet)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
838 {
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
839 if (remoteAet_ != aet)
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
840 {
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
841 Close();
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
842 remoteAet_ = aet;
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
843 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
844 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
845
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
846 void DicomUserConnection::SetRemoteManufacturer(ModalityManufacturer manufacturer)
519
1b2cdc855bd3 Parameter for PACS manufacturer, support for ClearCanvas
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
847 {
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
848 if (manufacturer_ != manufacturer)
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
849 {
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
850 Close();
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
851 manufacturer_ = manufacturer;
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
852 }
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
853 }
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
854
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
855 void DicomUserConnection::ResetPreferredTransferSyntax()
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
856 {
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
857 SetPreferredTransferSyntax(DEFAULT_PREFERRED_TRANSFER_SYNTAX);
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
858 }
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
859
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
860 void DicomUserConnection::SetPreferredTransferSyntax(const std::string& preferredTransferSyntax)
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
861 {
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
862 if (preferredTransferSyntax_ != preferredTransferSyntax)
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
863 {
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
864 Close();
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
865 preferredTransferSyntax_ = preferredTransferSyntax;
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
866 }
519
1b2cdc855bd3 Parameter for PACS manufacturer, support for ClearCanvas
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
867 }
1b2cdc855bd3 Parameter for PACS manufacturer, support for ClearCanvas
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
868
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
869
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
870 void DicomUserConnection::SetRemoteHost(const std::string& host)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
871 {
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
872 if (remoteHost_ != host)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
873 {
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
874 if (host.size() > HOST_NAME_MAX - 10)
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
875 {
1582
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
876 throw OrthancException(ErrorCode_ParameterOutOfRange);
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
877 }
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
878
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
879 Close();
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
880 remoteHost_ = host;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
881 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
882 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
883
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
884 void DicomUserConnection::SetRemotePort(uint16_t port)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
885 {
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
886 if (remotePort_ != port)
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
887 {
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
888 Close();
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
889 remotePort_ = port;
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
890 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
891 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
892
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
893 void DicomUserConnection::Open()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
894 {
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
895 if (IsOpen())
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
896 {
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
897 // Don't reopen the connection
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
898 return;
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
899 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
900
769
3f946e5c3802 ReusableDicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 766
diff changeset
901 LOG(INFO) << "Opening a DICOM SCU connection from AET \"" << GetLocalApplicationEntityTitle()
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
902 << "\" to AET \"" << GetRemoteApplicationEntityTitle() << "\" on host "
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
903 << GetRemoteHost() << ":" << GetRemotePort()
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
904 << " (manufacturer: " << EnumerationToString(GetRemoteManufacturer()) << ")";
769
3f946e5c3802 ReusableDicomUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 766
diff changeset
905
1186
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
906 Check(ASC_initializeNetwork(NET_REQUESTOR, 0, /*opt_acse_timeout*/ pimpl_->acseTimeout_, &pimpl_->net_));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
907 Check(ASC_createAssociationParameters(&pimpl_->params_, /*opt_maxReceivePDULength*/ ASC_DEFAULTMAXPDU));
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
908
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
909 // Set this application's title and the called application's title in the params
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
910 Check(ASC_setAPTitles(pimpl_->params_, localAet_.c_str(), remoteAet_.c_str(), NULL));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
911
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
912 // Set the network addresses of the local and remote entities
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
913 char localHost[HOST_NAME_MAX];
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
914 gethostname(localHost, HOST_NAME_MAX - 1);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
915
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
916 char remoteHostAndPort[HOST_NAME_MAX];
2
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
917
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
918 #ifdef _MSC_VER
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
919 _snprintf
2
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
920 #else
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
921 snprintf
2
67a6978503b7 fixing Windows build
Jodogne@Laptop
parents: 0
diff changeset
922 #endif
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
923 (remoteHostAndPort, HOST_NAME_MAX - 1, "%s:%d", remoteHost_.c_str(), remotePort_);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
924
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1186
diff changeset
925 Check(ASC_setPresentationAddresses(pimpl_->params_, localHost, remoteHostAndPort));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
926
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
927 // Set various options
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
928 Check(ASC_setTransportLayerType(pimpl_->params_, /*opt_secureConnection*/ false));
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
929
662
70161eb45b5c orthanc can act as a C-Store SCU for JPEG transfer syntax
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 657
diff changeset
930 SetupPresentationContexts(preferredTransferSyntax_);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
931
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
932 // Do the association
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
933 Check(ASC_requestAssociation(pimpl_->net_, pimpl_->params_, &pimpl_->assoc_));
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
934
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
935 if (ASC_countAcceptedPresentationContexts(pimpl_->params_) == 0)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
936 {
1582
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
937 throw OrthancException(ErrorCode_NoPresentationContext);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
938 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
939 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
940
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
941 void DicomUserConnection::Close()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
942 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
943 if (pimpl_->assoc_ != NULL)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
944 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
945 ASC_releaseAssociation(pimpl_->assoc_);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
946 ASC_destroyAssociation(&pimpl_->assoc_);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
947 pimpl_->assoc_ = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
948 pimpl_->params_ = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
949 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
950 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
951 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
952 if (pimpl_->params_ != NULL)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
953 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
954 ASC_destroyAssociationParameters(&pimpl_->params_);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
955 pimpl_->params_ = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
956 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
957 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
958
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
959 if (pimpl_->net_ != NULL)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
960 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
961 ASC_dropNetwork(&pimpl_->net_);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
962 pimpl_->net_ = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
963 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
964 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
965
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
966 bool DicomUserConnection::IsOpen() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
967 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
968 return pimpl_->IsOpen();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
969 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
970
1907
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
971 void DicomUserConnection::Store(const char* buffer,
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
972 size_t size,
2222
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2202
diff changeset
973 const std::string& moveOriginatorAET,
1997
f9f2aa1cc594 "MoveOriginatorID" can be specified for /modalities/.../store
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
974 uint16_t moveOriginatorID)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
975 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
976 // Prepare an input stream for the memory buffer
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
977 DcmInputBufferStream is;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
978 if (size > 0)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
979 is.setBuffer(buffer, size);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
980 is.setEos();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
981
2222
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2202
diff changeset
982 pimpl_->Store(is, *this, moveOriginatorAET, moveOriginatorID);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
983 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
984
1907
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
985 void DicomUserConnection::Store(const std::string& buffer,
2222
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2202
diff changeset
986 const std::string& moveOriginatorAET,
1997
f9f2aa1cc594 "MoveOriginatorID" can be specified for /modalities/.../store
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
987 uint16_t moveOriginatorID)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
988 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
989 if (buffer.size() > 0)
2222
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2202
diff changeset
990 Store(reinterpret_cast<const char*>(&buffer[0]), buffer.size(), moveOriginatorAET, moveOriginatorID);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
991 else
2222
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2202
diff changeset
992 Store(NULL, 0, moveOriginatorAET, moveOriginatorID);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
993 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
994
1907
5011a597b6ce Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
995 void DicomUserConnection::StoreFile(const std::string& path,
2222
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2202
diff changeset
996 const std::string& moveOriginatorAET,
1997
f9f2aa1cc594 "MoveOriginatorID" can be specified for /modalities/.../store
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
997 uint16_t moveOriginatorID)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
998 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
999 // Prepare an input stream for the file
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1000 DcmInputFileStream is(path.c_str());
2222
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2202
diff changeset
1001 pimpl_->Store(is, *this, moveOriginatorAET, moveOriginatorID);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1002 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1003
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1004 bool DicomUserConnection::Echo()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1005 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1006 CheckIsOpen();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1007 DIC_US status;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1008 Check(DIMSE_echoUser(pimpl_->assoc_, pimpl_->assoc_->nextMsgID++,
1186
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
1009 /*opt_blockMode*/ DIMSE_BLOCKING,
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
1010 /*opt_dimse_timeout*/ pimpl_->dimseTimeout_,
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1011 &status, NULL));
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1012 return status == STATUS_Success;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1013 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1014
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1015
1366
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1016 static void TestAndCopyTag(DicomMap& result,
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1017 const DicomMap& source,
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1018 const DicomTag& tag)
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1019 {
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1020 if (!source.HasTag(tag))
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1021 {
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1022 throw OrthancException(ErrorCode_BadRequest);
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1023 }
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1024 else
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1025 {
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1026 result.SetValue(tag, source.GetValue(tag));
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1027 }
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1028 }
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1029
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1030
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1031 void DicomUserConnection::Move(const std::string& targetAet,
1998
9b61701c35f2 New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1997
diff changeset
1032 ResourceType level,
1366
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1033 const DicomMap& findResult)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1034 {
1366
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1035 DicomMap move;
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1036 switch (level)
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1037 {
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1038 case ResourceType_Patient:
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1039 TestAndCopyTag(move, findResult, DICOM_TAG_PATIENT_ID);
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1040 break;
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1041
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1042 case ResourceType_Study:
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1043 TestAndCopyTag(move, findResult, DICOM_TAG_STUDY_INSTANCE_UID);
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1044 break;
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1045
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1046 case ResourceType_Series:
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1047 TestAndCopyTag(move, findResult, DICOM_TAG_STUDY_INSTANCE_UID);
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1048 TestAndCopyTag(move, findResult, DICOM_TAG_SERIES_INSTANCE_UID);
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1049 break;
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1050
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1051 case ResourceType_Instance:
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1052 TestAndCopyTag(move, findResult, DICOM_TAG_STUDY_INSTANCE_UID);
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1053 TestAndCopyTag(move, findResult, DICOM_TAG_SERIES_INSTANCE_UID);
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1054 TestAndCopyTag(move, findResult, DICOM_TAG_SOP_INSTANCE_UID);
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1055 break;
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1056
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1057 default:
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1058 throw OrthancException(ErrorCode_InternalError);
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1059 }
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1060
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
1061 MoveInternal(targetAet, level, move);
1366
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1062 }
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1063
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1064
1998
9b61701c35f2 New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1997
diff changeset
1065 void DicomUserConnection::Move(const std::string& targetAet,
9b61701c35f2 New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1997
diff changeset
1066 const DicomMap& findResult)
9b61701c35f2 New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1997
diff changeset
1067 {
9b61701c35f2 New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1997
diff changeset
1068 if (!findResult.HasTag(DICOM_TAG_QUERY_RETRIEVE_LEVEL))
9b61701c35f2 New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1997
diff changeset
1069 {
9b61701c35f2 New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1997
diff changeset
1070 throw OrthancException(ErrorCode_InternalError);
9b61701c35f2 New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1997
diff changeset
1071 }
9b61701c35f2 New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1997
diff changeset
1072
9b61701c35f2 New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1997
diff changeset
1073 const std::string tmp = findResult.GetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL).GetContent();
9b61701c35f2 New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1997
diff changeset
1074 ResourceType level = StringToResourceType(tmp.c_str());
9b61701c35f2 New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1997
diff changeset
1075
9b61701c35f2 New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1997
diff changeset
1076 Move(targetAet, level, findResult);
9b61701c35f2 New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1997
diff changeset
1077 }
9b61701c35f2 New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1997
diff changeset
1078
9b61701c35f2 New URI "/modalities/.../move" to issue C-Move SCU requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1997
diff changeset
1079
1366
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1080 void DicomUserConnection::MovePatient(const std::string& targetAet,
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1081 const std::string& patientId)
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1082 {
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1083 DicomMap query;
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1084 query.SetValue(DICOM_TAG_PATIENT_ID, patientId, false);
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
1085 MoveInternal(targetAet, ResourceType_Patient, query);
1366
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1086 }
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1087
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1088 void DicomUserConnection::MoveStudy(const std::string& targetAet,
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1089 const std::string& studyUid)
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1090 {
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1091 DicomMap query;
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1092 query.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, studyUid, false);
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
1093 MoveInternal(targetAet, ResourceType_Study, query);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1094 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1095
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1096 void DicomUserConnection::MoveSeries(const std::string& targetAet,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1097 const std::string& studyUid,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1098 const std::string& seriesUid)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1099 {
1366
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1100 DicomMap query;
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1101 query.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, studyUid, false);
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1102 query.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, seriesUid, false);
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
1103 MoveInternal(targetAet, ResourceType_Series, query);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1104 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1105
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1106 void DicomUserConnection::MoveInstance(const std::string& targetAet,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1107 const std::string& studyUid,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1108 const std::string& seriesUid,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1109 const std::string& instanceUid)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1110 {
1366
a3559b66fba7 move primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
1111 DicomMap query;
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1112 query.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, studyUid, false);
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1113 query.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, seriesUid, false);
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2006
diff changeset
1114 query.SetValue(DICOM_TAG_SOP_INSTANCE_UID, instanceUid, false);
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
1115 MoveInternal(targetAet, ResourceType_Instance, query);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1116 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1117
1186
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
1118
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
1119 void DicomUserConnection::SetTimeout(uint32_t seconds)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1120 {
2069
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
1121 if (seconds == 0)
1186
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
1122 {
2069
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
1123 DisableTimeout();
1186
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
1124 }
2069
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
1125 else
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
1126 {
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
1127 dcmConnectionTimeout.set(seconds);
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
1128 pimpl_->dimseTimeout_ = seconds;
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
1129 pimpl_->acseTimeout_ = 10; // Timeout used during association negociation
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
1130 }
1186
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
1131 }
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
1132
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
1133
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
1134 void DicomUserConnection::DisableTimeout()
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
1135 {
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
1136 /**
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
1137 * Global timeout (seconds) for connecting to remote hosts.
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
1138 * Default value is -1 which selects infinite timeout, i.e. blocking connect().
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
1139 */
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
1140 dcmConnectionTimeout.set(-1);
b17b6bd59747 timeouts for HTTP and DICOM
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1017
diff changeset
1141 pimpl_->dimseTimeout_ = 0;
2069
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
1142 pimpl_->acseTimeout_ = 10; // Timeout used during association negociation
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1143 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1144
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1145
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1146 void DicomUserConnection::CheckStorageSOPClassesInvariant() const
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1147 {
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1148 assert(storageSOPClasses_.size() +
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1149 defaultStorageSOPClasses_.size() +
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1150 reservedStorageSOPClasses_.size() <= MAXIMUM_STORAGE_SOP_CLASSES);
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1151 }
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1152
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1153 void DicomUserConnection::AddStorageSOPClass(const char* sop)
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1154 {
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1155 CheckStorageSOPClassesInvariant();
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1156
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1157 if (storageSOPClasses_.find(sop) != storageSOPClasses_.end())
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1158 {
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1159 // This storage SOP class is already explicitly registered. Do
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1160 // nothing.
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1161 return;
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1162 }
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1163
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1164 if (defaultStorageSOPClasses_.find(sop) != defaultStorageSOPClasses_.end())
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1165 {
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1166 // This storage SOP class is not explicitly registered, but is
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1167 // used by default. Just register it explicitly.
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1168 defaultStorageSOPClasses_.erase(sop);
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1169 storageSOPClasses_.insert(sop);
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1170
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1171 CheckStorageSOPClassesInvariant();
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1172 return;
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1173 }
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1174
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1175 // This storage SOP class is neither explicitly, nor implicitly
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1176 // registered. Close the connection and register it explicitly.
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1177
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1178 Close();
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1179
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1180 if (reservedStorageSOPClasses_.size() +
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1181 storageSOPClasses_.size() >= MAXIMUM_STORAGE_SOP_CLASSES) // (*)
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1182 {
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1183 // The maximum number of SOP classes is reached
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1184 ResetStorageSOPClasses();
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1185 defaultStorageSOPClasses_.erase(sop);
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1186 }
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1187 else if (reservedStorageSOPClasses_.size() + storageSOPClasses_.size() +
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1188 defaultStorageSOPClasses_.size() >= MAXIMUM_STORAGE_SOP_CLASSES)
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1189 {
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1190 // Make room in the default storage syntaxes
1303
bba8a47922d1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
1191 assert(!defaultStorageSOPClasses_.empty()); // Necessarily true because condition (*) is false
763
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1192 defaultStorageSOPClasses_.erase(*defaultStorageSOPClasses_.rbegin());
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1193 }
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1194
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1195 // Explicitly register the new storage syntax
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1196 storageSOPClasses_.insert(sop);
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1197
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1198 CheckStorageSOPClassesInvariant();
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1199 }
b5e6d2823115 dynamic negotiation of storage sop classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
1200
1805
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
1201
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
1202 void DicomUserConnection::FindWorklist(DicomFindAnswers& result,
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
1203 ParsedDicomFile& query)
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
1204 {
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
1205 CheckIsOpen();
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
1206
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
1207 DcmDataset* dataset = query.GetDcmtkObject().getDataset();
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
1208 const char* sopClass = UID_FINDModalityWorklistInformationModel;
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
1209
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
1210 ExecuteFind(result, pimpl_->assoc_, dataset, sopClass, true, NULL, pimpl_->dimseTimeout_);
f08978b1f45b c-find scu for modality worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1737
diff changeset
1211 }
2069
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
1212
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
1213
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
1214 void DicomUserConnection::SetDefaultTimeout(uint32_t seconds)
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
1215 {
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
1216 LOG(INFO) << "Default timeout for DICOM connections if Orthanc acts as SCU (client): "
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
1217 << seconds << " seconds (0 = no timeout)";
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
1218 defaultTimeout_ = seconds;
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2007
diff changeset
1219 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1220 }