Mercurial > hg > orthanc-stone
comparison Framework/Toolbox/SlicesSorter.cpp @ 119:ba83e38cf3ff wasm
rendering of rt-dose
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 02 Oct 2017 22:01:41 +0200 |
parents | 2eca030792aa |
children | e2fe9352f240 |
comparison
equal
deleted
inserted
replaced
118:a4d0b6c82b29 | 119:ba83e38cf3ff |
---|---|
26 namespace OrthancStone | 26 namespace OrthancStone |
27 { | 27 { |
28 class SlicesSorter::SliceWithDepth : public boost::noncopyable | 28 class SlicesSorter::SliceWithDepth : public boost::noncopyable |
29 { | 29 { |
30 private: | 30 private: |
31 Slice slice_; | 31 std::auto_ptr<Slice> slice_; |
32 double depth_; | 32 double depth_; |
33 | 33 |
34 public: | 34 public: |
35 SliceWithDepth(const Slice& slice) : | 35 SliceWithDepth(Slice* slice) : |
36 slice_(slice), | 36 slice_(slice), |
37 depth_(0) | 37 depth_(0) |
38 { | 38 { |
39 if (slice == NULL) | |
40 { | |
41 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); | |
42 } | |
39 } | 43 } |
40 | 44 |
41 void SetNormal(const Vector& normal) | 45 void SetNormal(const Vector& normal) |
42 { | 46 { |
47 assert(slice_.get() != NULL); | |
43 depth_ = boost::numeric::ublas::inner_prod | 48 depth_ = boost::numeric::ublas::inner_prod |
44 (slice_.GetGeometry().GetOrigin(), normal); | 49 (slice_->GetGeometry().GetOrigin(), normal); |
45 } | 50 } |
46 | 51 |
47 double GetDepth() const | 52 double GetDepth() const |
48 { | 53 { |
49 return depth_; | 54 return depth_; |
50 } | 55 } |
51 | 56 |
52 const Slice& GetSlice() const | 57 const Slice& GetSlice() const |
53 { | 58 { |
54 return slice_; | 59 assert(slice_.get() != NULL); |
60 return *slice_; | |
55 } | 61 } |
56 }; | 62 }; |
57 | 63 |
58 | 64 |
59 struct SlicesSorter::Comparator | 65 struct SlicesSorter::Comparator |
74 delete slices_[i]; | 80 delete slices_[i]; |
75 } | 81 } |
76 } | 82 } |
77 | 83 |
78 | 84 |
79 void SlicesSorter::AddSlice(const Slice& slice) | 85 void SlicesSorter::AddSlice(Slice* slice) |
80 { | 86 { |
81 slices_.push_back(new SliceWithDepth(slice)); | 87 slices_.push_back(new SliceWithDepth(slice)); |
82 } | 88 } |
83 | 89 |
84 | 90 |