annotate OrthancFramework/Sources/Images/IImageWriter.cpp @ 4328:ce9284aebd40

new macro ORTHANC_DEPRECATED
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 25 Nov 2020 13:34:58 +0100
parents cb9aef006229
children d9473bd5ed43
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2083
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
3640
94f4a18a79cc upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
2083
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * 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
8 * 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
9 * 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
10 * the License, or (at your option) any later version.
2083
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * 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
15 * Lesser General Public License for more details.
2083
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
17 * 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
18 * 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
19 * <http://www.gnu.org/licenses/>.
2083
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 **/
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #include "IImageWriter.h"
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
2143
fd5875662670 creation of namespace SystemToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2140
diff changeset
25 #if ORTHANC_SANDBOXED == 0
fd5875662670 creation of namespace SystemToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2140
diff changeset
26 # include "../SystemToolbox.h"
fd5875662670 creation of namespace SystemToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2140
diff changeset
27 #endif
2083
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 namespace Orthanc
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 {
2170
baf8dd89b4e0 improved support for sandboxed environments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2143
diff changeset
31 #if ORTHANC_SANDBOXED == 0
2083
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 void IImageWriter::WriteToFileInternal(const std::string& path,
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 unsigned int width,
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 unsigned int height,
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 unsigned int pitch,
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 PixelFormat format,
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 const void* buffer)
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 {
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 std::string compressed;
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 WriteToMemoryInternal(compressed, width, height, pitch, format, buffer);
2140
aa4b8895cd23 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2139
diff changeset
41 SystemToolbox::WriteFile(compressed, path);
2170
baf8dd89b4e0 improved support for sandboxed environments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2143
diff changeset
42 }
2083
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 #endif
4297
785a2713323e abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
44
4311
cb9aef006229 turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4310
diff changeset
45 void IImageWriter::WriteToMemory(IImageWriter& writer,
cb9aef006229 turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4310
diff changeset
46 std::string &compressed,
4297
785a2713323e abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
47 const ImageAccessor &accessor)
785a2713323e abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
48 {
4311
cb9aef006229 turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4310
diff changeset
49 writer.WriteToMemoryInternal(compressed, accessor.GetWidth(), accessor.GetHeight(),
cb9aef006229 turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4310
diff changeset
50 accessor.GetPitch(), accessor.GetFormat(), accessor.GetConstBuffer());
4297
785a2713323e abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
51 }
785a2713323e abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
52
785a2713323e abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
53 #if ORTHANC_SANDBOXED == 0
4311
cb9aef006229 turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4310
diff changeset
54 void IImageWriter::WriteToFile(IImageWriter& writer,
cb9aef006229 turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4310
diff changeset
55 const std::string &path,
4297
785a2713323e abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
56 const ImageAccessor &accessor)
785a2713323e abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
57 {
4311
cb9aef006229 turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4310
diff changeset
58 writer.WriteToFileInternal(path, accessor.GetWidth(), accessor.GetHeight(),
cb9aef006229 turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4310
diff changeset
59 accessor.GetPitch(), accessor.GetFormat(), accessor.GetConstBuffer());
4297
785a2713323e abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
60 }
785a2713323e abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
61 #endif
2083
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 }