Page MenuHomePhabricator

Mesh rendering problem on timestep > 0
Closed, ResolvedPublic

Description

I have been testing the Mesh with several time step and I think there's a bug in the drawing process. Please take a look at http://i.imgur.com/lz6Q29Y.png. I tested the Mesh with (and without) a PointSetInteractor::New("onlymovepointsetinteractor", meshNode). It works well on time 0 and the 3D view is always perfect but it gets strange at t > 0.
Without an interactor:

  • On t > 0, we still see the outline of the mesh of t = 0, and the current one.

With a PointSetInteractor::New("onlymovepointsetinteractor", meshNode);

  • On t > 0, we still see the outline of the mesh of t = 0, but not the current one.
  • On t > 0, the little '+' become pink squares for some reason.
  • If I click and move one of the point, the entire Mesh moves
  • If I click near one of the point, all points become little '+' and I can now move them as it should.

I tested with MITK2013.03 and we have the same problems. Idem with only one Mesh instead of two. The Mesh rendering is broken.

Event Timeline

Hi Nil, can you provide a 4D mesh in order to reproduce your bug? you refer to a 4D mitk::Mesh, right? not a mitk::Surface

let me know,
thank you

Yes, the bug is on a 4D mitk::Mesh. It works perfectly on 3D Mesh because, as I wrote, the problem arises on t > 0.

I would gladly provide a Mesh, but I'm not sure how to do that. Saving a Mesh gives a "MITK Point Set (*.mps)" file. In fact, I'm currently writing a Mesh serializer so they are saved with the scene, but it's not finished and you don't have the code anyway. So... you want me to write a script that produces a simple 4D Mesh? Can do if there's no simpler way.

how do you generate the 4D mitk::Mesh in your setting? It looks like as a result of an iterative segmentation method in SPECT, isn´t it? It would suffice if you provide the code snippet for converting a set of mitk::Surface into a 4D mesh. Otherwise, I will try to do it myself

I don't have the code you are asking for, but in order to help you, I created a simple mesh (2 tetrahedra) as an example and the rendering is also broken, so here's the code: https://gist.github.com/anonymous/1a54610a912c49e0d251 It's absolutely ugly (sorry!) but it's enough to see the bug.

sorry for the late answer ... I missed your last message with the example data

now I could reproduce the problem.
It looks like only the nodes are updated in the 2D windows. The lines are not.
The 3D window looks fine

New remote branch pushed: bug-15475-mesh-rendering-problem-on-timesteps

it looks like there were some timesteps taken as default (0) in the mesh mapper

please give it a try now ...

bug-15475-mesh-rendering-problem-on-timesteps

Hey, thanks for your patch. The rendering without an interactor is now ok. With an interactor though, I still have almost the same problem as in my first post. I believe the only problenm is that they are all selected by default.

do you know how can I reproduce the error in "rendering with an interactor"?

In a quick look into PointSetInteractor I found a missing "m_TimeStep" in line 804:

if ((pointSet->GetSize( m_TimeStep ) == m_N)&&(pointSet->GetNumberOfSelected()==0))

should be:

if ((pointSet->GetSize( m_TimeStep ) == m_N)&&(pointSet->GetNumberOfSelected(TimeStep)==0))

can you give it a try?

I don't do anything special; I just add an interactor.
mitk::DataNode::Pointer meshNode = mitk::DataNode::New();
meshNode->SetData(aMeshWithLotOfGates);
meshNode->SetStringProperty("name", "MY MESH");
GetDataStorage()->Add(meshNode, m_CurrentImageNode);
mitk::PointSetInteractor::Pointer interactor =

mitk::PointSetInteractor::New("onlymovepointsetinteractor", meshNode);

meshNode->EnableInteractor();

The line you told me to add didn't change anything.

[f0ffc9]: Merge branch 'bug-15475-mesh-rendering-problem-on-timesteps'

Merged commits:

2013-09-11 15:06:49 Sebastian Ordas [00e14b]
added missing timesteps

hello, some new findings from today´s bugsquashing:

  • QmitkPointListWidget and QmitkPointListView are not handling time steps at all. I suggest that you don´t use them with meshes with t>0
  • PointOperation is considering the points in its constructor as active by default. So, you have to options here: 1) define the points in your mesh e.g. mitk::PointOperation addPoint(mitk::OpINSERT, p, 0, false) .... or 2)set default selected=false in the constructor: e.g.PointOperation(OperationType operationType, Point3D point, int index = -1, bool selected = false, PointSpecificationType type = PTUNDEFINED);

I suggest option 2) but changes in the core take long.

  • mitkPointSetInteractor is handling time steps correctly

Let me know what you think ...

an alternative to setting the points in a PointSet as deactivated by default, would be to have a method in PointSet such as:

void mitk::PointSet::SelectAll(bool selected, unsigned int t)
{

if ( t < m_PointSetSeries.size() )
{
  mitk::PointSet::PointsIterator iter = this->Begin(t);
  for ( ; iter != this->End(t);
        iter++ )
  {
    this->SetSelectInfo( iter->Index(), selected, t );
  }
}

}

In this way, if your pointset is loaded from disk, you can use it after loading.

I will discuss the preferred choice with my colleagues before making modifications in the core

New remote branch pushed: bug-15475-pointlistwidget-not-handling-timesteps

Nil, could you please confirm whether the proposed solution (either Comment 12 or 13) has worked for you?

thank you

Oh, sorry for the delay. The way I coded, addind false in the ctor was indeed simple and solves the problem. I didn't test the other ideas, but as a user, I believe selected should be false by default.

Thanks again for your time.

yes, I also think that. I will open a new bug for that and close this one.
good luck!