Hi Stefan,

Thank you for your answer. I'm working in InitializeViewsByBoundingObjects and InitializeViews, so I'm aware of this method. If I understand correctly, it returns a geometry with orthogonal planes (reinited, reseted?). I would gladly use the offset/bounds of this geometry but I also want to *keep the rotation* of the planes.

In fact, that's what I tried to do in the snippet below. timeGeometry IS the result of ds->ComputeBoundingGeometry3D(ds->GetAll());.

Nil

Le 2017-06-21 à 03:44, Dinkelacker, Stefan a écrit :
Hi,

if you want to recompute the bounding box of the scene, mitk::DataStorage has a 
method for this purpose:

   mitk::TimeGeometry::Pointer geo = 
ds->ComputeBoundingGeometry3D(ds->GetAll());

Best,
Stefan
________________________________________
Von: Nil Goyette <nil.goye...@imeka.ca>
Gesendet: Dienstag, 20. Juni 2017 17:24
An: mitk-users@lists.sourceforge.net
Betreff: [mitk-users] Special reinit

Hi all,

Lets start by saying that I know "Reinit" is not the right choice of
word in this case! A reinit would reset the axis, as it should. Lets
say, for the sake of the discussion, that I want a reinit that simply
update the scene's bounding box, nothing else, like  [1] to [2] (made by
hand, so not exact!):
- No camera modification, so everything is still at the same place
- Keep the axis rotated if they were
- Resize the scene if an object was added/deleted

I tried adding this snippet in RenderingManager::InitializeViews. In
clear english: reuse the old geometry for the current plane, but update
it with the new offset and bounds that we just calculated.

auto newGeo = timeGeometry->GetGeometryForTimeStep(0);
auto oldTimeGeo = nc->GetCreatedWorldGeometry();
auto oldGeo = oldTimeGeo->GetGeometryForTimeStep(0);

oldGeo->GetIndexToWorldTransform()->SetOffset(
    newGeo->GetIndexToWorldTransform()->GetOffset());
oldGeo->SetBounds(newGeo->GetBounds());

nc->SendCreatedWorldGeometryUpdate();

nc->SetInputWorldTimeGeometry(oldTimeGeo);
nc->Update();
...

This doesn't work; it throws the planes in strange places [3], probably
because I broke their affine matrix. I tried many things but my biggest
success was to remove the call to SetInputWorldTimeGeometry [4]. I
checked in DisplayInteractor::Rotate to see if there was a way to find
the old rotation applied to the plane but it doesn't seem to be possible.

Anyway, I'm mostly wondering how YOU, the mitk experts :), would do it.
Thank you for your time.

Nil

[1] http://i.imgur.com/krzBvJV.png
[2] http://i.imgur.com/NWDQQqg.png
[3] http://i.imgur.com/7wwWczy.png
[4] http://i.imgur.com/m9jwrpE.png
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to