Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomNetworking/Internals/FindScp.cpp @ 5321:5fae323b11ed
added OrthancPlugins::DicomInstance::Load()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 24 Jun 2023 12:43:10 +0200 |
parents | 0ea402b4d901 |
children | 48b8dae6dc77 |
rev | line source |
---|---|
0 | 1 /** |
62 | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 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 |
5185
0ea402b4d901
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5072
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
0ea402b4d901
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5072
diff
changeset
|
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
0 | 7 * |
8 * 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
|
9 * 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
|
10 * 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
|
11 * the License, or (at your option) any later version. |
136 | 12 * |
0 | 13 * This program is distributed in the hope that it will be useful, but |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * 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
|
16 * Lesser General Public License for more details. |
0 | 17 * |
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
|
18 * 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
|
19 * 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
|
20 * <http://www.gnu.org/licenses/>. |
0 | 21 **/ |
22 | |
23 | |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
722
diff
changeset
|
24 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
25 |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
722
diff
changeset
|
26 /*========================================================================= |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
722
diff
changeset
|
27 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
722
diff
changeset
|
28 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
|
29 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
722
diff
changeset
|
30 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
|
31 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
|
32 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
33 Copyright (C) 1994-2011, OFFIS e.V. |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
34 All rights reserved. |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
722
diff
changeset
|
35 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
36 This software and supporting documentation were developed by |
766
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 OFFIS e.V. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
722
diff
changeset
|
39 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
|
40 Escherweg 2 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
722
diff
changeset
|
41 26121 Oldenburg, Germany |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
722
diff
changeset
|
42 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
43 Redistribution and use in source and binary forms, with or without |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
44 modification, are permitted provided that the following conditions |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
45 are met: |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
722
diff
changeset
|
46 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
47 - Redistributions of source code must retain the above copyright |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
722
diff
changeset
|
48 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
|
49 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
50 - Redistributions in binary form must reproduce the above copyright |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
722
diff
changeset
|
51 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
|
52 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
|
53 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
54 - Neither the name of OFFIS nor the names of its contributors may be |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
722
diff
changeset
|
55 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
|
56 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
|
57 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
58 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
59 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
60 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
61 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
62 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
63 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
64 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
65 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
66 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
67 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
68 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
722
diff
changeset
|
69 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
70 =========================================================================*/ |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
722
diff
changeset
|
71 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
722
diff
changeset
|
72 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
722
diff
changeset
|
73 |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
74 #include "../../PrecompiledHeaders.h" |
0 | 75 #include "FindScp.h" |
76 | |
3451 | 77 #include "../../DicomFormat/DicomArray.h" |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
78 #include "../../DicomParsing/FromDcmtkBridge.h" |
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
79 #include "../../DicomParsing/ToDcmtkBridge.h" |
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
80 #include "../../Logging.h" |
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
81 #include "../../OrthancException.h" |
0 | 82 |
1787
1b1d5470233f
refactoring of DicomFindAnswers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
83 #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
|
84 #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
|
85 |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
86 |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
87 |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
88 /** |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
89 * 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
|
90 * "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
|
91 **/ |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
92 |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
93 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
|
94 const DcmTagKey &sequenceTagKey) |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
95 // Date : May 3, 2005 |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
96 // Author : Thomas Wilkens |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
97 // 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
|
98 // 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
|
99 // 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
|
100 // 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
|
101 // 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
|
102 // 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
|
103 // 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
|
104 // this function does. |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
105 // 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
|
106 // 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
|
107 // Return Value : none. |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
108 { |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
109 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
|
110 |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
111 // 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
|
112 // 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
|
113 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
|
114 ( (DcmSequenceOfItems*)sequenceAttribute )->card() == 1 && |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
115 ( (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
|
116 referencedSOPClassUIDAttribute->getLength() == 0 && |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
117 ( (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
|
118 referencedSOPInstanceUIDAttribute->getLength() == 0 ) |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
119 { |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
120 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
|
121 delete item; |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
122 } |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
123 } |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
124 |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
125 |
0 | 126 |
62 | 127 namespace Orthanc |
0 | 128 { |
129 namespace | |
130 { | |
131 struct FindScpData | |
132 { | |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
133 IFindRequestHandler* findHandler_; |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
134 IWorklistRequestHandler* worklistHandler_; |
0 | 135 DicomFindAnswers answers_; |
136 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
|
137 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
|
138 const std::string* remoteAet_; |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1789
diff
changeset
|
139 const std::string* calledAet_; |
2059 | 140 |
4200 | 141 FindScpData() : |
142 findHandler_(NULL), | |
143 worklistHandler_(NULL), | |
144 answers_(false), | |
145 lastRequest_(NULL), | |
146 remoteIp_(NULL), | |
147 remoteAet_(NULL), | |
148 calledAet_(NULL) | |
2059 | 149 { |
150 } | |
0 | 151 }; |
152 | |
153 | |
2204
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
154 |
4203
4d42408da117
improving const-correctness in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4200
diff
changeset
|
155 static void FixWorklistQuery(ParsedDicomFile& query) |
2204
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
156 { |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
157 // TODO: Check out |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
158 // WlmDataSourceFileSystem::HandleExistentButEmptyDescriptionAndCodeSequenceAttributes()" |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
159 // 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
|
160 |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
161 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
|
162 HandleExistentButEmptyReferencedStudyOrPatientSequenceAttributes(dataset, DCM_ReferencedStudySequence); |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
163 HandleExistentButEmptyReferencedStudyOrPatientSequenceAttributes(dataset, DCM_ReferencedPatientSequence); |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
164 } |
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 |
3108
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
167 static void FixFindQuery(DicomMap& target, |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
168 const DicomMap& source) |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
169 { |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
170 // "The definition of a Data Set in PS3.5 specifically excludes |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
171 // the range of groups below group 0008, and this includes in |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
172 // particular Meta Information Header elements such as Transfer |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
173 // Syntax UID (0002,0010)." |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
174 // http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_C.4.html#sect_C.4.1.1.3 |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
175 // https://groups.google.com/d/msg/orthanc-users/D3kpPuX8yV0/_zgHOzkMEQAJ |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
176 |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
177 DicomArray a(source); |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
178 |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
179 for (size_t i = 0; i < a.GetSize(); i++) |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
180 { |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
181 if (a.GetElement(i).GetTag().GetGroup() >= 0x0008) |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
182 { |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
183 target.SetValue(a.GetElement(i).GetTag(), a.GetElement(i).GetValue()); |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
184 } |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
185 } |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
186 } |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
187 |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
188 |
2204
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
189 |
0 | 190 void FindScpCallback( |
191 /* in */ | |
192 void *callbackData, | |
193 OFBool cancelled, | |
194 T_DIMSE_C_FindRQ *request, | |
195 DcmDataset *requestIdentifiers, | |
196 int responseCount, | |
197 /* out */ | |
198 T_DIMSE_C_FindRSP *response, | |
199 DcmDataset **responseIdentifiers, | |
200 DcmDataset **statusDetail) | |
201 { | |
4286
526bd8bad850
debug logs for C-MOVE and C-GET SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4285
diff
changeset
|
202 assert(response != NULL); |
4285
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
203 assert(requestIdentifiers != NULL); |
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
204 |
5072
b23a4bb18065
replaced bzero() by memset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5044
diff
changeset
|
205 memset(response, 0, sizeof(T_DIMSE_C_FindRSP)); |
0 | 206 *statusDetail = NULL; |
207 | |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
208 std::string sopClassUid(request->AffectedSOPClassUID); |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
209 |
656 | 210 FindScpData& data = *reinterpret_cast<FindScpData*>(callbackData); |
0 | 211 if (data.lastRequest_ == NULL) |
212 { | |
4285
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
213 { |
4288 | 214 std::stringstream s; // DcmObject::PrintHelper cannot be used with VS2008 |
215 requestIdentifiers->print(s); | |
4285
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
216 CLOG(TRACE, DICOM) << "Received C-FIND Request:" << std::endl << s.str(); |
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
217 } |
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
218 |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
219 bool ok = false; |
0 | 220 |
221 try | |
222 { | |
2256
de1ba22fd28a
simplification wrt. modality manufacturers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
223 RemoteModalityParameters modality; |
de1ba22fd28a
simplification wrt. modality manufacturers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
224 |
de1ba22fd28a
simplification wrt. modality manufacturers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
225 /** |
de1ba22fd28a
simplification wrt. modality manufacturers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
226 * Ensure that the remote modality is known to Orthanc for C-FIND requests. |
de1ba22fd28a
simplification wrt. modality manufacturers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
227 **/ |
de1ba22fd28a
simplification wrt. modality manufacturers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
228 |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
229 if (sopClassUid == UID_FINDModalityWorklistInformationModel) |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
230 { |
2059 | 231 data.answers_.SetWorklist(true); |
232 | |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
233 if (data.worklistHandler_ != NULL) |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
234 { |
1788
6a2d507ef064
getting rid of opaque data structures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1787
diff
changeset
|
235 ParsedDicomFile query(*requestIdentifiers); |
2204
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
236 FixWorklistQuery(query); |
0158f2de8cad
Fix handling of worklist SCP with ReferencedStudySequence and ReferencedPatientSequence
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2131
diff
changeset
|
237 |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
238 data.worklistHandler_->Handle(data.answers_, query, |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
239 *data.remoteIp_, *data.remoteAet_, |
2256
de1ba22fd28a
simplification wrt. modality manufacturers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
240 *data.calledAet_, modality.GetManufacturer()); |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
241 ok = true; |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
242 } |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
243 else |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
244 { |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
245 CLOG(ERROR, DICOM) << "No worklist handler is installed, cannot handle this C-FIND request"; |
1786
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 } |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
248 else |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
249 { |
2059 | 250 data.answers_.SetWorklist(false); |
251 | |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
252 if (data.findHandler_ != NULL) |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
253 { |
1859
4e7c318a3f69
C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
254 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
|
255 |
4e7c318a3f69
C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
256 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
|
257 { |
4e7c318a3f69
C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
258 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
|
259 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
|
260 { |
4e7c318a3f69
C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
261 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
|
262 |
4e7c318a3f69
C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
263 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
|
264 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
|
265 { |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
266 CLOG(WARNING, DICOM) << "Orthanc only supports sequence matching on worklists, " |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
267 << "ignoring C-FIND SCU constraint on tag (" << tag.Format() |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
268 << ") " << 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
|
269 } |
4e7c318a3f69
C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
270 |
4e7c318a3f69
C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
271 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
|
272 } |
4e7c318a3f69
C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
273 } |
4e7c318a3f69
C-FIND SCP will return tags with sequence value representation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
274 |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
275 DicomMap input; |
4137
6774605d4341
keep only one signature for FromDcmtkBridge::ExtractDicomSummary()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4136
diff
changeset
|
276 std::set<DicomTag> ignoreTagLength; |
6774605d4341
keep only one signature for FromDcmtkBridge::ExtractDicomSummary()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4136
diff
changeset
|
277 FromDcmtkBridge::ExtractDicomSummary(input, *requestIdentifiers, 0 /* don't truncate tags */, ignoreTagLength); |
5044
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
278 input.RemoveSequences(); |
2125 | 279 |
3108
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
280 DicomMap filtered; |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
281 FixFindQuery(filtered, input); |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
282 |
55dacaf139ed
Don't consider tags whose group is below 0x0008 in C-FIND SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
283 data.findHandler_->Handle(data.answers_, filtered, sequencesToReturn, |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
284 *data.remoteIp_, *data.remoteAet_, |
2256
de1ba22fd28a
simplification wrt. modality manufacturers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
285 *data.calledAet_, modality.GetManufacturer()); |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
286 ok = true; |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
287 } |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
288 else |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
289 { |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
290 CLOG(ERROR, DICOM) << "No C-Find handler is installed, cannot handle this request"; |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
291 } |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
292 } |
0 | 293 } |
62 | 294 catch (OrthancException& e) |
0 | 295 { |
296 // Internal error! | |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
297 CLOG(ERROR, DICOM) << "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
|
298 } |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
299 |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
300 if (!ok) |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
301 { |
0 | 302 response->DimseStatus = STATUS_FIND_Failed_UnableToProcess; |
303 *responseIdentifiers = NULL; | |
304 return; | |
305 } | |
306 | |
307 data.lastRequest_ = requestIdentifiers; | |
308 } | |
309 else if (data.lastRequest_ != requestIdentifiers) | |
310 { | |
311 // Internal error! | |
312 response->DimseStatus = STATUS_FIND_Failed_UnableToProcess; | |
313 *responseIdentifiers = NULL; | |
314 return; | |
315 } | |
722 | 316 |
0 | 317 if (responseCount <= static_cast<int>(data.answers_.GetSize())) |
318 { | |
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
|
319 // There are pending results that are still to be sent |
0 | 320 response->DimseStatus = STATUS_Pending; |
1789 | 321 *responseIdentifiers = data.answers_.ExtractDcmDataset(responseCount - 1); |
4286
526bd8bad850
debug logs for C-MOVE and C-GET SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4285
diff
changeset
|
322 |
526bd8bad850
debug logs for C-MOVE and C-GET SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4285
diff
changeset
|
323 if (*responseIdentifiers) |
526bd8bad850
debug logs for C-MOVE and C-GET SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4285
diff
changeset
|
324 { |
4288 | 325 std::stringstream s; // DcmObject::PrintHelper cannot be used with VS2008 |
326 (*responseIdentifiers)->print(s); | |
4286
526bd8bad850
debug logs for C-MOVE and C-GET SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4285
diff
changeset
|
327 OFString str; |
526bd8bad850
debug logs for C-MOVE and C-GET SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4285
diff
changeset
|
328 CLOG(TRACE, DICOM) << "Sending C-FIND Response " |
526bd8bad850
debug logs for C-MOVE and C-GET SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4285
diff
changeset
|
329 << responseCount << "/" << data.answers_.GetSize() << ":" << std::endl |
526bd8bad850
debug logs for C-MOVE and C-GET SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4285
diff
changeset
|
330 << s.str(); |
526bd8bad850
debug logs for C-MOVE and C-GET SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4285
diff
changeset
|
331 } |
0 | 332 } |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
333 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
|
334 { |
83489fddd8c5
Options to limit the number of results for an incoming C-FIND query
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
335 // 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
|
336 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
|
337 *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
|
338 } |
0 | 339 else |
340 { | |
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
|
341 // Success, but the results were too numerous and had to be cropped |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
342 CLOG(WARNING, DICOM) << "Too many results for an incoming C-FIND query"; |
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
|
343 response->DimseStatus = STATUS_FIND_Cancel_MatchingTerminatedDueToCancelRequest; |
0 | 344 *responseIdentifiers = NULL; |
345 } | |
346 } | |
347 } | |
348 | |
349 | |
350 OFCondition Internals::findScp(T_ASC_Association * assoc, | |
351 T_DIMSE_Message * msg, | |
352 T_ASC_PresentationContextID presID, | |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
353 IFindRequestHandler* findHandler, |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
354 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
|
355 const std::string& remoteIp, |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1789
diff
changeset
|
356 const std::string& remoteAet, |
3704
58f92b1c8061
Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
357 const std::string& calledAet, |
58f92b1c8061
Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
358 int timeout) |
0 | 359 { |
360 FindScpData data; | |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
361 data.findHandler_ = findHandler; |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
362 data.worklistHandler_ = worklistHandler; |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2256
diff
changeset
|
363 data.lastRequest_ = NULL; |
1573
3309878b3e16
more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
364 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
|
365 data.remoteAet_ = &remoteAet; |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1789
diff
changeset
|
366 data.calledAet_ = &calledAet; |
0 | 367 |
368 OFCondition cond = DIMSE_findProvider(assoc, presID, &msg->msg.CFindRQ, | |
369 FindScpCallback, &data, | |
3704
58f92b1c8061
Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
370 /*opt_blockMode*/ (timeout ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), |
58f92b1c8061
Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
371 /*opt_dimse_timeout*/ timeout); |
0 | 372 |
373 // if some error occured, dump corresponding information and remove the outfile if necessary | |
374 if (cond.bad()) | |
375 { | |
376 OFString temp_str; | |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4203
diff
changeset
|
377 CLOG(ERROR, DICOM) << "Find SCP Failed: " << cond.text(); |
0 | 378 } |
379 | |
380 return cond; | |
381 } | |
382 } |