Dear Stefan,

I actually already implemented a couple of mappers for my own data, so 
creating mapper is not a problem. The idea is that I have the solid 
model data which I can create a mitk::Surface from and I wouldn't like 
to just copy-paste the surface mappers just to call one function in the 
beginning of GenerateDataForRenderer. Of course, there is also an option 
of creating a "helper object" node that will contain the created 
surface. But this approach has a drawback that if the view that creates 
this temporary object is not active when scene is loaded - then nothing 
will be shown. Same goes for deleting my node - if the view is not 
active - the helper object will persist. Do I understand this correctly 
or there's a simple way around this?

I'm actually about to write quite a long e-mail about helper objects and 
hierarchical deletion [I would love to have a flag that would instruct 
the DataStorage to delete all derivations of a node when a node is 
deleted]. I will include this use case there as well.

Either way, for now the subclassed mappers work perfectly for me!

Thanks a lot,
   Rostislav.

On 27/03/2014 17:26, Kislinskiy, Stefan wrote:
> Hi,
>
> I'm not sure if these mappers were implemented with further inheritence in 
> mind. Last year I started an alternative enhanced Surface mapper but I had to 
> pause working on it because lack of time. It is WIP but It might help you to 
> get started programming your own mapper. You can find it in the branch 
> bug-15614-NewSurfaceMapper3D. Another type of mapper is the Simulation mapper 
> in the Simulation module. It is kind of special as it uses OpenGL in VTK 
> context for 3D rendering but it should be a good example of how to write an 
> MITK-based mapper.
>
> Best,
> Stefan
> ________________________________________
> Von: Rostislav Khlebnikov [[email protected]]
> Gesendet: Donnerstag, 27. März 2014 17:46
> An: [email protected]
> Betreff: [mitk-users] SurfaceGLMapper uses deprecated function
>
> Hi,
>
> I am trying to use the surface mappers as a base class for my own
> mapper. The idea is that my data is in solid modeling format, but I
> convert it to VTK polydata for rendering. In order not to reimplement
> the vtk surface mapper, I subclassed SurfaceGLMapper2D and
> SurfaceVtkMapper3D and supply them with a mitk::Surface when demanded. I
> figured that this is actually intended because both mappers have
> (different) mechanisms to supply a mitk::Surface and do not use
> GetDataNode()->GetData() directly. In 2D mapper it is a non-virtual
> function GetInput() which returns a protected member variable and in 3D
> mapper - it is a virtual function GetInput() [Which in itself is rather
> weird :)].
>
> Anyway, after I supplied the correct surface, the SurfaceGLMapper2D
> crashed because in line 234 it called the deprecated function
> GetDataNode()->GetVtkTransform(timestep); which leaded to a crash. The
> actual reason for crash was that I didn't initialize the geometry in my
> data object, however, I believe that substituting this with
> GetInput()->GetGeometry(timestep)->GetVtkTransform(); is the correct way.
>
> So basically, I have two questions:
>    1) Is this subclassing a correct use of the surface mappers in this case?
>    2) Should I file a bug for this?
>
> Thanks,
>     Rostislav.
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> mitk-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mitk-users


------------------------------------------------------------------------------
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to