Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Toolbox/SlicesSorter.h @ 1961:cbf54cd28d59
added CoordinateSystem3D::GetOrientationMarkers()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 27 Oct 2022 18:43:20 +0200 |
parents | 7053b8a0aaec |
children | 07964689cb0b |
rev | line source |
---|---|
73 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
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 |
73 | 7 * |
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:
1596
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
73 | 10 * as published by the Free Software Foundation, either version 3 of |
11 * the License, or (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, but | |
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:
1596
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:
1596
diff
changeset
|
16 * Lesser General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
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:
1596
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:
1596
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:
1596
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
73 | 21 **/ |
22 | |
23 | |
24 #pragma once | |
25 | |
647
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
26 #include "CoordinateSystem3D.h" |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
27 |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1279
diff
changeset
|
28 #include <IDynamicObject.h> |
73 | 29 |
30 namespace OrthancStone | |
31 { | |
1642
5cc589bfb385
lazy computation of DicomInstanceParameters::GetImageInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
32 // TODO - Replace this with "SortedFrames" |
73 | 33 class SlicesSorter : public boost::noncopyable |
34 { | |
35 private: | |
36 class SliceWithDepth; | |
37 struct Comparator; | |
38 | |
39 typedef std::vector<SliceWithDepth*> Slices; | |
40 | |
41 Slices slices_; | |
42 bool hasNormal_; | |
43 | |
647
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
44 const SliceWithDepth& GetSlice(size_t i) const; |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
45 |
648 | 46 void SetNormal(const Vector& normal); |
47 | |
48 void SortInternal(); | |
49 | |
50 void FilterNormal(const Vector& normal); | |
51 | |
52 bool SelectNormal(Vector& normal) const; | |
53 | |
73 | 54 public: |
55 SlicesSorter() : hasNormal_(false) | |
56 { | |
57 } | |
58 | |
59 ~SlicesSorter(); | |
60 | |
61 void Reserve(size_t count) | |
62 { | |
63 slices_.reserve(count); | |
64 } | |
65 | |
647
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
66 void AddSlice(const CoordinateSystem3D& plane) |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
67 { |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
68 AddSlice(plane, NULL); |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
69 } |
73 | 70 |
647
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
71 void AddSlice(const CoordinateSystem3D& plane, |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
72 Orthanc::IDynamicObject* payload); // Takes ownership |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
73 |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
74 size_t GetSlicesCount() const |
73 | 75 { |
76 return slices_.size(); | |
77 } | |
78 | |
647
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
79 const CoordinateSystem3D& GetSliceGeometry(size_t i) const; |
73 | 80 |
647
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
81 bool HasSlicePayload(size_t i) const; |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
82 |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
83 const Orthanc::IDynamicObject& GetSlicePayload(size_t i) const; |
648 | 84 |
661 | 85 // WARNING - Apply the sorting algorithm can reduce the number of |
86 // slices. This is notably the case if all the slices are not | |
87 // parallel to the reference normal that will be selected. | |
648 | 88 bool Sort(); |
683
dbc1d8bfc68a
reorganizing ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
667
diff
changeset
|
89 |
667
e9339f2b5de7
refactoring of VolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
661
diff
changeset
|
90 // WARNING - The slices must have been sorted before calling this method |
1156
34ee7204fde3
removing IGeometryProvider
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1015
diff
changeset
|
91 bool ComputeSpacingBetweenSlices(double& spacing /* out */) const; |
1015
24fecc02bfb1
SlicesSorter::AreAllSlicesDistinct()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
683
diff
changeset
|
92 |
24fecc02bfb1
SlicesSorter::AreAllSlicesDistinct()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
683
diff
changeset
|
93 // WARNING - The slices must have been sorted before calling this method |
24fecc02bfb1
SlicesSorter::AreAllSlicesDistinct()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
683
diff
changeset
|
94 bool AreAllSlicesDistinct() const; |
73 | 95 }; |
96 } |