Hi Stefan,

thanks for your answer. I had a deeper look now that I would like to shared.

It does not look as if one should change text overlays from within mappers:
 - mappers' GenerateData() method is called while VTK is already rendering 
(traversing props, asking them to render)
 - switching an annotation on/off will add/remove another prop (VTK follower) 
to/from the renderer (window?)

While I think/hope that VTK takes measures to avoid chaos when its prop list 
changes during rendering, it seems to not automatically render again when this 
happens. Seems to make sense, probably you wouldn't want this in applications.

My summary: adding/removing MITK annotations from within mappers is not 
supported at the moment. When still doing so the UI level should trigger the 
change and enforce a double rendering afterwards.

While debugging I stumbled upon code in mitk::VtkPropRenderer (around 
WriteSimpleText and m_TextCollection - marked deprecated since four years) that 
is better suited for real overlays: it collects some 'special overlay 
information' during rendering and then renders them after everything else - but 
still during the same rendering call. This might serve as an inspiration if 
anybody wants to improve. However, this approach would not work for the 
TextAnnotation3D which is an object in the 3D scene and not an overlay!

Kind regards,
Daniel


> "Dinkelacker, Stefan" <s.dinkelac...@dkfz-heidelberg.de> hat am 18. Juni 2019 
> um 09:23 geschrieben:
> 
> 
> Hi Daniel,
> 
> I didn't look into 3d annotation details yet and can't tell you anything 
> about the rendering order or if it is a MITK issue or a VTK issue. AFAIK the 
> Connectomics mapper wasn't used for a while now and we would need to check. I 
> guess there is also some test data in the test repo if you want to give it a 
> shot.
> 
> However, I can at least assure you that it is okay to use annotations in 
> mappers. :-)
> 
> Best,
> Stefan
> 
> -----Original Message-----
> From: Daniel Maleike [mailto:c...@maleike.de] 
> Sent: Monday, June 17, 2019 4:07 PM
> To: mitk-users@lists.sourceforge.net
> Subject: [mitk-users] TextOverlay3D updates one frame later
> 
> Hi everybody,
> 
> I have a question regarding mitk::TextAnnotation3D. As far as I can see, this 
> replaces mitk::TextOverlay3D from the 2016.11 release.
> 
> I am just modifying a custom mapper to use TextAnnotation3D instead of 
> TextOverlay3D. I took orientation from documentation and 
> Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsNetworkMapper3D.cpp.
> Most works fine with one exception: when I change the visibility of the text 
> annotation, this change takes only effect one rendered frame later.
> 
> I guess this is because of rendering order - perhaps the overlay gets 
> rendered first by VTK and only then my mapper gets to work? (did not yet 
> debug that deep)
> 
> Questions:
> - is TextAnnotation3D supposed to be used by mappers? How are visibility 
> changes supposed to work? Or should I fall back to managing my own VTK text 
> follower?
> - is this effect known for ConnectomicsNetworkMapper3D?
> - is there a way to workaround this effect / to influence rendering order?
> 
> Thanks for any input,
> Daniel
> 
> 
> _______________________________________________
> mitk-users mailing list
> mitk-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mitk-users


_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to