Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Toolbox/SlicesSorter.h @ 1512:244ad1e4e76a
reorganization of folders
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 07 Jul 2020 16:21:02 +0200 |
parents | Framework/Toolbox/SlicesSorter.h@30deba7bc8e2 |
children | 4fb8fdf03314 |
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 | |
1270
2d8ab34c8c91
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1015
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
73 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
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 | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
647
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
24 #include "CoordinateSystem3D.h" |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
25 |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1279
diff
changeset
|
26 #include <IDynamicObject.h> |
73 | 27 |
28 namespace OrthancStone | |
29 { | |
647
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
30 // TODO - Rename this as "PlanesSorter" |
73 | 31 class SlicesSorter : public boost::noncopyable |
32 { | |
33 private: | |
34 class SliceWithDepth; | |
35 struct Comparator; | |
36 | |
37 typedef std::vector<SliceWithDepth*> Slices; | |
38 | |
39 Slices slices_; | |
40 bool hasNormal_; | |
41 | |
647
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
42 const SliceWithDepth& GetSlice(size_t i) const; |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
43 |
648 | 44 void SetNormal(const Vector& normal); |
45 | |
46 void SortInternal(); | |
47 | |
48 void FilterNormal(const Vector& normal); | |
49 | |
50 bool SelectNormal(Vector& normal) const; | |
51 | |
73 | 52 public: |
53 SlicesSorter() : hasNormal_(false) | |
54 { | |
55 } | |
56 | |
57 ~SlicesSorter(); | |
58 | |
59 void Reserve(size_t count) | |
60 { | |
61 slices_.reserve(count); | |
62 } | |
63 | |
647
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
64 void AddSlice(const CoordinateSystem3D& plane) |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
65 { |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
66 AddSlice(plane, NULL); |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
67 } |
73 | 68 |
647
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
69 void AddSlice(const CoordinateSystem3D& plane, |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
70 Orthanc::IDynamicObject* payload); // Takes ownership |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
71 |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
72 size_t GetSlicesCount() const |
73 | 73 { |
74 return slices_.size(); | |
75 } | |
76 | |
647
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
77 const CoordinateSystem3D& GetSliceGeometry(size_t i) const; |
73 | 78 |
647
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
79 bool HasSlicePayload(size_t i) const; |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
80 |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
81 const Orthanc::IDynamicObject& GetSlicePayload(size_t i) const; |
648 | 82 |
661 | 83 // WARNING - Apply the sorting algorithm can reduce the number of |
84 // slices. This is notably the case if all the slices are not | |
85 // parallel to the reference normal that will be selected. | |
648 | 86 bool Sort(); |
683
dbc1d8bfc68a
reorganizing ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
667
diff
changeset
|
87 |
dbc1d8bfc68a
reorganizing ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
667
diff
changeset
|
88 // TODO - Remove this |
647
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
89 bool LookupClosestSlice(size_t& index, |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
90 double& distance, |
6af3099ed8da
uncoupling OrthancStone::SlicesSorter from OrthancStone::Slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
439
diff
changeset
|
91 const CoordinateSystem3D& slice) const; |
667
e9339f2b5de7
refactoring of VolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
661
diff
changeset
|
92 |
e9339f2b5de7
refactoring of VolumeImage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
661
diff
changeset
|
93 // 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
|
94 bool ComputeSpacingBetweenSlices(double& spacing /* out */) const; |
1015
24fecc02bfb1
SlicesSorter::AreAllSlicesDistinct()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
683
diff
changeset
|
95 |
24fecc02bfb1
SlicesSorter::AreAllSlicesDistinct()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
683
diff
changeset
|
96 // WARNING - The slices must have been sorted before calling this method |
24fecc02bfb1
SlicesSorter::AreAllSlicesDistinct()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
683
diff
changeset
|
97 bool AreAllSlicesDistinct() const; |
73 | 98 }; |
99 } |