annotate Core/DicomParsing/MemoryBufferTranscoder.cpp @ 3904:c62f84c7eda9 transcoding

fixing incorrect behavior in MemoryBufferTranscoder
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 07 May 2020 17:21:20 +0200
parents 8f7ad4989fec
children 061f3d031b5d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3893
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * In addition, as a special exception, the copyright holders of this
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * program give permission to link the code of its release with the
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * the linked executables. You must obey the GNU General Public License
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * in all respects for all of the code used other than "OpenSSL". If you
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * modify file(s) with this exception, you may extend this exception to
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * your version of the file(s), but you are not obligated to do so. If
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * you do not wish to do so, delete this exception statement from your
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * version. If you delete this exception statement from all source files
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * in the program, then also delete it here.
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 *
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful, but
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * General Public License for more details.
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 *
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 **/
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #include "../PrecompiledHeaders.h"
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #include "MemoryBufferTranscoder.h"
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #include "../OrthancException.h"
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 #include "FromDcmtkBridge.h"
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 namespace Orthanc
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 {
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
42 MemoryBufferTranscoder::MemoryBufferTranscoder()
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
43 {
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
44 #if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
45 useDcmtk_ = true;
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
46 #else
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
47 useDcmtk_ = false;
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
48 #endif
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
49 }
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
50
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
51
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
52 void MemoryBufferTranscoder::SetDcmtkUsed(bool used)
3893
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 {
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 #if ORTHANC_ENABLE_DCMTK_TRANSCODING != 1
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
55 if (useDcmtk)
3893
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 {
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 throw OrthancException(ErrorCode_NotImplemented,
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 "Orthanc was built without support for DMCTK transcoding");
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 }
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 #endif
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
61
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
62 useDcmtk_ = used;
3893
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 }
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
65
3893
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 bool MemoryBufferTranscoder::TranscodeToBuffer(std::string& target,
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
67 bool& hasSopInstanceUidChanged,
3893
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 const void* buffer,
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 size_t size,
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 const std::set<DicomTransferSyntax>& allowedSyntaxes,
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 bool allowNewSopInstanceUid)
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 {
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 #if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
74 if (useDcmtk_)
3893
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 {
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
76 return dcmtk_.TranscodeToBuffer(target, hasSopInstanceUidChanged, buffer, size, allowedSyntaxes, allowNewSopInstanceUid);
3893
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 }
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 else
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 #endif
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 {
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
81 return Transcode(target, hasSopInstanceUidChanged, buffer, size, allowedSyntaxes, allowNewSopInstanceUid);
3893
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 }
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 }
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
86 DcmFileFormat* MemoryBufferTranscoder::TranscodeToParsed(bool& hasSopInstanceUidChanged,
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
87 const void* buffer,
3893
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 size_t size,
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 const std::set<DicomTransferSyntax>& allowedSyntaxes,
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 bool allowNewSopInstanceUid)
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 {
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 #if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
93 if (useDcmtk_)
3893
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 {
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
95 return dcmtk_.TranscodeToParsed(hasSopInstanceUidChanged, buffer, size, allowedSyntaxes, allowNewSopInstanceUid);
3893
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 }
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 else
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 #endif
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 {
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 std::string transcoded;
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
101 if (Transcode(transcoded, hasSopInstanceUidChanged, buffer, size, allowedSyntaxes, allowNewSopInstanceUid))
3893
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 {
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 return FromDcmtkBridge::LoadFromMemoryBuffer(
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 transcoded.empty() ? NULL : transcoded.c_str(), transcoded.size());
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 }
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 else
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 {
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 return NULL;
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 }
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 }
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 }
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113
3904
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
114 bool MemoryBufferTranscoder::HasInplaceTranscode(
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
115 DicomTransferSyntax inputSyntax,
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
116 const std::set<DicomTransferSyntax>& outputSyntaxes) const
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
117 {
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
118 /**
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
119 * Inplace transcoding is only possible if DCMTK is enabled, and
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
120 * if DCMTK supports all the requested transfer
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
121 * syntaxes. Otherwise, one has to call the "buffer-to-buffer"
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
122 * transcoder.
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
123 **/
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
124
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
125 #if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
126 if (useDcmtk_)
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
127 {
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
128 if (!DcmtkTranscoder::IsSupported(inputSyntax))
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
129 {
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
130 return false;
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
131 }
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
132
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
133 for (std::set<DicomTransferSyntax>::const_iterator
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
134 it = outputSyntaxes.begin(); it != outputSyntaxes.end(); ++it)
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
135 {
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
136 if (!DcmtkTranscoder::IsSupported(*it))
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
137 {
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
138 return false;
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
139 }
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
140 }
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
141
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
142 return true;
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
143 }
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
144 else
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
145 #endif
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
146 {
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
147 return false;
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
148 }
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
149 }
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
150
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
151
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
152 bool MemoryBufferTranscoder::InplaceTranscode(bool& hasSopInstanceUidChanged,
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
153 DcmFileFormat& dicom,
3893
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 const std::set<DicomTransferSyntax>& allowedSyntaxes,
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 bool allowNewSopInstanceUid)
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 {
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 #if ORTHANC_ENABLE_DCMTK_TRANSCODING == 1
3904
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
158 DicomTransferSyntax inputSyntax;
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
159 if (useDcmtk_ &&
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
160 FromDcmtkBridge::LookupOrthancTransferSyntax(inputSyntax, dicom) &&
c62f84c7eda9 fixing incorrect behavior in MemoryBufferTranscoder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3894
diff changeset
161 HasInplaceTranscode(inputSyntax, allowedSyntaxes))
3893
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 {
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3893
diff changeset
163 return dcmtk_.InplaceTranscode(hasSopInstanceUidChanged, dicom, allowedSyntaxes, allowNewSopInstanceUid);
3893
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 }
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 else
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 #endif
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 {
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 // "HasInplaceTranscode()" should have been called
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 throw OrthancException(ErrorCode_BadSequenceOfCalls);
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 }
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 }
7a5fa8f307e9 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 }