annotate OrthancFramework/Sources/Images/IImageWriter.cpp @ 5351:39fb52298083 Orthanc-1.11.3

closing branch Orthanc-1.11.3
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 04 Jul 2023 12:21:14 +0200
parents 43e613a7756b
children 0ea402b4d901
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
4870
43e613a7756b upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium
43e613a7756b upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
2083
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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.
2083
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * 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
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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.
2083
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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/>.
2083
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
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "IImageWriter.h"
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
2143
fd5875662670 creation of namespace SystemToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2140
diff changeset
26 #if ORTHANC_SANDBOXED == 0
fd5875662670 creation of namespace SystemToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2140
diff changeset
27 # include "../SystemToolbox.h"
fd5875662670 creation of namespace SystemToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2140
diff changeset
28 #endif
2083
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 namespace Orthanc
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 {
2170
baf8dd89b4e0 improved support for sandboxed environments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2143
diff changeset
32 #if ORTHANC_SANDBOXED == 0
2083
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 void IImageWriter::WriteToFileInternal(const std::string& path,
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 unsigned int width,
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 unsigned int height,
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 unsigned int pitch,
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 PixelFormat format,
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 const void* buffer)
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 {
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 std::string compressed;
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 WriteToMemoryInternal(compressed, width, height, pitch, format, buffer);
2140
aa4b8895cd23 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2139
diff changeset
42 SystemToolbox::WriteFile(compressed, path);
2170
baf8dd89b4e0 improved support for sandboxed environments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2143
diff changeset
43 }
2083
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 #endif
4297
785a2713323e abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
45
4311
cb9aef006229 turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4310
diff changeset
46 void IImageWriter::WriteToMemory(IImageWriter& writer,
cb9aef006229 turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4310
diff changeset
47 std::string &compressed,
4297
785a2713323e abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
48 const ImageAccessor &accessor)
785a2713323e abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
49 {
4311
cb9aef006229 turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4310
diff changeset
50 writer.WriteToMemoryInternal(compressed, accessor.GetWidth(), accessor.GetHeight(),
cb9aef006229 turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4310
diff changeset
51 accessor.GetPitch(), accessor.GetFormat(), accessor.GetConstBuffer());
4297
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
785a2713323e abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
54 #if ORTHANC_SANDBOXED == 0
4311
cb9aef006229 turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4310
diff changeset
55 void IImageWriter::WriteToFile(IImageWriter& writer,
cb9aef006229 turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4310
diff changeset
56 const std::string &path,
4297
785a2713323e abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
57 const ImageAccessor &accessor)
785a2713323e abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
58 {
4311
cb9aef006229 turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4310
diff changeset
59 writer.WriteToFileInternal(path, accessor.GetWidth(), accessor.GetHeight(),
cb9aef006229 turning IImageWriter into a pure interface
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4310
diff changeset
60 accessor.GetPitch(), accessor.GetFormat(), accessor.GetConstBuffer());
4297
785a2713323e abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
61 }
785a2713323e abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
62 #endif
2083
bfeacb51af20 cleaning up code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 }