Slicer
4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
|
Accessors in VTK/MRML are typically in the format GetXXX()
where XXX
is the name of an existing vtkObject that the class instance owns (directly or indirectly). However, it happens that sometimes the vtkObject doesn't exist and the method instantiates an object without registering it. In that case, the returned object has a reference count of 1 and the caller is responsible for dereferencing (call Delete()
on) the returned object. Here is the different naming conventions for such accessors:
GetXXX:
Return an existing object, reference count is not changed, the caller is not responsible for the object. NewXXX:
Solely instantiate an object (typically a factory method). The caller is responsible to decrement the reference count. CreateXXX:
Instantiate and configure an object. The caller is responsible to decrement the reference count. If XXX is a MRML node, it is NOT added into the scene. CreateAndAddXXX:
Instantiate, configure and add into the scene a MRML node. The caller is not responsible to decrement the reference count.