comparison Framework/Volumes/ImageBuffer3D.cpp @ 734:be3671662eec

moved FitWindowingToRange() from ImageBuffer3D to RenderStyle
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 21 May 2019 15:20:04 +0200
parents 4f2416d519b4
children c3bbb130abc4
comparison
equal deleted inserted replaced
733:717eabfa749a 734:be3671662eec
256 return false; 256 return false;
257 } 257 }
258 } 258 }
259 259
260 260
261 bool ImageBuffer3D::FitWindowingToRange(Deprecated::RenderStyle& style,
262 const Deprecated::DicomFrameConverter& converter) const
263 {
264 if (hasRange_)
265 {
266 style.windowing_ = ImageWindowing_Custom;
267
268 // casting the narrower type to wider before calling the + operator
269 // will prevent overflowing (this is why the cast to double is only
270 // done on the first operand)
271 style.customWindowCenter_ = static_cast<float>(
272 converter.Apply((static_cast<double>(minValue_) + maxValue_) / 2.0));
273
274 style.customWindowWidth_ = static_cast<float>(
275 converter.Apply(static_cast<double>(maxValue_) - minValue_));
276
277 if (style.customWindowWidth_ > 1)
278 {
279 return true;
280 }
281 }
282
283 style.windowing_ = ImageWindowing_Custom;
284 style.customWindowCenter_ = 128.0;
285 style.customWindowWidth_ = 256.0;
286 return false;
287 }
288
289
290 ImageBuffer3D::SliceReader::SliceReader(const ImageBuffer3D& that, 261 ImageBuffer3D::SliceReader::SliceReader(const ImageBuffer3D& that,
291 VolumeProjection projection, 262 VolumeProjection projection,
292 unsigned int slice) 263 unsigned int slice)
293 { 264 {
294 switch (projection) 265 switch (projection)