Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Volumes/ImageBuffer3D.cpp @ 1564:e731e62692a9
upgrading Orthanc framework
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 17 Sep 2020 15:18:21 +0200 |
parents | 244ad1e4e76a |
children | 8563ea5d8ae4 |
comparison
equal
deleted
inserted
replaced
1563:e0045462a25c | 1564:e731e62692a9 |
---|---|
29 | 29 |
30 namespace OrthancStone | 30 namespace OrthancStone |
31 { | 31 { |
32 void ImageBuffer3D::GetAxialSliceAccessor(Orthanc::ImageAccessor& target, | 32 void ImageBuffer3D::GetAxialSliceAccessor(Orthanc::ImageAccessor& target, |
33 unsigned int slice, | 33 unsigned int slice, |
34 bool readOnly) const | 34 bool readOnly) |
35 { | 35 { |
36 if (slice >= depth_) | 36 if (slice >= depth_) |
37 { | 37 { |
38 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | 38 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
39 } | 39 } |
51 } | 51 } |
52 | 52 |
53 | 53 |
54 void ImageBuffer3D::GetCoronalSliceAccessor(Orthanc::ImageAccessor& target, | 54 void ImageBuffer3D::GetCoronalSliceAccessor(Orthanc::ImageAccessor& target, |
55 unsigned int slice, | 55 unsigned int slice, |
56 bool readOnly) const | 56 bool readOnly) |
57 { | 57 { |
58 if (slice >= height_) | 58 if (slice >= height_) |
59 { | 59 { |
60 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | 60 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
61 } | 61 } |
201 | 201 |
202 ImageBuffer3D::SliceReader::SliceReader(const ImageBuffer3D& that, | 202 ImageBuffer3D::SliceReader::SliceReader(const ImageBuffer3D& that, |
203 VolumeProjection projection, | 203 VolumeProjection projection, |
204 unsigned int slice) | 204 unsigned int slice) |
205 { | 205 { |
206 /** | |
207 * NB: The "const_cast" below are OK, as the "readonly" argument | |
208 * to "GetAxialSliceAccessor()" and "GetCoronalSliceAccessor()" | |
209 * are set to "true", which implies read-only access. | |
210 **/ | |
211 | |
206 switch (projection) | 212 switch (projection) |
207 { | 213 { |
208 case VolumeProjection_Axial: | 214 case VolumeProjection_Axial: |
209 that.GetAxialSliceAccessor(accessor_, slice, true); | 215 const_cast<ImageBuffer3D&>(that).GetAxialSliceAccessor(accessor_, slice, true); |
210 break; | 216 break; |
211 | 217 |
212 case VolumeProjection_Coronal: | 218 case VolumeProjection_Coronal: |
213 that.GetCoronalSliceAccessor(accessor_, slice, true); | 219 const_cast<ImageBuffer3D&>(that).GetCoronalSliceAccessor(accessor_, slice, true); |
214 break; | 220 break; |
215 | 221 |
216 case VolumeProjection_Sagittal: | 222 case VolumeProjection_Sagittal: |
217 sagittal_.reset(that.ExtractSagittalSlice(slice)); | 223 sagittal_.reset(that.ExtractSagittalSlice(slice)); |
218 sagittal_->GetReadOnlyAccessor(accessor_); | 224 sagittal_->GetReadOnlyAccessor(accessor_); |