Mercurial > hg > orthanc-stone
changeset 101:af312ce4fe59 wasm
support of 3D swapping of the normal
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 31 May 2017 10:35:20 +0200 |
parents | 166a555becbf |
children | fcec0ab44054 |
files | Applications/Samples/SingleFrameApplication.h Framework/Toolbox/Slice.cpp |
diffstat | 2 files changed, 18 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Applications/Samples/SingleFrameApplication.h Tue May 30 22:22:04 2017 +0200 +++ b/Applications/Samples/SingleFrameApplication.h Wed May 31 10:35:20 2017 +0200 @@ -152,10 +152,20 @@ #else // TEST for scene extents - Rotate the axes double a = 15.0 / 180.0 * M_PI; - + +#if 1 Vector x; GeometryToolbox::AssignVector(x, cos(a), sin(a), 0); Vector y; GeometryToolbox::AssignVector(y, -sin(a), cos(a), 0); +#else + // Flip the normal + Vector x; GeometryToolbox::AssignVector(x, cos(a), sin(a), 0); + Vector y; GeometryToolbox::AssignVector(y, sin(a), -cos(a), 0); +#endif + SliceGeometry s(source_->GetSlice(slice_).GetGeometry().GetOrigin(), x, y); + GeometryToolbox::Print(s.GetAxisX()); + GeometryToolbox::Print(s.GetAxisY()); + GeometryToolbox::Print(s.GetNormal()); widget_->SetSlice(s); #endif } @@ -241,7 +251,7 @@ std::auto_ptr<LayerWidget> widget(new LayerWidget); -#if 1 +#if 0 std::auto_ptr<OrthancFrameLayerSource> layer (new OrthancFrameLayerSource(context.GetWebService())); //layer->SetImageQuality(SliceImageQuality_Jpeg50); @@ -267,7 +277,7 @@ ct.reset(new OrthancFrameLayerSource(context.GetWebService())); //ct->LoadInstance("c804a1a2-142545c9-33b32fe2-3df4cec0-a2bea6d6", 0); //ct->LoadInstance("4bd4304f-47478948-71b24af2-51f4f1bc-275b6c1b", 0); // BAD SLICE - ct->SetImageQuality(SliceImageQuality_Jpeg50); + //ct->SetImageQuality(SliceImageQuality_Jpeg50); ct->LoadSeries("dd069910-4f090474-7d2bba07-e5c10783-f9e4fb1d"); ct->Register(*this);
--- a/Framework/Toolbox/Slice.cpp Tue May 30 22:22:04 2017 +0200 +++ b/Framework/Toolbox/Slice.cpp Wed May 31 10:35:20 2017 +0200 @@ -178,8 +178,11 @@ { throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); } - - return (GeometryToolbox::IsParallel(GetGeometry().GetNormal(), plane.GetNormal()) && + + bool opposite; + return (GeometryToolbox::IsParallelOrOpposite(opposite, + GetGeometry().GetNormal(), + plane.GetNormal()) && GeometryToolbox::IsNear(GetGeometry().ProjectAlongNormal(GetGeometry().GetOrigin()), GetGeometry().ProjectAlongNormal(plane.GetOrigin()), thickness_ / 2.0));