annotate OrthancServer/Internals/FindScp.cpp @ 2228:577888e9ed2f

fix mainline version
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 13 Dec 2016 17:42:06 +0100
parents 0158f2de8cad
children a3a65de1840f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 941
diff changeset
4 * Department, University Hospital of Liege, Belgium
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * This program is free software: you can redistribute it and/or
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
136
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
10 *
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
11 * In addition, as a special exception, the copyright holders of this
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
12 * program give permission to link the code of its release with the
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
14 * that use the same license as the "OpenSSL" library), and distribute
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
15 * the linked executables. You must obey the GNU General Public License
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
16 * in all respects for all of the code used other than "OpenSSL". If you
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
17 * modify file(s) with this exception, you may extend this exception to
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
18 * your version of the file(s), but you are not obligated to do so. If
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
19 * you do not wish to do so, delete this exception statement from your
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
20 * version. If you delete this exception statement from all source files
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
21 * in the program, then also delete it here.
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * This program is distributed in the hope that it will be useful, but
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * General Public License for more details.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * You should have received a copy of the GNU General Public License
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 **/
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
766
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
33
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
34 /*=========================================================================
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
35
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
36 This file is based on portions of the following project:
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
37
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
38 Program: DCMTK 3.6.0
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
39 Module: http://dicom.offis.de/dcmtk.php.en
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
40
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
41 Copyright (C) 1994-2011, OFFIS e.V.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
42 All rights reserved.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
43
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
44 This software and supporting documentation were developed by
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
45
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
46 OFFIS e.V.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
47 R&D Division Health
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
48 Escherweg 2
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
49 26121 Oldenburg, Germany
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
50
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
51 Redistribution and use in source and binary forms, with or without
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
52 modification, are permitted provided that the following conditions
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
53 are met:
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
54
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
55 - Redistributions of source code must retain the above copyright
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
56 notice, this list of conditions and the following disclaimer.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
57
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
58 - Redistributions in binary form must reproduce the above copyright
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
59 notice, this list of conditions and the following disclaimer in the
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
60 documentation and/or other materials provided with the distribution.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
61
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
62 - Neither the name of OFFIS nor the names of its contributors may be
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
63 used to endorse or promote products derived from this software
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
64 without specific prior written permission.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
65
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
66 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
67 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
68 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
69 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
70 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
71 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
72 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
73 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
74 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
75 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
76 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
77
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
78 =========================================================================*/
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
79
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
80
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
81
831
84513f2ee1f3 pch for unit tests and server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
82 #include "../PrecompiledHeadersServer.h"
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 #include "FindScp.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 #include "../FromDcmtkBridge.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 #include "../ToDcmtkBridge.h"
1486
f967bdf8534e refactoring to Logging.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
87 #include "../../Core/Logging.h"
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
88 #include "../../Core/OrthancException.h"
1928
84c7eaeb5244 Configuration::GetDefaultEncoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
89 #include "../OrthancInitialization.h"
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
1787
1b1d5470233f refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
91 #include <dcmtk/dcmdata/dcfilefo.h>
2204
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
92 #include <dcmtk/dcmdata/dcdeftag.h>
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
93
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
94
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
95
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
96 /**
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
97 * The function below is extracted from DCMTK 3.6.0, cf. file
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
98 * "dcmtk-3.6.0/dcmwlm/libsrc/wldsfs.cc".
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
99 **/
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
100
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
101 static void HandleExistentButEmptyReferencedStudyOrPatientSequenceAttributes(DcmDataset *dataset,
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
102 const DcmTagKey &sequenceTagKey)
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
103 // Date : May 3, 2005
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
104 // Author : Thomas Wilkens
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
105 // Task : This function performs a check on a sequence attribute in the given dataset. At two different places
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
106 // in the definition of the DICOM worklist management service, a sequence attribute with a return type
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
107 // of 2 is mentioned containing two 1C attributes in its item; the condition of the two 1C attributes
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
108 // specifies that in case a sequence item is present, then these two attributes must be existent and
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
109 // must contain a value. (I am talking about ReferencedStudySequence and ReferencedPatientSequence.)
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
110 // In cases where the sequence attribute contains exactly one item with an empty ReferencedSOPClass
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
111 // and an empty ReferencedSOPInstance, we want to remove the item from the sequence. This is what
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
112 // this function does.
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
113 // Parameters : dataset - [in] Dataset in which the consistency of the sequence attribute shall be checked.
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
114 // sequenceTagKey - [in] DcmTagKey of the sequence attribute which shall be checked.
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
115 // Return Value : none.
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
116 {
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
117 DcmElement *sequenceAttribute = NULL, *referencedSOPClassUIDAttribute = NULL, *referencedSOPInstanceUIDAttribute = NULL;
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
118
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
119 // in case the sequence attribute contains exactly one item with an empty
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
120 // ReferencedSOPClassUID and an empty ReferencedSOPInstanceUID, remove the item
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
121 if( dataset->findAndGetElement( sequenceTagKey, sequenceAttribute ).good() &&
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
122 ( (DcmSequenceOfItems*)sequenceAttribute )->card() == 1 &&
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
123 ( (DcmSequenceOfItems*)sequenceAttribute )->getItem(0)->findAndGetElement( DCM_ReferencedSOPClassUID, referencedSOPClassUIDAttribute ).good() &&
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
124 referencedSOPClassUIDAttribute->getLength() == 0 &&
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
125 ( (DcmSequenceOfItems*)sequenceAttribute )->getItem(0)->findAndGetElement( DCM_ReferencedSOPInstanceUID, referencedSOPInstanceUIDAttribute, OFFalse ).good() &&
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
126 referencedSOPInstanceUIDAttribute->getLength() == 0 )
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
127 {
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
128 DcmItem *item = ((DcmSequenceOfItems*)sequenceAttribute)->remove( ((DcmSequenceOfItems*)sequenceAttribute)->getItem(0) );
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
129 delete item;
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
130 }
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
131 }
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
132
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
133
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
135 namespace Orthanc
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 namespace
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 struct FindScpData
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 {
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
141 IFindRequestHandler* findHandler_;
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
142 IWorklistRequestHandler* worklistHandler_;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 DicomFindAnswers answers_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 DcmDataset* lastRequest_;
1573
3309878b3e16 more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
145 const std::string* remoteIp_;
3309878b3e16 more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
146 const std::string* remoteAet_;
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1789
diff changeset
147 const std::string* calledAet_;
2059
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
148
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
149 FindScpData() : answers_(false)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
150 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
151 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 };
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154
2204
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
155
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
156 static void FixWorklistQuery(ParsedDicomFile& query)
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
157 {
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
158 // TODO: Check out
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
159 // WlmDataSourceFileSystem::HandleExistentButEmptyDescriptionAndCodeSequenceAttributes()"
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
160 // in DCMTK 3.6.0
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
161
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
162 DcmDataset* dataset = query.GetDcmtkObject().getDataset();
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
163 HandleExistentButEmptyReferencedStudyOrPatientSequenceAttributes(dataset, DCM_ReferencedStudySequence);
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
164 HandleExistentButEmptyReferencedStudyOrPatientSequenceAttributes(dataset, DCM_ReferencedPatientSequence);
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
165 }
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
166
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
167
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
168
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 void FindScpCallback(
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 /* in */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 void *callbackData,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 OFBool cancelled,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 T_DIMSE_C_FindRQ *request,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 DcmDataset *requestIdentifiers,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 int responseCount,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 /* out */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 T_DIMSE_C_FindRSP *response,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 DcmDataset **responseIdentifiers,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 DcmDataset **statusDetail)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 bzero(response, sizeof(T_DIMSE_C_FindRSP));
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 *statusDetail = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
184 std::string sopClassUid(request->AffectedSOPClassUID);
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
185
656
08eca5d86aad fixes to cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 618
diff changeset
186 FindScpData& data = *reinterpret_cast<FindScpData*>(callbackData);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 if (data.lastRequest_ == NULL)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 {
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
189 bool ok = false;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 try
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 {
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
193 if (sopClassUid == UID_FINDModalityWorklistInformationModel)
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
194 {
2059
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
195 data.answers_.SetWorklist(true);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
196
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
197 if (data.worklistHandler_ != NULL)
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
198 {
1788
6a2d507ef064 getting rid of opaque data structures
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1787
diff changeset
199 ParsedDicomFile query(*requestIdentifiers);
2204
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
200 FixWorklistQuery(query);
0158f2de8cad Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
201
1800
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
202 data.worklistHandler_->Handle(data.answers_, query,
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
203 *data.remoteIp_, *data.remoteAet_,
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
204 *data.calledAet_);
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
205 ok = true;
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
206 }
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
207 else
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
208 {
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
209 LOG(ERROR) << "No worklist handler is installed, cannot handle this C-FIND request";
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
210 }
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
211 }
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
212 else
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
213 {
2059
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
214 data.answers_.SetWorklist(false);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1929
diff changeset
215
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
216 if (data.findHandler_ != NULL)
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
217 {
1859
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
218 std::list<DicomTag> sequencesToReturn;
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
219
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
220 for (unsigned long i = 0; i < requestIdentifiers->card(); i++)
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
221 {
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
222 DcmElement* element = requestIdentifiers->getElement(i);
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
223 if (element && !element->isLeaf())
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
224 {
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
225 const DicomTag tag(FromDcmtkBridge::Convert(element->getTag()));
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
226
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
227 DcmSequenceOfItems& sequence = dynamic_cast<DcmSequenceOfItems&>(*element);
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
228 if (sequence.card() != 0)
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
229 {
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
230 LOG(WARNING) << "Orthanc only supports sequence matching on worklists, "
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
231 << "ignoring C-FIND SCU constraint on tag (" << tag.Format()
2115
a657f7772e69 Handling of private tags/creators in the "Dictionary" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2059
diff changeset
232 << ") " << FromDcmtkBridge::GetTagName(*element);
1859
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
233 }
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
234
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
235 sequencesToReturn.push_back(tag);
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
236 }
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
237 }
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
238
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
239 DicomMap input;
2131
bb199bccdc45 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2125
diff changeset
240 Configuration::ExtractDicomSummary(input, *requestIdentifiers);
2125
b9bd52c72ba2 cleaning up
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2115
diff changeset
241
1859
4e7c318a3f69 C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
242 data.findHandler_->Handle(data.answers_, input, sequencesToReturn,
1800
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
243 *data.remoteIp_, *data.remoteAet_,
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
244 *data.calledAet_);
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
245 ok = true;
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
246 }
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
247 else
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
248 {
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
249 LOG(ERROR) << "No C-Find handler is installed, cannot handle this request";
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
250 }
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
251 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 }
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
253 catch (OrthancException& e)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 // Internal error!
941
83489fddd8c5 Options to limit the number of results for an incoming C-FIND query
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
256 LOG(ERROR) << "C-FIND request handler has failed: " << e.What();
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
257 }
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
258
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
259 if (!ok)
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
260 {
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 response->DimseStatus = STATUS_FIND_Failed_UnableToProcess;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 *responseIdentifiers = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 return;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 data.lastRequest_ = requestIdentifiers;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 else if (data.lastRequest_ != requestIdentifiers)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 // Internal error!
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 response->DimseStatus = STATUS_FIND_Failed_UnableToProcess;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 *responseIdentifiers = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 return;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 }
722
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
275
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 if (responseCount <= static_cast<int>(data.answers_.GetSize()))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 {
941
83489fddd8c5 Options to limit the number of results for an incoming C-FIND query
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
278 // There are pending results that are still to be sent
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279 response->DimseStatus = STATUS_Pending;
1789
bdcc1dba4a53 optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1788
diff changeset
280 *responseIdentifiers = data.answers_.ExtractDcmDataset(responseCount - 1);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 }
1800
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
282 else if (data.answers_.IsComplete())
941
83489fddd8c5 Options to limit the number of results for an incoming C-FIND query
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
283 {
83489fddd8c5 Options to limit the number of results for an incoming C-FIND query
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
284 // Success: All the results have been sent
83489fddd8c5 Options to limit the number of results for an incoming C-FIND query
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
285 response->DimseStatus = STATUS_Success;
83489fddd8c5 Options to limit the number of results for an incoming C-FIND query
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
286 *responseIdentifiers = NULL;
83489fddd8c5 Options to limit the number of results for an incoming C-FIND query
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
287 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 {
941
83489fddd8c5 Options to limit the number of results for an incoming C-FIND query
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
290 // Success, but the results were too numerous and had to be cropped
83489fddd8c5 Options to limit the number of results for an incoming C-FIND query
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
291 LOG(WARNING) << "Too many results for an incoming C-FIND query";
83489fddd8c5 Options to limit the number of results for an incoming C-FIND query
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
292 response->DimseStatus = STATUS_FIND_Cancel_MatchingTerminatedDueToCancelRequest;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 *responseIdentifiers = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 OFCondition Internals::findScp(T_ASC_Association * assoc,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 T_DIMSE_Message * msg,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 T_ASC_PresentationContextID presID,
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
302 IFindRequestHandler* findHandler,
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
303 IWorklistRequestHandler* worklistHandler,
1573
3309878b3e16 more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
304 const std::string& remoteIp,
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1789
diff changeset
305 const std::string& remoteAet,
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1789
diff changeset
306 const std::string& calledAet)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308 FindScpData data;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309 data.lastRequest_ = NULL;
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
310 data.findHandler_ = findHandler;
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
311 data.worklistHandler_ = worklistHandler;
1573
3309878b3e16 more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
312 data.remoteIp_ = &remoteIp;
3309878b3e16 more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
313 data.remoteAet_ = &remoteAet;
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1789
diff changeset
314 data.calledAet_ = &calledAet;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 OFCondition cond = DIMSE_findProvider(assoc, presID, &msg->msg.CFindRQ,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317 FindScpCallback, &data,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318 /*opt_blockMode*/ DIMSE_BLOCKING,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 /*opt_dimse_timeout*/ 0);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321 // if some error occured, dump corresponding information and remove the outfile if necessary
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324 OFString temp_str;
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
325 LOG(ERROR) << "Find SCP Failed: " << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 return cond;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 }