[ITK-users] Modifying ValueAt function of SpatialObject

maximilian maximilian_oliver.mordig at roche.com
Thu Aug 21 10:52:53 EDT 2014


Dear all,

I am using the itk::SpatialObjectToImageFilter to convert a
GroupSpatialObject (collection of several spatial objects) to an image. This
filter is fine, however, if several spatial objects overlap at a location,
the image's pixel value of that location is the first value returned by any
spatial object in GroupSpatialObject (the ValueAt function is implemented in
SpatialObject.hxx and iterates through its children; if one children
matches, its value is immediately returned). I wanted the change the
ValueAt() function to add up all the values returned by the ValueAt function
if several SpatialObjects overlap at a location.


To change the behavior, I have to inherit my new class, let's call it A,
from GroupSpatialObject (collection of SpatialObjects) and redefine the
method ValueAt(). The ValueAt() function in A has to be very similar to the
ValueAt() defined in SpatialObject, but add up the values returned by its
children spatial objects (instead of returning just the first match as it is
currently implemented). The problem is that I need access m_TreeNode that is
a list of all children (i.e. all objects contained in the
GroupSpatialObject) to get the values of each child. However, m_TreeNode is
declared private in the SpatialObject class. How can I circumvent this?

Of course, I could copy-paste SpatialObject into a new class, but I consider
this a very ugly solution, because I have to do so for all derived classes
(like GroupSpatialObject, among others).


Regards,
Maximilian



--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Modifying-ValueAt-function-of-SpatialObject-tp7586101.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list