comparison Framework/dev.h @ 110:53025eecbc95 wasm

renamed SliceGeometry as CoordinateSystem3D
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 14 Jun 2017 15:50:38 +0200
parents eccd64f8e297
children 948f86e61e83
comparison
equal deleted inserted replaced
109:53bd9277b025 110:53025eecbc95
248 unsigned int height_; 248 unsigned int height_;
249 size_t depth_; 249 size_t depth_;
250 double pixelSpacingX_; 250 double pixelSpacingX_;
251 double pixelSpacingY_; 251 double pixelSpacingY_;
252 double sliceThickness_; 252 double sliceThickness_;
253 SliceGeometry reference_; 253 CoordinateSystem3D reference_;
254 DicomFrameConverter converter_; 254 DicomFrameConverter converter_;
255 255
256 double ComputeAxialThickness(const OrthancVolumeImage& volume) const 256 double ComputeAxialThickness(const OrthancVolumeImage& volume) const
257 { 257 {
258 double thickness; 258 double thickness;
313 313
314 Vector origin = axial.GetGeometry().GetOrigin(); 314 Vector origin = axial.GetGeometry().GetOrigin();
315 origin += (static_cast<double>(volume.GetSliceCount() - 1) * 315 origin += (static_cast<double>(volume.GetSliceCount() - 1) *
316 axialThickness * axial.GetGeometry().GetNormal()); 316 axialThickness * axial.GetGeometry().GetNormal());
317 317
318 reference_ = SliceGeometry(origin, 318 reference_ = CoordinateSystem3D(origin,
319 axial.GetGeometry().GetAxisX(), 319 axial.GetGeometry().GetAxisX(),
320 -axial.GetGeometry().GetNormal()); 320 -axial.GetGeometry().GetNormal());
321 } 321 }
322 322
323 void SetupSagittal(const OrthancVolumeImage& volume) 323 void SetupSagittal(const OrthancVolumeImage& volume)
335 335
336 Vector origin = axial.GetGeometry().GetOrigin(); 336 Vector origin = axial.GetGeometry().GetOrigin();
337 origin += (static_cast<double>(volume.GetSliceCount() - 1) * 337 origin += (static_cast<double>(volume.GetSliceCount() - 1) *
338 axialThickness * axial.GetGeometry().GetNormal()); 338 axialThickness * axial.GetGeometry().GetNormal());
339 339
340 reference_ = SliceGeometry(origin, 340 reference_ = CoordinateSystem3D(origin,
341 axial.GetGeometry().GetAxisY(), 341 axial.GetGeometry().GetAxisY(),
342 axial.GetGeometry().GetNormal()); 342 axial.GetGeometry().GetNormal());
343 } 343 }
344 344
345 public: 345 public:
381 { 381 {
382 return reference_.GetNormal(); 382 return reference_.GetNormal();
383 } 383 }
384 384
385 bool LookupSlice(size_t& index, 385 bool LookupSlice(size_t& index,
386 const SliceGeometry& slice) const 386 const CoordinateSystem3D& slice) const
387 { 387 {
388 bool opposite; 388 bool opposite;
389 if (!GeometryToolbox::IsParallelOrOpposite(opposite, 389 if (!GeometryToolbox::IsParallelOrOpposite(opposite,
390 reference_.GetNormal(), 390 reference_.GetNormal(),
391 slice.GetNormal())) 391 slice.GetNormal()))
417 { 417 {
418 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); 418 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
419 } 419 }
420 else 420 else
421 { 421 {
422 SliceGeometry origin(reference_.GetOrigin() + 422 CoordinateSystem3D origin(reference_.GetOrigin() +
423 static_cast<double>(slice) * sliceThickness_ * reference_.GetNormal(), 423 static_cast<double>(slice) * sliceThickness_ * reference_.GetNormal(),
424 reference_.GetAxisX(), 424 reference_.GetAxisX(),
425 reference_.GetAxisY()); 425 reference_.GetAxisY());
426 426
427 return Slice(origin, pixelSpacingX_, pixelSpacingY_, sliceThickness_, 427 return Slice(origin, pixelSpacingX_, pixelSpacingY_, sliceThickness_,
503 } 503 }
504 } 504 }
505 505
506 506
507 bool DetectProjection(VolumeProjection& projection, 507 bool DetectProjection(VolumeProjection& projection,
508 const SliceGeometry& viewportSlice) 508 const CoordinateSystem3D& viewportSlice)
509 { 509 {
510 bool isOpposite; // Ignored 510 bool isOpposite; // Ignored
511 511
512 if (GeometryToolbox::IsParallelOrOpposite(isOpposite, 512 if (GeometryToolbox::IsParallelOrOpposite(isOpposite,
513 viewportSlice.GetNormal(), 513 viewportSlice.GetNormal(),
543 { 543 {
544 volume_.Register(*this); 544 volume_.Register(*this);
545 } 545 }
546 546
547 virtual bool GetExtent(std::vector<Vector>& points, 547 virtual bool GetExtent(std::vector<Vector>& points,
548 const SliceGeometry& viewportSlice) 548 const CoordinateSystem3D& viewportSlice)
549 { 549 {
550 VolumeProjection projection; 550 VolumeProjection projection;
551 551
552 if (!IsGeometryReady() || 552 if (!IsGeometryReady() ||
553 !DetectProjection(projection, viewportSlice)) 553 !DetectProjection(projection, viewportSlice))
563 return true; 563 return true;
564 } 564 }
565 } 565 }
566 566
567 567
568 virtual void ScheduleLayerCreation(const SliceGeometry& viewportSlice) 568 virtual void ScheduleLayerCreation(const CoordinateSystem3D& viewportSlice)
569 { 569 {
570 VolumeProjection projection; 570 VolumeProjection projection;
571 571
572 if (IsGeometryReady() && 572 if (IsGeometryReady() &&
573 DetectProjection(projection, viewportSlice)) 573 DetectProjection(projection, viewportSlice))