Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomNetworking/DicomStoreUserConnection.cpp @ 5853:4d932683049d get-scu tip
very first implementation of C-Get SCU
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Tue, 29 Oct 2024 17:25:49 +0100 |
parents | f7adfb22e20e |
children |
rev | line source |
---|---|
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
5640
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5555
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5555
diff
changeset
|
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5442
diff
changeset
|
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * This program is free software: you can redistribute it and/or |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 * modify it under the terms of the GNU Lesser General Public License |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
11 * as published by the Free Software Foundation, either version 3 of |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
12 * the License, or (at your option) any later version. |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * This program is distributed in the hope that it will be useful, but |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * WITHOUT ANY WARRANTY; without even the implied warranty of |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
17 * Lesser General Public License for more details. |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 * You should have received a copy of the GNU Lesser General Public |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
20 * License along with this program. If not, see |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
21 * <http://www.gnu.org/licenses/>. |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 **/ |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 #include "../PrecompiledHeaders.h" |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 #include "DicomStoreUserConnection.h" |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 |
3831
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
28 #include "../DicomParsing/FromDcmtkBridge.h" |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
29 #include "../DicomParsing/ParsedDicomFile.h" |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
30 #include "../Logging.h" |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
31 #include "../OrthancException.h" |
3826
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
32 #include "DicomAssociation.h" |
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
33 |
3831
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
34 #include <dcmtk/dcmdata/dcdeftag.h> |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
35 |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
36 #include <list> |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
37 |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 namespace Orthanc |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 { |
4281
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
41 static void ProgressCallback(void * /*callbackData*/, |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
42 T_DIMSE_StoreProgress *progress, |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
43 T_DIMSE_C_StoreRQ * req) |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
44 { |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
45 if (req != NULL && |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
46 progress->state == DIMSE_StoreBegin) |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
47 { |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
48 OFString str; |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
49 CLOG(TRACE, DICOM) << "Sending Store Request:" << std::endl |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
50 << DIMSE_dumpMessage(str, *req, DIMSE_OUTGOING); |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
51 } |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
52 } |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
53 |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
54 |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 bool DicomStoreUserConnection::ProposeStorageClass(const std::string& sopClassUid, |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
56 const std::set<DicomTransferSyntax>& sourceSyntaxes, |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
57 bool hasPreferred, |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
58 DicomTransferSyntax preferred) |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 { |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
60 typedef std::list< std::set<DicomTransferSyntax> > GroupsOfSyntaxes; |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
61 |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
62 GroupsOfSyntaxes groups; |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
63 |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
64 // Firstly, add one group for each individual transfer syntax |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
65 for (std::set<DicomTransferSyntax>::const_iterator |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
66 it = sourceSyntaxes.begin(); it != sourceSyntaxes.end(); ++it) |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
67 { |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
68 std::set<DicomTransferSyntax> group; |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
69 group.insert(*it); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
70 groups.push_back(group); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
71 } |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
72 |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
73 // Secondly, add one group with the preferred transfer syntax |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
74 if (hasPreferred && |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
75 sourceSyntaxes.find(preferred) == sourceSyntaxes.end()) |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
76 { |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
77 std::set<DicomTransferSyntax> group; |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
78 group.insert(preferred); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
79 groups.push_back(group); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
80 } |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
81 |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
82 // Thirdly, add all the uncompressed transfer syntaxes as one single group |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
83 if (proposeUncompressedSyntaxes_) |
3868
d5be23fc0106
better negotiation of transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3862
diff
changeset
|
84 { |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
85 static const size_t N = 3; |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
86 static const DicomTransferSyntax UNCOMPRESSED_SYNTAXES[N] = { |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
87 DicomTransferSyntax_LittleEndianImplicit, |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
88 DicomTransferSyntax_LittleEndianExplicit, |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
89 DicomTransferSyntax_BigEndianExplicit |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
90 }; |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
91 |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
92 std::set<DicomTransferSyntax> group; |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
93 |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
94 for (size_t i = 0; i < N; i++) |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
95 { |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
96 DicomTransferSyntax syntax = UNCOMPRESSED_SYNTAXES[i]; |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
97 if (sourceSyntaxes.find(syntax) == sourceSyntaxes.end() && |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
98 (!hasPreferred || preferred != syntax)) |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
99 { |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
100 group.insert(syntax); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
101 } |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
102 } |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
103 |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
104 if (!group.empty()) |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
105 { |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
106 groups.push_back(group); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
107 } |
3868
d5be23fc0106
better negotiation of transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3862
diff
changeset
|
108 } |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
109 |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
110 // Now, propose each of these groups of transfer syntaxes |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
111 if (association_->GetRemainingPropositions() <= groups.size()) |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 return false; // Not enough room |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 } |
3868
d5be23fc0106
better negotiation of transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3862
diff
changeset
|
115 else |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 { |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
117 for (GroupsOfSyntaxes::const_iterator it = groups.begin(); it != groups.end(); ++it) |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 { |
3868
d5be23fc0106
better negotiation of transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3862
diff
changeset
|
119 association_->ProposePresentationContext(sopClassUid, *it); |
d5be23fc0106
better negotiation of transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3862
diff
changeset
|
120 |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
121 // Remember the syntaxes that were individually proposed, in |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
122 // order to avoid renegociation if they are seen again (**) |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
123 if (it->size() == 1) |
3868
d5be23fc0106
better negotiation of transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3862
diff
changeset
|
124 { |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
125 DicomTransferSyntax syntax = *it->begin(); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
126 proposedOriginalClasses_.insert(std::make_pair(sopClassUid, syntax)); |
3880
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
127 } |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
128 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 |
3868
d5be23fc0106
better negotiation of transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3862
diff
changeset
|
130 return true; |
d5be23fc0106
better negotiation of transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3862
diff
changeset
|
131 } |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 bool DicomStoreUserConnection::LookupPresentationContext( |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 uint8_t& presentationContextId, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 const std::string& sopClassUid, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 DicomTransferSyntax transferSyntax) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 typedef std::map<DicomTransferSyntax, uint8_t> PresentationContexts; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 PresentationContexts pc; |
3826
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
143 if (association_->IsOpen() && |
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
144 association_->LookupAcceptedPresentationContext(pc, sopClassUid)) |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 PresentationContexts::const_iterator found = pc.find(transferSyntax); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 if (found != pc.end()) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 presentationContextId = found->second; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 return true; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 return false; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 } |
3862
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
156 |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
157 |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
158 DicomStoreUserConnection::DicomStoreUserConnection( |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 const DicomAssociationParameters& params) : |
3874
2effa961f67f
forcing use of DicomAssociationParameters if creating an SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3868
diff
changeset
|
160 parameters_(params), |
2effa961f67f
forcing use of DicomAssociationParameters if creating an SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3868
diff
changeset
|
161 association_(new DicomAssociation), |
2effa961f67f
forcing use of DicomAssociationParameters if creating an SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3868
diff
changeset
|
162 proposeCommonClasses_(true), |
2effa961f67f
forcing use of DicomAssociationParameters if creating an SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3868
diff
changeset
|
163 proposeUncompressedSyntaxes_(true), |
2effa961f67f
forcing use of DicomAssociationParameters if creating an SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3868
diff
changeset
|
164 proposeRetiredBigEndian_(false) |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 } |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
167 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
168 const DicomAssociationParameters &DicomStoreUserConnection::GetParameters() const |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
169 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
170 return parameters_; |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
171 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
172 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
173 void DicomStoreUserConnection::SetCommonClassesProposed(bool proposed) |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
174 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
175 proposeCommonClasses_ = proposed; |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
176 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
177 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
178 bool DicomStoreUserConnection::IsCommonClassesProposed() const |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
179 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
180 return proposeCommonClasses_; |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
181 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
182 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
183 void DicomStoreUserConnection::SetUncompressedSyntaxesProposed(bool proposed) |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
184 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
185 proposeUncompressedSyntaxes_ = proposed; |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
186 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
187 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
188 bool DicomStoreUserConnection::IsUncompressedSyntaxesProposed() const |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
189 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
190 return proposeUncompressedSyntaxes_; |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
191 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
192 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
193 void DicomStoreUserConnection::SetRetiredBigEndianProposed(bool propose) |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
194 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
195 proposeRetiredBigEndian_ = propose; |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
196 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
197 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
198 bool DicomStoreUserConnection::IsRetiredBigEndianProposed() const |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
199 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
200 return proposeRetiredBigEndian_; |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
201 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
202 |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
203 |
3868
d5be23fc0106
better negotiation of transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3862
diff
changeset
|
204 void DicomStoreUserConnection::RegisterStorageClass(const std::string& sopClassUid, |
d5be23fc0106
better negotiation of transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3862
diff
changeset
|
205 DicomTransferSyntax syntax) |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
206 { |
3879 | 207 RegisteredClasses::iterator found = registeredClasses_.find(sopClassUid); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
208 |
3879 | 209 if (found == registeredClasses_.end()) |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
210 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
211 std::set<DicomTransferSyntax> ts; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
212 ts.insert(syntax); |
3879 | 213 registeredClasses_[sopClassUid] = ts; |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
214 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
215 else |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
216 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
217 found->second.insert(syntax); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
218 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
219 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
220 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
221 |
3862
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
222 void DicomStoreUserConnection::LookupParameters(std::string& sopClassUid, |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
223 std::string& sopInstanceUid, |
3882
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
224 DicomTransferSyntax& transferSyntax, |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
225 DcmFileFormat& dicom) |
3862
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
226 { |
3882
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
227 if (dicom.getDataset() == NULL) |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
228 { |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
229 throw OrthancException(ErrorCode_InternalError); |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
230 } |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
231 |
3862
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
232 OFString a, b; |
3882
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
233 if (!dicom.getDataset()->findAndGetOFString(DCM_SOPClassUID, a).good() || |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
234 !dicom.getDataset()->findAndGetOFString(DCM_SOPInstanceUID, b).good()) |
3862
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
235 { |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
236 throw OrthancException(ErrorCode_NoSopClassOrInstance, |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
237 "Unable to determine the SOP class/instance for C-STORE with AET " + |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
238 parameters_.GetRemoteModality().GetApplicationEntityTitle()); |
3862
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
239 } |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
240 |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
241 sopClassUid.assign(a.c_str()); |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
242 sopInstanceUid.assign(b.c_str()); |
3882
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
243 |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
244 if (!FromDcmtkBridge::LookupOrthancTransferSyntax(transferSyntax, dicom)) |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
245 { |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
246 throw OrthancException(ErrorCode_InternalError, |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
247 "Unknown transfer syntax from DCMTK"); |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
248 } |
3862
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
249 } |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
250 |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
251 |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
252 bool DicomStoreUserConnection::NegotiatePresentationContext( |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
253 uint8_t& presentationContextId, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
254 const std::string& sopClassUid, |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
255 DicomTransferSyntax transferSyntax, |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
256 bool hasPreferred, |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
257 DicomTransferSyntax preferred) |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
258 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
259 /** |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
260 * Step 1: Check whether this presentation context is already |
3880
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
261 * available in the previously negotiated assocation. |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
262 **/ |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
263 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
264 if (LookupPresentationContext(presentationContextId, sopClassUid, transferSyntax)) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
265 { |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
266 CLOG(INFO, DICOM) << "Found an accepted presentation context for SOPClassUID " << sopClassUid << " and transfer syntax " << GetTransferSyntaxUid(transferSyntax); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
267 return true; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
268 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
269 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
270 // The association must be re-negotiated |
3862
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
271 if (association_->IsOpen()) |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
272 { |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
273 CLOG(INFO, DICOM) << "No accepted presentation context found, re-negotiating DICOM association with " |
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
274 << parameters_.GetRemoteModality().GetApplicationEntityTitle() |
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
275 << " for SOPClassUID " << sopClassUid << " TransferSyntax =" << GetTransferSyntaxUid(transferSyntax); |
3880
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
276 |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
277 // Check if we know that the remote modality was |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
278 // already proposed this individual transfer syntax (**) |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
279 if (proposedOriginalClasses_.find(std::make_pair(sopClassUid, transferSyntax)) != proposedOriginalClasses_.end()) |
3880
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
280 { |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
281 CLOG(INFO, DICOM) << "The remote modality has already rejected SOP class UID \"" |
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
282 << sopClassUid << "\" with transfer syntax \"" |
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
283 << GetTransferSyntaxUid(transferSyntax) << "\", but we will renegotiate anyway"; |
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
284 // always renegotiating since 1.12.2 // return false; |
3880
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
285 } |
3862
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
286 } |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
287 else |
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
288 { |
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
289 CLOG(INFO, DICOM) << "Negotiating DICOM association with " |
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
290 << parameters_.GetRemoteModality().GetApplicationEntityTitle() |
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
291 << " for SOPClassUID " << sopClassUid << " TransferSyntax =" << GetTransferSyntaxUid(transferSyntax); |
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
292 } |
3880
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
293 |
3826
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
294 association_->ClearPresentationContexts(); |
3880
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
295 proposedOriginalClasses_.clear(); |
3879 | 296 RegisterStorageClass(sopClassUid, transferSyntax); // (*) |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
297 |
3879 | 298 |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
299 /** |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
300 * Step 2: Propose at least the mandatory SOP class. |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
301 **/ |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
302 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
303 { |
3879 | 304 RegisteredClasses::const_iterator mandatory = registeredClasses_.find(sopClassUid); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
305 |
3879 | 306 if (mandatory == registeredClasses_.end() || |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
307 mandatory->second.find(transferSyntax) == mandatory->second.end()) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
308 { |
3879 | 309 // Should never fail because of (*) |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
310 throw OrthancException(ErrorCode_InternalError); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
311 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
312 |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
313 if (!ProposeStorageClass(sopClassUid, mandatory->second, hasPreferred, preferred)) |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
314 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
315 // Should never happen in real life: There are no more than |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
316 // 128 transfer syntaxes in DICOM! |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
317 throw OrthancException(ErrorCode_InternalError, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
318 "Too many transfer syntaxes for SOP class UID: " + sopClassUid); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
319 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
320 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
321 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
322 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
323 /** |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
324 * Step 3: Propose all the previously spotted SOP classes, as |
3868
d5be23fc0106
better negotiation of transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3862
diff
changeset
|
325 * registered through the "RegisterStorageClass()" method. |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
326 **/ |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
327 |
3879 | 328 for (RegisteredClasses::const_iterator it = registeredClasses_.begin(); |
329 it != registeredClasses_.end(); ++it) | |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
330 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
331 if (it->first != sopClassUid) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
332 { |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
333 ProposeStorageClass(it->first, it->second, hasPreferred, preferred); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
334 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
335 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
336 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
337 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
338 /** |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
339 * Step 4: As long as there is room left in the proposed |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
340 * presentation contexts, propose the uncompressed transfer syntaxes |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
341 * for the most common SOP classes, as can be found in the |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
342 * "dcmShortSCUStorageSOPClassUIDs" array from DCMTK. The |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
343 * preferred transfer syntax is "LittleEndianImplicit". |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
344 **/ |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
345 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
346 if (proposeCommonClasses_) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
347 { |
3868
d5be23fc0106
better negotiation of transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3862
diff
changeset
|
348 // The method "ProposeStorageClass()" will automatically add |
d5be23fc0106
better negotiation of transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3862
diff
changeset
|
349 // "LittleEndianImplicit" |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
350 std::set<DicomTransferSyntax> ts; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
351 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
352 for (int i = 0; i < numberOfDcmShortSCUStorageSOPClassUIDs; i++) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
353 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
354 std::string c(dcmShortSCUStorageSOPClassUIDs[i]); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
355 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
356 if (c != sopClassUid && |
3879 | 357 registeredClasses_.find(c) == registeredClasses_.end()) |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
358 { |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
359 ProposeStorageClass(c, ts, hasPreferred, preferred); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
360 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
361 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
362 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
363 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
364 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
365 /** |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
366 * Step 5: Open the association, and check whether the pair (SOP |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
367 * class UID, transfer syntax) was accepted by the remote host. |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
368 **/ |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
369 |
3826
e82bd07c384e
putting DicomAssociation behind pimpl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3825
diff
changeset
|
370 association_->Open(parameters_); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
371 return LookupPresentationContext(presentationContextId, sopClassUid, transferSyntax); |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
372 } |
3831
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
373 |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
374 |
3881 | 375 void DicomStoreUserConnection::Store(std::string& sopClassUid, |
376 std::string& sopInstanceUid, | |
3882
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
377 DcmFileFormat& dicom, |
3894
8f7ad4989fec
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3893
diff
changeset
|
378 bool hasMoveOriginator, |
3881 | 379 const std::string& moveOriginatorAET, |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
380 uint16_t moveOriginatorID) |
3831
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
381 { |
3862
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
382 DicomTransferSyntax transferSyntax; |
3882
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
383 LookupParameters(sopClassUid, sopInstanceUid, transferSyntax, dicom); |
3880
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
384 |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
385 LOG(INFO) << "Performing C-Store on instance of SOPClassUID '" << sopClassUid << "'"; |
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
386 |
3862
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
387 uint8_t presID; |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
388 if (!NegotiatePresentationContext(presID, sopClassUid, transferSyntax, proposeUncompressedSyntaxes_, |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
389 DicomTransferSyntax_LittleEndianExplicit)) |
3831
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
390 { |
3862
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
391 throw OrthancException(ErrorCode_NetworkProtocol, |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
392 "No valid presentation context was negotiated for " |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
393 "SOP class UID [" + sopClassUid + "] and transfer " |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
394 "syntax [" + GetTransferSyntaxUid(transferSyntax) + "] " |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
395 "while sending to modality [" + |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
396 parameters_.GetRemoteModality().GetApplicationEntityTitle() + "]"); |
3831
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
397 } |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
398 |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
399 // Prepare the transmission of data |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
400 T_DIMSE_C_StoreRQ request; |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
401 memset(&request, 0, sizeof(request)); |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
402 request.MessageID = association_->GetDcmtkAssociation().nextMsgID++; |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
403 strncpy(request.AffectedSOPClassUID, sopClassUid.c_str(), DIC_UI_LEN); |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
404 request.Priority = DIMSE_PRIORITY_MEDIUM; |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
405 request.DataSetType = DIMSE_DATASET_PRESENT; |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
406 strncpy(request.AffectedSOPInstanceUID, sopInstanceUid.c_str(), DIC_UI_LEN); |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
407 |
3894
8f7ad4989fec
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3893
diff
changeset
|
408 if (hasMoveOriginator) |
8f7ad4989fec
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3893
diff
changeset
|
409 { |
3831
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
410 strncpy(request.MoveOriginatorApplicationEntityTitle, |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
411 moveOriginatorAET.c_str(), DIC_AE_LEN); |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
412 request.opts = O_STORE_MOVEORIGINATORAETITLE; |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
413 |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
414 request.MoveOriginatorID = moveOriginatorID; // The type DIC_US is an alias for uint16_t |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
415 request.opts |= O_STORE_MOVEORIGINATORID; |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
416 } |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
417 |
3882
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
418 if (dicom.getDataset() == NULL) |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
419 { |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
420 throw OrthancException(ErrorCode_InternalError); |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
421 } |
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
422 |
3831
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
423 // Finally conduct transmission of data |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
424 T_DIMSE_C_StoreRSP response; |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
425 DcmDataset* statusDetail = NULL; |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
426 DicomAssociation::CheckCondition( |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
427 DIMSE_storeUser(&association_->GetDcmtkAssociation(), presID, &request, |
4281
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
428 NULL, dicom.getDataset(), ProgressCallback, NULL, |
3831
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
429 /*opt_blockMode*/ (GetParameters().HasTimeout() ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
430 /*opt_dimse_timeout*/ GetParameters().GetTimeout(), |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
431 &response, &statusDetail, NULL), |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
432 GetParameters(), "C-STORE"); |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
433 |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
434 if (statusDetail != NULL) |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
435 { |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
436 delete statusDetail; |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
437 } |
4281
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
438 |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
439 { |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
440 OFString str; |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
441 CLOG(TRACE, DICOM) << "Received Store Response:" << std::endl |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
442 << DIMSE_dumpMessage(str, response, DIMSE_INCOMING, NULL, presID); |
d2f79a475b51
debug log for DCMTK SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
443 } |
3831
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
444 |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
445 /** |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
446 * New in Orthanc 1.6.0: Deal with failures during C-STORE. |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
447 * http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_B.2.3.html#table_B.2-1 |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
448 **/ |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
449 |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
450 if (response.DimseStatus != 0x0000 && // Success |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
451 response.DimseStatus != 0xB000 && // Warning - Coercion of Data Elements |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
452 response.DimseStatus != 0xB007 && // Warning - Data Set does not match SOP Class |
5555
13eb84aea8b8
0x0111 is now considered as a warning instead of an error
Alain Mazy <am@orthanc.team>
parents:
5485
diff
changeset
|
453 response.DimseStatus != 0xB006 && // Warning - Elements Discarded |
13eb84aea8b8
0x0111 is now considered as a warning instead of an error
Alain Mazy <am@orthanc.team>
parents:
5485
diff
changeset
|
454 response.DimseStatus != 0x0111) // Warning - Duplicate SOPInstanceUID (https://discourse.orthanc-server.org/t/ignore-dimse-status-0x0111-when-sending-partial-duplicate-studies/4555/3) |
3831
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
455 { |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
456 char buf[16]; |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
457 sprintf(buf, "%04X", response.DimseStatus); |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
458 throw OrthancException(ErrorCode_NetworkProtocol, |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
459 "C-STORE SCU to AET \"" + |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3874
diff
changeset
|
460 GetParameters().GetRemoteModality().GetApplicationEntityTitle() + |
3831
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
461 "\" has failed with DIMSE status 0x" + buf); |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
462 } |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
463 } |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
464 |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
465 |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
466 void DicomStoreUserConnection::Store(std::string& sopClassUid, |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
467 std::string& sopInstanceUid, |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
468 const void* buffer, |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
469 size_t size, |
3894
8f7ad4989fec
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3893
diff
changeset
|
470 bool hasMoveOriginator, |
3831
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
471 const std::string& moveOriginatorAET, |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
472 uint16_t moveOriginatorID) |
3831
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
473 { |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
474 std::unique_ptr<DcmFileFormat> dicom( |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
475 FromDcmtkBridge::LoadFromMemoryBuffer(buffer, size)); |
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
476 |
3882
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
477 if (dicom.get() == NULL) |
3862
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
478 { |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
479 throw OrthancException(ErrorCode_InternalError); |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
480 } |
594263db316a
DicomModalityStoreJob now uses DicomStoreUserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3831
diff
changeset
|
481 |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
482 Store(sopClassUid, sopInstanceUid, *dicom, hasMoveOriginator, moveOriginatorAET, moveOriginatorID); |
3831
83ea6939293d
starting DicomStoreUserConnection::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3826
diff
changeset
|
483 } |
3880
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
484 |
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
485 |
5252
742448a9b600
allow compilation of DICOM networking without support for transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
486 #if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 |
3882
904575738462
implemented IDicomTranscoder::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3881
diff
changeset
|
487 void DicomStoreUserConnection::LookupTranscoding(std::set<DicomTransferSyntax>& acceptedSyntaxes, |
3880
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
488 const std::string& sopClassUid, |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
489 DicomTransferSyntax sourceSyntax, |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
490 bool hasPreferred, |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
491 DicomTransferSyntax preferred) |
3880
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
492 { |
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
493 acceptedSyntaxes.clear(); |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
494 std::map<DicomTransferSyntax, uint8_t> contexts; |
3880
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
495 |
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
496 // Make sure a negotiation has already occurred for this transfer |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
497 // syntax if we have not negotiated yet. |
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
498 // We don't use the return code: Transcoding is possible even if the "sourceSyntax" is not supported. |
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
499 if (!association_->IsOpen() || !association_->LookupAcceptedPresentationContext(contexts, sopClassUid)) |
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
500 { |
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
501 uint8_t presID; |
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
502 NegotiatePresentationContext(presID, sopClassUid, sourceSyntax, hasPreferred, preferred); |
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
503 } |
3880
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
504 |
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
505 if (association_->LookupAcceptedPresentationContext(contexts, sopClassUid)) |
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
506 { |
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
507 for (std::map<DicomTransferSyntax, uint8_t>::const_iterator |
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
508 it = contexts.begin(); it != contexts.end(); ++it) |
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
509 { |
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
510 acceptedSyntaxes.insert(it->first); |
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
511 } |
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
512 } |
cdd0cb5ec4e4
DicomStoreUserConnection::LookupTranscoding()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3879
diff
changeset
|
513 } |
5252
742448a9b600
allow compilation of DICOM networking without support for transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
514 #endif |
742448a9b600
allow compilation of DICOM networking without support for transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
515 |
3893 | 516 |
5252
742448a9b600
allow compilation of DICOM networking without support for transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
517 #if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 |
3893 | 518 void DicomStoreUserConnection::Transcode(std::string& sopClassUid /* out */, |
519 std::string& sopInstanceUid /* out */, | |
520 IDicomTranscoder& transcoder, | |
521 const void* buffer, | |
522 size_t size, | |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
523 DicomTransferSyntax preferredTransferSyntax, |
3894
8f7ad4989fec
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3893
diff
changeset
|
524 bool hasMoveOriginator, |
3893 | 525 const std::string& moveOriginatorAET, |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
526 uint16_t moveOriginatorID) |
3893 | 527 { |
528 std::unique_ptr<DcmFileFormat> dicom(FromDcmtkBridge::LoadFromMemoryBuffer(buffer, size)); | |
529 if (dicom.get() == NULL || | |
530 dicom->getDataset() == NULL) | |
531 { | |
532 throw OrthancException(ErrorCode_NullPointer); | |
533 } | |
534 | |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
535 DicomTransferSyntax sourceSyntax; |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
536 LookupParameters(sopClassUid, sopInstanceUid, sourceSyntax, *dicom); |
3893 | 537 |
538 std::set<DicomTransferSyntax> accepted; | |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
539 LookupTranscoding(accepted, sopClassUid, sourceSyntax, true, preferredTransferSyntax); |
3893 | 540 |
5440
99fa307438e1
DicomStoreUserConnection: improved logs
Alain Mazy <am@osimis.io>
parents:
5438
diff
changeset
|
541 if (accepted.size() == 0) |
99fa307438e1
DicomStoreUserConnection: improved logs
Alain Mazy <am@osimis.io>
parents:
5438
diff
changeset
|
542 { |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
543 throw OrthancException(ErrorCode_NoPresentationContext, "Cannot C-Store an instance of SOPClassUID " + |
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
544 sopClassUid + ", the destination has not accepted any TransferSyntax for this SOPClassUID."); |
5440
99fa307438e1
DicomStoreUserConnection: improved logs
Alain Mazy <am@osimis.io>
parents:
5438
diff
changeset
|
545 } |
99fa307438e1
DicomStoreUserConnection: improved logs
Alain Mazy <am@osimis.io>
parents:
5438
diff
changeset
|
546 |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
547 if (accepted.find(sourceSyntax) != accepted.end()) |
3893 | 548 { |
549 // No need for transcoding | |
3894
8f7ad4989fec
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3893
diff
changeset
|
550 Store(sopClassUid, sopInstanceUid, *dicom, |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
551 hasMoveOriginator, moveOriginatorAET, moveOriginatorID); |
3893 | 552 } |
553 else | |
554 { | |
555 // Transcoding is needed | |
3945
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3907
diff
changeset
|
556 IDicomTranscoder::DicomImage source; |
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3907
diff
changeset
|
557 source.AcquireParsed(dicom.release()); |
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3907
diff
changeset
|
558 source.SetExternalBuffer(buffer, size); |
3951
5fe8c6d3212e
removed useless information "hasSopInstanceUidChanged"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3945
diff
changeset
|
559 |
5fe8c6d3212e
removed useless information "hasSopInstanceUidChanged"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3945
diff
changeset
|
560 const std::string sourceUid = IDicomTranscoder::GetSopInstanceUid(source.GetParsed()); |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
561 |
3945
0b3256c3ee14
simplified IDicomTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3907
diff
changeset
|
562 IDicomTranscoder::DicomImage transcoded; |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
563 bool success = false; |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
564 bool isDestructiveCompressionAllowed = false; |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
565 std::set<DicomTransferSyntax> attemptedSyntaxes; |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
566 |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
567 LOG(INFO) << "Transcoding is required to C-Store an instance of SOPClassUID '" << sopClassUid << "', preferredTransferSyntax is " << GetTransferSyntaxUid(preferredTransferSyntax); |
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
568 |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
569 if (accepted.find(preferredTransferSyntax) != accepted.end()) |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
570 { |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
571 // New in Orthanc 1.9.0: The preferred transfer syntax is |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
572 // accepted by the remote modality => transcode to this syntax |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
573 std::set<DicomTransferSyntax> targetSyntaxes; |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
574 targetSyntaxes.insert(preferredTransferSyntax); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
575 attemptedSyntaxes.insert(preferredTransferSyntax); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
576 |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
577 success = transcoder.Transcode(transcoded, source, targetSyntaxes, true); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
578 isDestructiveCompressionAllowed = true; |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
579 } |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
580 |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
581 if (!success) |
3893 | 582 { |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
583 // Transcode to either one of the uncompressed transfer |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
584 // syntaxes that are accepted by the remote modality |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
585 |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
586 std::set<DicomTransferSyntax> targetSyntaxes; |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
587 |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
588 if (accepted.find(DicomTransferSyntax_LittleEndianImplicit) != accepted.end()) |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
589 { |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
590 targetSyntaxes.insert(DicomTransferSyntax_LittleEndianImplicit); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
591 attemptedSyntaxes.insert(DicomTransferSyntax_LittleEndianImplicit); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
592 } |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
593 |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
594 if (accepted.find(DicomTransferSyntax_LittleEndianExplicit) != accepted.end()) |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
595 { |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
596 targetSyntaxes.insert(DicomTransferSyntax_LittleEndianExplicit); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
597 attemptedSyntaxes.insert(DicomTransferSyntax_LittleEndianExplicit); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
598 } |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
599 |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
600 if (accepted.find(DicomTransferSyntax_BigEndianExplicit) != accepted.end()) |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
601 { |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
602 targetSyntaxes.insert(DicomTransferSyntax_BigEndianExplicit); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
603 attemptedSyntaxes.insert(DicomTransferSyntax_BigEndianExplicit); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
604 } |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
605 |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
606 if (!targetSyntaxes.empty()) |
3893 | 607 { |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
608 success = transcoder.Transcode(transcoded, source, targetSyntaxes, false); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
609 isDestructiveCompressionAllowed = false; |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
610 } |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
611 } |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
612 |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
613 if (success) |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
614 { |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
615 std::string targetUid = IDicomTranscoder::GetSopInstanceUid(transcoded.GetParsed()); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
616 if (sourceUid != targetUid) |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
617 { |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
618 if (isDestructiveCompressionAllowed) |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
619 { |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
620 LOG(WARNING) << "Because of the use of a preferred transfer syntax that corresponds to " |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
621 << "a destructive compression, C-STORE SCU has hanged the SOP Instance UID " |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
622 << "of a DICOM instance from \"" << sourceUid << "\" to \"" << targetUid << "\""; |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
623 } |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
624 else |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
625 { |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
626 throw OrthancException(ErrorCode_Plugin, "The transcoder has changed the SOP " |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
627 "Instance UID while transcoding to an uncompressed transfer syntax"); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
628 } |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
629 } |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
630 |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
631 DicomTransferSyntax transcodedSyntax; |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
632 |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
633 // Sanity check |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
634 if (!FromDcmtkBridge::LookupOrthancTransferSyntax(transcodedSyntax, transcoded.GetParsed()) || |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
635 accepted.find(transcodedSyntax) == accepted.end()) |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
636 { |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
637 throw OrthancException(ErrorCode_InternalError); |
3893 | 638 } |
639 else | |
640 { | |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
641 Store(sopClassUid, sopInstanceUid, transcoded.GetParsed(), |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
642 hasMoveOriginator, moveOriginatorAET, moveOriginatorID); |
3893 | 643 } |
644 } | |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
645 else |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
646 { |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
647 std::string s; |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
648 for (std::set<DicomTransferSyntax>::const_iterator |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
649 it = attemptedSyntaxes.begin(); it != attemptedSyntaxes.end(); ++it) |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
650 { |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
651 s += " " + std::string(GetTransferSyntaxUid(*it)); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
652 } |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
653 |
5440
99fa307438e1
DicomStoreUserConnection: improved logs
Alain Mazy <am@osimis.io>
parents:
5438
diff
changeset
|
654 throw OrthancException(ErrorCode_NotImplemented, "Cannot transcode instance of SOPClassUID " + |
99fa307438e1
DicomStoreUserConnection: improved logs
Alain Mazy <am@osimis.io>
parents:
5438
diff
changeset
|
655 sopClassUid + " from " + |
4465
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
656 std::string(GetTransferSyntaxUid(sourceSyntax)) + |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
657 " to one of [" + s + " ]"); |
fe774d8e904b
New configuration option: "DicomScuPreferredTransferSyntax" to control transcoding in C-STORE SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
658 } |
3893 | 659 } |
660 } | |
5252
742448a9b600
allow compilation of DICOM networking without support for transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
661 #endif |
4466
2243f1bb909b
ABI compatibility for DicomStoreUserConnection::Transcode()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4465
diff
changeset
|
662 |
5252
742448a9b600
allow compilation of DICOM networking without support for transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
663 |
742448a9b600
allow compilation of DICOM networking without support for transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
664 #if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1 |
4466
2243f1bb909b
ABI compatibility for DicomStoreUserConnection::Transcode()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4465
diff
changeset
|
665 void DicomStoreUserConnection::Transcode(std::string& sopClassUid /* out */, |
2243f1bb909b
ABI compatibility for DicomStoreUserConnection::Transcode()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4465
diff
changeset
|
666 std::string& sopInstanceUid /* out */, |
2243f1bb909b
ABI compatibility for DicomStoreUserConnection::Transcode()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4465
diff
changeset
|
667 IDicomTranscoder& transcoder, |
2243f1bb909b
ABI compatibility for DicomStoreUserConnection::Transcode()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4465
diff
changeset
|
668 const void* buffer, |
2243f1bb909b
ABI compatibility for DicomStoreUserConnection::Transcode()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4465
diff
changeset
|
669 size_t size, |
2243f1bb909b
ABI compatibility for DicomStoreUserConnection::Transcode()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4465
diff
changeset
|
670 bool hasMoveOriginator, |
2243f1bb909b
ABI compatibility for DicomStoreUserConnection::Transcode()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4465
diff
changeset
|
671 const std::string& moveOriginatorAET, |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
672 uint16_t moveOriginatorID) |
4466
2243f1bb909b
ABI compatibility for DicomStoreUserConnection::Transcode()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4465
diff
changeset
|
673 { |
2243f1bb909b
ABI compatibility for DicomStoreUserConnection::Transcode()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4465
diff
changeset
|
674 Transcode(sopClassUid, sopInstanceUid, transcoder, buffer, size, DicomTransferSyntax_LittleEndianExplicit, |
5442
ac68a4383e51
improved C-Store negotiation and logging
Alain Mazy <am@osimis.io>
parents:
5440
diff
changeset
|
675 hasMoveOriginator, moveOriginatorAET, moveOriginatorID); |
4466
2243f1bb909b
ABI compatibility for DicomStoreUserConnection::Transcode()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4465
diff
changeset
|
676 } |
5252
742448a9b600
allow compilation of DICOM networking without support for transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
677 #endif |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
678 } |