Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Volumes/DicomVolumeImage.cpp @ 1741:62377949e739
todo
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 19 Jan 2021 16:12:43 +0100 |
parents | 9ac2a65d4172 |
children | 3889ae96d2e9 |
rev | line source |
---|---|
814 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1739
9ac2a65d4172
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1624
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
814 | 6 * |
7 * 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:
1596
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public License |
814 | 9 * as published by the Free Software Foundation, either version 3 of |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * 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:
1596
diff
changeset
|
14 * 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:
1596
diff
changeset
|
15 * Lesser General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
16 * |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
17 * 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:
1596
diff
changeset
|
18 * 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:
1596
diff
changeset
|
19 * <http://www.gnu.org/licenses/>. |
814 | 20 **/ |
21 | |
22 | |
23 #include "DicomVolumeImage.h" | |
24 | |
1624 | 25 #include <Logging.h> |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
26 #include <OrthancException.h> |
814 | 27 |
949
32eaf4929b08
OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader now implement IGeometryProvider so that the geometry reference can be switched (CT or DOSE, for instance) + VolumeImageGeometry::SetSize renamed to VolumeImageGeometry::SetSizeInVoxels + prevent text layer update if text or properties do not change + a few stream operator<< for debug (Vector, Matrix,...) + fixed memory access aligment issues in ImageBuffer3D::ExtractSagittalSlice + fix for wrong screen Y offset of mpr slices in DicomVolumeImageMPRSlicer.
Benjamin Golinvaux <bgo@osimis.io>
parents:
814
diff
changeset
|
28 |
814 | 29 namespace OrthancStone |
30 { | |
31 void DicomVolumeImage::CheckHasGeometry() const | |
32 { | |
33 if (!HasGeometry()) | |
34 { | |
956
a7351ad54960
Made IsContextLost automatically set the flag by checking with the emscripten
Benjamin Golinvaux <bgo@osimis.io>
parents:
949
diff
changeset
|
35 LOG(ERROR) << "DicomVolumeImage::CheckHasGeometry(): (!HasGeometry())"; |
814 | 36 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); |
37 } | |
38 } | |
39 | |
40 | |
1072
391fb6d6905d
OrthancMultiframeVolumeLoader asks volume image to compute range +
Benjamin Golinvaux <bgo@osimis.io>
parents:
1048
diff
changeset
|
41 void DicomVolumeImage::Initialize( |
391fb6d6905d
OrthancMultiframeVolumeLoader asks volume image to compute range +
Benjamin Golinvaux <bgo@osimis.io>
parents:
1048
diff
changeset
|
42 const VolumeImageGeometry& geometry, |
391fb6d6905d
OrthancMultiframeVolumeLoader asks volume image to compute range +
Benjamin Golinvaux <bgo@osimis.io>
parents:
1048
diff
changeset
|
43 Orthanc::PixelFormat format, |
391fb6d6905d
OrthancMultiframeVolumeLoader asks volume image to compute range +
Benjamin Golinvaux <bgo@osimis.io>
parents:
1048
diff
changeset
|
44 bool computeRange) |
814 | 45 { |
46 geometry_.reset(new VolumeImageGeometry(geometry)); | |
47 image_.reset(new ImageBuffer3D(format, geometry_->GetWidth(), geometry_->GetHeight(), | |
1072
391fb6d6905d
OrthancMultiframeVolumeLoader asks volume image to compute range +
Benjamin Golinvaux <bgo@osimis.io>
parents:
1048
diff
changeset
|
48 geometry_->GetDepth(), computeRange)); |
814 | 49 |
50 revision_ ++; | |
51 } | |
52 | |
53 | |
54 void DicomVolumeImage::SetDicomParameters(const DicomInstanceParameters& parameters) | |
55 { | |
56 parameters_.reset(parameters.Clone()); | |
57 revision_ ++; | |
58 } | |
59 | |
60 | |
61 bool DicomVolumeImage::HasGeometry() const | |
62 { | |
63 return (geometry_.get() != NULL && | |
64 image_.get() != NULL); | |
65 } | |
66 | |
67 | |
68 ImageBuffer3D& DicomVolumeImage::GetPixelData() | |
69 { | |
70 CheckHasGeometry(); | |
71 return *image_; | |
72 } | |
73 | |
74 | |
75 const ImageBuffer3D& DicomVolumeImage::GetPixelData() const | |
76 { | |
77 CheckHasGeometry(); | |
78 return *image_; | |
79 } | |
80 | |
81 | |
82 const VolumeImageGeometry& DicomVolumeImage::GetGeometry() const | |
83 { | |
84 CheckHasGeometry(); | |
85 return *geometry_; | |
86 } | |
87 | |
88 | |
89 const DicomInstanceParameters& DicomVolumeImage::GetDicomParameters() const | |
90 { | |
91 if (HasDicomParameters()) | |
92 { | |
93 return *parameters_; | |
94 } | |
95 else | |
96 { | |
956
a7351ad54960
Made IsContextLost automatically set the flag by checking with the emscripten
Benjamin Golinvaux <bgo@osimis.io>
parents:
949
diff
changeset
|
97 LOG(ERROR) << "DicomVolumeImage::GetDicomParameters(): (!HasDicomParameters())"; |
814 | 98 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); |
99 } | |
100 } | |
101 } |