Mercurial > hg > orthanc-stone
comparison Framework/Volumes/ImageBuffer3D.cpp @ 139:22628d37ef5c wasm
ImageBuffer3D::GetPixelGrayscale16
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 16 Jan 2018 17:44:16 +0100 |
parents | e2fe9352f240 |
children | 88bca952cb17 |
comparison
equal
deleted
inserted
replaced
138:77c4fef7f4a5 | 139:22628d37ef5c |
---|---|
156 GeometryToolbox::AssignVector(voxelDimensions_, x, y, z); | 156 GeometryToolbox::AssignVector(voxelDimensions_, x, y, z); |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 | 160 |
161 Vector ImageBuffer3D::GetVoxelDimensions(VolumeProjection projection) | 161 Vector ImageBuffer3D::GetVoxelDimensions(VolumeProjection projection) const |
162 { | 162 { |
163 Vector result; | 163 Vector result; |
164 switch (projection) | 164 switch (projection) |
165 { | 165 { |
166 case VolumeProjection_Axial: | 166 case VolumeProjection_Axial: |
208 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | 208 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
209 } | 209 } |
210 } | 210 } |
211 | 211 |
212 | 212 |
213 ParallelSlices* ImageBuffer3D::GetGeometry(VolumeProjection projection) | 213 ParallelSlices* ImageBuffer3D::GetGeometry(VolumeProjection projection) const |
214 { | 214 { |
215 std::auto_ptr<ParallelSlices> result(new ParallelSlices); | 215 std::auto_ptr<ParallelSlices> result(new ParallelSlices); |
216 | 216 |
217 switch (projection) | 217 switch (projection) |
218 { | 218 { |
418 | 418 |
419 default: | 419 default: |
420 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | 420 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
421 } | 421 } |
422 } | 422 } |
423 | |
424 | |
425 uint16_t ImageBuffer3D::GetPixelGrayscale16(unsigned int x, | |
426 unsigned int y, | |
427 unsigned int z) const | |
428 { | |
429 if (format_ != Orthanc::PixelFormat_Grayscale16) | |
430 { | |
431 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat); | |
432 } | |
433 | |
434 if (x >= width_ || | |
435 y >= height_ || | |
436 z >= depth_) | |
437 { | |
438 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | |
439 } | |
440 | |
441 const void* p = image_.GetConstRow(y + height_ * (depth_ - 1 - z)); | |
442 | |
443 return reinterpret_cast<const uint16_t*>(p) [x]; | |
444 } | |
445 | |
423 } | 446 } |