comparison Framework/ImagedVolumeParameters.cpp @ 279:77afef2cf64b

automated extraction of the imaged volume if using OpenSlide
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 Jul 2023 18:06:34 +0200
parents 20a730889ae2
children 5fe243cef6e9
comparison
equal deleted inserted replaced
278:169f168ba07a 279:77afef2cf64b
25 25
26 #include <OrthancException.h> 26 #include <OrthancException.h>
27 27
28 namespace OrthancWSI 28 namespace OrthancWSI
29 { 29 {
30 ImagedVolumeParameters::ImagedVolumeParameters() 30 ImagedVolumeParameters::ImagedVolumeParameters() :
31 hasWidth_(false),
32 hasHeight_(false)
31 { 33 {
32 // Typical parameters of a specimen millimeters 34 // Typical parameters for a specimen, in millimeters
33 width_ = 15;
34 height_ = 15;
35 depth_ = 1; 35 depth_ = 1;
36 offsetX_ = 20; 36 offsetX_ = 20;
37 offsetY_ = 40; 37 offsetY_ = 40;
38 }
39
40
41 float ImagedVolumeParameters::GetWidth() const
42 {
43 if (hasWidth_)
44 {
45 return width_;
46 }
47 else
48 {
49 return 15; // Typical width of a specimen
50 }
51 }
52
53
54 float ImagedVolumeParameters::GetHeight() const
55 {
56 if (hasHeight_)
57 {
58 return height_;
59 }
60 else
61 {
62 return 15; // Typical height of a specimen
63 }
38 } 64 }
39 65
40 66
41 void ImagedVolumeParameters::SetWidth(float width) 67 void ImagedVolumeParameters::SetWidth(float width)
42 { 68 {
43 if (width <= 0) 69 if (width <= 0)
44 { 70 {
45 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); 71 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
46 } 72 }
47 73 else
48 width_ = width; 74 {
75 width_ = width;
76 hasWidth_ = true;
77 }
49 } 78 }
50 79
51 80
52 void ImagedVolumeParameters::SetHeight(float height) 81 void ImagedVolumeParameters::SetHeight(float height)
53 { 82 {
54 if (height <= 0) 83 if (height <= 0)
55 { 84 {
56 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); 85 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
57 } 86 }
58 87 else
59 height_ = height; 88 {
89 height_ = height;
90 hasHeight_ = true;
91 }
60 } 92 }
61 93
62 94
63 void ImagedVolumeParameters::SetDepth(float depth) 95 void ImagedVolumeParameters::SetDepth(float depth)
64 { 96 {