annotate OrthancStone/Sources/Volumes/ImageBuffer3D.h @ 2044:c9dadbe7c7b0 deep-learning

notes
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 05 Mar 2023 15:05:58 +0100
parents 7053b8a0aaec
children 07964689cb0b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1871
7053b8a0aaec upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1870
diff changeset
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium
7053b8a0aaec upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1870
diff changeset
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1564
diff changeset
9 * modify it under the terms of the GNU Lesser General Public License
47
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
10 * as published by the Free Software Foundation, either version 3 of
28956ed68280 agpl license
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 40
diff changeset
11 * the License, or (at your option) any later version.
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1564
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1564
diff changeset
16 * Lesser General Public License for more details.
318
3a4ca166fafa ImageAccessor refactoring + implemented Image Cache in SmartLoader
am@osimis.io
parents: 212
diff changeset
17 *
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1564
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1564
diff changeset
19 * License along with this program. If not, see
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1564
diff changeset
20 * <http://www.gnu.org/licenses/>.
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 **/
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #pragma once
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
194
7a031ac16b2d rename Enumerations.h to StoneEnumerations.h to avoid clashes with Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 192
diff changeset
26 #include "../StoneEnumerations.h"
735
c3bbb130abc4 removing dependencies in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 734
diff changeset
27 #include "../Toolbox/LinearAlgebra.h"
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
1455
30deba7bc8e2 simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1298
diff changeset
29 #include <Compatibility.h>
30deba7bc8e2 simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1298
diff changeset
30 #include <Images/Image.h>
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 namespace OrthancStone
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 {
1488
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
34 /*
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
35
1785
58bebc904191 notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1783
diff changeset
36 IMPORTANT: The "ImageBuffer3D" class is *not* meant to be accessed
58bebc904191 notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1783
diff changeset
37 directly by the end users using the "GetVoxelXXX()" methods,
58bebc904191 notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1783
diff changeset
38 because of the swapping of the Z-axis (see below). The public
58bebc904191 notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1783
diff changeset
39 interactions with this class should be limited to:
58bebc904191 notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1783
diff changeset
40
58bebc904191 notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1783
diff changeset
41 1- Using "SliceReader" and "SliceWriter" to access the raw slices,
58bebc904191 notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1783
diff changeset
42 but only on the axial projection, *and* using the "z"
58bebc904191 notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1783
diff changeset
43 coordinates returned by some "SlicesSorter" object
58bebc904191 notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1783
diff changeset
44
58bebc904191 notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1783
diff changeset
45 2- Extracting slices using a cutting plane through class deriving
58bebc904191 notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1783
diff changeset
46 from the "IVolumeSlicer" interface
58bebc904191 notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1783
diff changeset
47
58bebc904191 notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1783
diff changeset
48
58bebc904191 notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1783
diff changeset
49 IMPLEMENTATION NOTE: This classes stores volume images sliced across
58bebc904191 notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1783
diff changeset
50 the Z axis, vertically, in the DECREASING Z-order along the normal
58bebc904191 notes in ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1783
diff changeset
51 (this is the REVERSE of the intuitive order):
1488
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
52
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
53 +---------------+
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
54 | |
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
55 | SLICE N-1 |
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
56 | |
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
57 +---------------+
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
58 | |
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
59 | SLICE N-2 |
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
60 | |
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
61 +---------------+
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
62 | |
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
63 | SLICE N-3 |
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
64 | |
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
65 . .
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
66 ...... ......
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
67 . .
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
68 | |
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
69 | SLICE 2 |
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
70 | |
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
71 +---------------+
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
72 | |
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
73 | SLICE 1 |
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
74 | |
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
75 +---------------+
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
76 | |
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
77 | SLICE 0 |
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
78 | |
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
79 +---------------+
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
80
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
81 As you can see, if the 3d image has size width, height, depth, the 2d image has :
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
82 - 2d width = 3d width
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
83 - 2d height = 3d height * 3d depth
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
84
1783
75d3e2ab1fe1 BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1782
diff changeset
85 This explains the "depth_ - 1 - z" that are used throughout this class.
75d3e2ab1fe1 BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1782
diff changeset
86
75d3e2ab1fe1 BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1782
diff changeset
87 EXPLANATION: This allows to have the "SliceReader" and "SliceWriter"
75d3e2ab1fe1 BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1782
diff changeset
88 accessors for axial and coronal projections to directly access the
75d3e2ab1fe1 BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1782
diff changeset
89 same memory buffer (no memcpy is required), while being consistent
75d3e2ab1fe1 BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1782
diff changeset
90 with the Z-axis in coronal projection. The sagittal projection
75d3e2ab1fe1 BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1782
diff changeset
91 nevertheless needs a memcpy.
75d3e2ab1fe1 BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1782
diff changeset
92
1488
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
93 */
7f16987131e1 Missing include + docs + public getter for volume geometry in multiframe loader
Benjamin Golinvaux <bgo@osimis.io>
parents: 1455
diff changeset
94
53
c2dc924f1a63 removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 47
diff changeset
95 class ImageBuffer3D : public boost::noncopyable
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 private:
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 Orthanc::Image image_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 Orthanc::PixelFormat format_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 unsigned int width_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 unsigned int height_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 unsigned int depth_;
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
103 bool computeRange_;
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
104 bool hasRange_;
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
105 float minValue_;
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
106 float maxValue_;
683
dbc1d8bfc68a reorganizing ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 439
diff changeset
107 Matrix transform_;
dbc1d8bfc68a reorganizing ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 439
diff changeset
108 Matrix transformInverse_;
dbc1d8bfc68a reorganizing ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 439
diff changeset
109
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
110 void ExtendImageRange(const Orthanc::ImageAccessor& slice);
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111
316
ce48c3b3b0e9 fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
112 void GetAxialSliceAccessor(Orthanc::ImageAccessor& target,
ce48c3b3b0e9 fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
113 unsigned int slice,
1564
e731e62692a9 upgrading Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
114 bool readOnly);
316
ce48c3b3b0e9 fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
115
ce48c3b3b0e9 fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
116 void GetCoronalSliceAccessor(Orthanc::ImageAccessor& target,
ce48c3b3b0e9 fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
117 unsigned int slice,
1564
e731e62692a9 upgrading Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
118 bool readOnly);
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 Orthanc::Image* ExtractSagittalSlice(unsigned int slice) const;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121
1782
f053c80ea411 ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
122 void CommitSagittalSlice(unsigned int slice,
f053c80ea411 ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
123 const Orthanc::ImageAccessor& source);
f053c80ea411 ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
124
143
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
125 template <typename T>
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
126 T GetPixelUnchecked(unsigned int x,
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
127 unsigned int y,
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
128 unsigned int z) const
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
129 {
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
130 const uint8_t* buffer = reinterpret_cast<const uint8_t*>(image_.GetConstBuffer());
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
131 const uint8_t* row = buffer + (y + height_ * (depth_ - 1 - z)) * image_.GetPitch();
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
132 return reinterpret_cast<const T*>(row) [x];
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
133 }
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
134
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 public:
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 ImageBuffer3D(Orthanc::PixelFormat format,
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 unsigned int width,
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 unsigned int height,
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
139 unsigned int depth,
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
140 bool computeRange);
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 void Clear();
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143
179
db21c1810c89 moving PixelTraits to the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 149
diff changeset
144 const Orthanc::ImageAccessor& GetInternalImage() const
db21c1810c89 moving PixelTraits to the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 149
diff changeset
145 {
db21c1810c89 moving PixelTraits to the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 149
diff changeset
146 return image_;
db21c1810c89 moving PixelTraits to the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 149
diff changeset
147 }
db21c1810c89 moving PixelTraits to the Orthanc core
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 149
diff changeset
148
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 unsigned int GetWidth() const
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 return width_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 unsigned int GetHeight() const
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 return height_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 unsigned int GetDepth() const
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 return depth_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 Orthanc::PixelFormat GetFormat() const
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 return format_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168
765
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 735
diff changeset
169 unsigned int GetBytesPerPixel() const
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 735
diff changeset
170 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 735
diff changeset
171 return Orthanc::GetBytesPerPixel(format_);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 735
diff changeset
172 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 735
diff changeset
173
105
e0ddd8cad909 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
174 uint64_t GetEstimatedMemorySize() const;
e0ddd8cad909 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
175
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
176 bool GetRange(float& minValue,
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
177 float& maxValue) const;
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
178
143
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
179 uint8_t GetVoxelGrayscale8Unchecked(unsigned int x,
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
180 unsigned int y,
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
181 unsigned int z) const
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
182 {
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
183 return GetPixelUnchecked<uint8_t>(x, y, z);
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
184 }
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
185
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
186 uint16_t GetVoxelGrayscale16Unchecked(unsigned int x,
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
187 unsigned int y,
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
188 unsigned int z) const
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
189 {
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
190 return GetPixelUnchecked<uint16_t>(x, y, z);
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
191 }
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
192
149
f7be90de6d1b ImageBuffer3D::GetVoxelSignedGrayscale16Unchecked()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 143
diff changeset
193 int16_t GetVoxelSignedGrayscale16Unchecked(unsigned int x,
f7be90de6d1b ImageBuffer3D::GetVoxelSignedGrayscale16Unchecked()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 143
diff changeset
194 unsigned int y,
f7be90de6d1b ImageBuffer3D::GetVoxelSignedGrayscale16Unchecked()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 143
diff changeset
195 unsigned int z) const
f7be90de6d1b ImageBuffer3D::GetVoxelSignedGrayscale16Unchecked()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 143
diff changeset
196 {
f7be90de6d1b ImageBuffer3D::GetVoxelSignedGrayscale16Unchecked()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 143
diff changeset
197 return GetPixelUnchecked<int16_t>(x, y, z);
f7be90de6d1b ImageBuffer3D::GetVoxelSignedGrayscale16Unchecked()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 143
diff changeset
198 }
f7be90de6d1b ImageBuffer3D::GetVoxelSignedGrayscale16Unchecked()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 143
diff changeset
199
143
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
200 uint8_t GetVoxelGrayscale8(unsigned int x,
141
88bca952cb17 ImageBuffer3D::GetPixelGrayscale8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 139
diff changeset
201 unsigned int y,
88bca952cb17 ImageBuffer3D::GetPixelGrayscale8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 139
diff changeset
202 unsigned int z) const;
88bca952cb17 ImageBuffer3D::GetPixelGrayscale8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 139
diff changeset
203
143
58c545177c1c optimization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 141
diff changeset
204 uint16_t GetVoxelGrayscale16(unsigned int x,
139
22628d37ef5c ImageBuffer3D::GetPixelGrayscale16
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
205 unsigned int y,
22628d37ef5c ImageBuffer3D::GetPixelGrayscale16
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
206 unsigned int z) const;
22628d37ef5c ImageBuffer3D::GetPixelGrayscale16
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 135
diff changeset
207
684
7719eb852dd5 new class: VolumeImageGeometry
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 683
diff changeset
208
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 class SliceReader : public boost::noncopyable
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 private:
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 Orthanc::ImageAccessor accessor_;
1298
8a0a62189f46 replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1270
diff changeset
213 std::unique_ptr<Orthanc::Image> sagittal_; // Unused for axial and coronal
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 public:
192
371da7fe2c0e FiniteProjectiveCamera::ApplyRaytracer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 187
diff changeset
216 SliceReader(const ImageBuffer3D& that,
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 VolumeProjection projection,
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 unsigned int slice);
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 const Orthanc::ImageAccessor& GetAccessor() const
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 return accessor_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 };
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 class SliceWriter : public boost::noncopyable
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 private:
119
ba83e38cf3ff rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
230 ImageBuffer3D& that_;
87
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 53
diff changeset
231 bool modified_;
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 Orthanc::ImageAccessor accessor_;
1298
8a0a62189f46 replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1270
diff changeset
233 std::unique_ptr<Orthanc::Image> sagittal_; // Unused for axial and coronal
1782
f053c80ea411 ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
234 unsigned int slice_;
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 void Flush();
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 public:
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 SliceWriter(ImageBuffer3D& that,
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 VolumeProjection projection,
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 unsigned int slice);
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 ~SliceWriter()
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 {
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 Flush();
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247
87
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 53
diff changeset
248 const Orthanc::ImageAccessor& GetAccessor() const
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 53
diff changeset
249 {
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 53
diff changeset
250 return accessor_;
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 53
diff changeset
251 }
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 53
diff changeset
252
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 Orthanc::ImageAccessor& GetAccessor()
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 {
87
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 53
diff changeset
255 modified_ = true;
0
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 return accessor_;
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 }
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 };
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 };
351ab0da0150 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 }