Discussion:
[mitk-users] Special reinit
Nil Goyette
2017-06-20 15:24:15 UTC
Permalink
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] Loading Image...
[2] Loading Image...
[3] Loading Image...
[4] Loading Image...
Dinkelacker, Stefan
2017-06-21 07:44:00 UTC
Permalink
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 <***@imeka.ca>
Gesendet: Dienstag, 20. Juni 2017 17:24
An: mitk-***@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-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users
Nil Goyette
2017-06-21 13:09:39 UTC
Permalink
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
Post by Dinkelacker, Stefan
Hi,
mitk::TimeGeometry::Pointer geo = ds->ComputeBoundingGeometry3D(ds->GetAll());
Best,
Stefan
________________________________________
Gesendet: Dienstag, 20. Juni 2017 17:24
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
- 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
Nil Goyette
2017-07-03 15:40:44 UTC
Permalink
Hi Stefan, hi all,

Anyone can help me with this? Here's a better explanation of what I
need. Lets say:
1) I load a small object, place the scene as I like (zoom, rotate 3D and
axes, etc.) Loading Image...
2) I load a second object: the reference image.
Loading Image... This screenshot was taken just before the
automatic reinit in RenderingManager::InitializeViews (using a breakpoint).

In the last screenshot, my goal would be to leave the planes untouched,
except for the bounds. I should be able to see the image in the
sagittal/coronal planes and I should to be able to see the image *if* I
zoom back. I know it's not currently possible in MITK. I'm asking how to
do it in the code. I tried some things but it always produce horrors
like [3] in my previous message. Any ideas how I can achieve that?

Nil
Post by Nil Goyette
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
Post by Dinkelacker, Stefan
Hi,
mitk::TimeGeometry::Pointer geo = ds->ComputeBoundingGeometry3D(ds->GetAll());
Best,
Stefan
________________________________________
Gesendet: Dienstag, 20. Juni 2017 17:24
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
- 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
https://lists.sourceforge.net/lists/listinfo/mitk-users
Dinkelacker, Stefan
2017-07-04 08:00:44 UTC
Permalink
Hi,

Maybe the way the Position node stuff of the 3D-interpolation [1] is a good hint for that. For each drawn contour it generates a PlanarCircle as helper object. When clicking on one of these nodes, the according plane is adjusted to be able to continue the contour.

Best,
Stefan

[1] https://github.com/MITK/MITK/blob/master/Modules/Segmentation/Interactions/mitkSegTool2D.cpp#L465-L521

From: Nil Goyette [mailto:***@imeka.ca]
Sent: Montag, 3. Juli 2017 17:41
To: Dinkelacker, Stefan; mitk-***@lists.sourceforge.net
Subject: Re: [mitk-users] Special reinit


Hi Stefan, hi all,

Anyone can help me with this? Here's a better explanation of what I need. Lets say:
1) I load a small object, place the scene as I like (zoom, rotate 3D and axes, etc.) http://i.imgur.com/MBHAqza.png
2) I load a second object: the reference image. http://i.imgur.com/Gy93a3a.png This screenshot was taken just before the automatic reinit in RenderingManager::InitializeViews (using a breakpoint).

In the last screenshot, my goal would be to leave the planes untouched, except for the bounds. I should be able to see the image in the sagittal/coronal planes and I should to be able to see the image if I zoom back. I know it's not currently possible in MITK. I'm asking how to do it in the code. I tried some things but it always produce horrors like [3] in my previous message. Any ideas how I can achieve that?

Nil
Le 2017-06-21 à 09:09, Nil Goyette a écrit :

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 <***@imeka.ca><mailto:***@imeka.ca>

Gesendet: Dienstag, 20. Juni 2017 17:24

An: mitk-***@lists.sourceforge.net<mailto:mitk-***@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-***@lists.sourceforge.net<mailto:mitk-***@lists.sourceforge.net>

https://lists.sourceforge.net/lists/listinfo/mitk-users
Nil Goyette
2017-07-04 19:41:33 UTC
Permalink
Hi,

I tested PlanePositionManagerService and the results are still wrong.
The rotation is kept but the offset and bounds are also kept, which lock
the 2D views on the first loaded object. This seems normal because the
width and height are saved in the object.

While testing, I found that method:
mitk::SliceNavigationController::ReorientSlices, taking the plane's
normal or 2 vectors. If I save the normal before updating the plane,
update the plane and call ReorientSlices(normal), wouldn't that work? I
can't test it right now but it looks like it could pay off.

Nil
Post by Dinkelacker, Stefan
Hi,
Maybe the way the Position node stuff of the 3D-interpolation [1] is a
good hint for that. For each drawn contour it generates a PlanarCircle
as helper object. When clicking on one of these nodes, the according
plane is adjusted to be able to continue the contour.
Best,
Stefan
[1]
https://github.com/MITK/MITK/blob/master/Modules/Segmentation/Interactions/mitkSegTool2D.cpp#L465-L521
*Sent:* Montag, 3. Juli 2017 17:41
*Subject:* Re: [mitk-users] Special reinit
Hi Stefan, hi all,
1) I load a small object, place the scene as I like (zoom, rotate 3D
and axes, etc.) http://i.imgur.com/MBHAqza.png
2) I load a second object: the reference image.
http://i.imgur.com/Gy93a3a.png <http://i.imgur.com/Gy93a3a.png> This
screenshot was taken just before the automatic reinit in
RenderingManager::InitializeViews (using a breakpoint).
In the last screenshot, my goal would be to leave the planes
untouched, except for the bounds. I should be able to see the image in
the sagittal/coronal planes and I should to be able to see the image
*if* I zoom back. I know it's not currently possible in MITK. I'm
asking how to do it in the code. I tried some things but it always
produce horrors like [3] in my previous message. Any ideas how I can
achieve that?
Nil
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
Hi,
mitk::TimeGeometry::Pointer geo = ds->ComputeBoundingGeometry3D(ds->GetAll());
Best,
Stefan
________________________________________
Gesendet: Dienstag, 20. Juni 2017 17:24
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
- 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
https://lists.sourceforge.net/lists/listinfo/mitk-users
Continue reading on narkive:
Loading...