comparison OrthancStone/Sources/Volumes/VolumeReslicer.cpp @ 1774:95ece40bb298

DicomVolumeImageReslicer and DicomVolumeImageMPRSlicer behave identically on axial
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 May 2021 17:43:51 +0200
parents 6c246f862b00
children 3889ae96d2e9
comparison
equal deleted inserted replaced
1773:34eb41352dff 1774:95ece40bb298
237 const double width = static_cast<double>(slice.GetWidth()); 237 const double width = static_cast<double>(slice.GetWidth());
238 const double height = static_cast<double>(slice.GetHeight()); 238 const double height = static_cast<double>(slice.GetHeight());
239 assert(y < height); 239 assert(y < height);
240 240
241 Vector q1 = plane.MapSliceToWorldCoordinates 241 Vector q1 = plane.MapSliceToWorldCoordinates
242 (extent.GetX1() + extent.GetWidth() * static_cast<double>(0) / static_cast<double>(width + 1), 242 (extent.GetX1() + extent.GetWidth() * 0.5 / width,
243 extent.GetY1() + extent.GetHeight() * static_cast<double>(y) / static_cast<double>(height + 1)); 243 extent.GetY1() + extent.GetHeight() * (static_cast<double>(y) + 0.5) / height);
244 244
245 Vector q2 = plane.MapSliceToWorldCoordinates 245 Vector q2 = plane.MapSliceToWorldCoordinates
246 (extent.GetX1() + extent.GetWidth() * static_cast<double>(width - 1) / static_cast<double>(width + 1), 246 (extent.GetX1() + extent.GetWidth() * (static_cast<double>(width - 1) + 0.5) / width,
247 extent.GetY1() + extent.GetHeight() * static_cast<double>(y) / static_cast<double>(height + 1)); 247 extent.GetY1() + extent.GetHeight() * (static_cast<double>(y) + 0.5) / height);
248 248
249 Vector r1, r2; 249 Vector r1, r2;
250 box.ToInternalCoordinates(r1, q1); 250 box.ToInternalCoordinates(r1, q1);
251 box.ToInternalCoordinates(r2, q2); 251 box.ToInternalCoordinates(r2, q2);
252 252
319 319
320 const double width = static_cast<double>(slice_.GetWidth()); 320 const double width = static_cast<double>(slice_.GetWidth());
321 const double height = static_cast<double>(slice_.GetHeight()); 321 const double height = static_cast<double>(slice_.GetHeight());
322 322
323 Vector q = plane_.MapSliceToWorldCoordinates 323 Vector q = plane_.MapSliceToWorldCoordinates
324 (extent_.GetX1() + extent_.GetWidth() * static_cast<double>(x_) / (width + 1.0), 324 (extent_.GetX1() + extent_.GetWidth() * (static_cast<double>(x_) + 0.5) / width,
325 extent_.GetY1() + extent_.GetHeight() * static_cast<double>(y_) / (height + 1.0)); 325 extent_.GetY1() + extent_.GetHeight() * (static_cast<double>(y_) + 0.5) / height);
326 326
327 Vector r; 327 Vector r;
328 box_.ToInternalCoordinates(r, q); 328 box_.ToInternalCoordinates(r, q);
329 329
330 x = static_cast<float>(r[0]); 330 x = static_cast<float>(r[0]);