comparison Framework/Scene2D/LookupTableTextureSceneLayer.cpp @ 1080:287ec78f63b4

GenericToolbox (fast c-string --> double or integer) + refactoring to be able to set structures lut into configurator + fixed missing revision bump in configurator + UT
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 21 Oct 2019 16:01:29 +0200
parents 391fb6d6905d
children 369050c846a9
comparison
equal deleted inserted replaced
1072:391fb6d6905d 1080:287ec78f63b4
25 #include <Core/Images/ImageProcessing.h> 25 #include <Core/Images/ImageProcessing.h>
26 #include <Core/OrthancException.h> 26 #include <Core/OrthancException.h>
27 27
28 namespace OrthancStone 28 namespace OrthancStone
29 { 29 {
30 static void StringToVector(std::vector<uint8_t>& target,
31 const std::string& source)
32 {
33 target.resize(source.size());
34
35 for (size_t i = 0; i < source.size(); i++)
36 {
37 target[i] = source[i];
38 }
39 }
40
41
42 LookupTableTextureSceneLayer::LookupTableTextureSceneLayer(const Orthanc::ImageAccessor& texture) 30 LookupTableTextureSceneLayer::LookupTableTextureSceneLayer(const Orthanc::ImageAccessor& texture)
43 { 31 {
44 { 32 {
45 std::auto_ptr<Orthanc::ImageAccessor> t( 33 std::auto_ptr<Orthanc::ImageAccessor> t(
46 new Orthanc::Image(Orthanc::PixelFormat_Float32, 34 new Orthanc::Image(Orthanc::PixelFormat_Float32,
127 { 115 {
128 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); 116 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
129 } 117 }
130 } 118 }
131 119
132
133 void LookupTableTextureSceneLayer::SetLookupTable(const std::string& lut)
134 {
135 std::vector<uint8_t> tmp;
136 StringToVector(tmp, lut);
137 SetLookupTable(tmp);
138 }
139
140
141 void LookupTableTextureSceneLayer::SetRange(float minValue, 120 void LookupTableTextureSceneLayer::SetRange(float minValue,
142 float maxValue) 121 float maxValue)
143 { 122 {
144 if (minValue > maxValue) 123 if (minValue > maxValue)
145 { 124 {