View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002626 | Slicer4 | Core: Base Code | public | 2012-10-08 08:38 | 2012-10-09 07:35 |
Reporter | finetjul | Assigned To | finetjul | ||
Priority | low | Severity | text | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Product Version | Slicer 4.1.1 | ||||
Target Version | Slicer 4.3.0 | Fixed in Version | Slicer 4.2.0 | ||
Summary | 0002626: Uniformize Get/New/Create/CreateAndAdd | ||||
Description | "GetXXX" should return a node with a reference count unchanged(already added into the scene) Write documentation in doxygen pages and make each "Create" function refer to it. | ||||
Tags | Deprecation | ||||
Fixed in r21136 & r21137 vtkSlicerVolumeRenderingLogic::CreateVolumeRenderingDisplayNode() doesn't add the new node into the scene (and node must be de-referenced by the caller) |
|
Reminder sent to: fedorov Hi Andrei, can you please update the ChangeTracker accordingly. |
|
We should not be making non-backward-compatible API changes during a feature freeze before a minor release -- it was good that you refactored all the code in slicer's repository, but what about extensions or people developing their own code on top of slicer? There was a similar issue recently with GetPolyData in the vtkMRMLModelDisplayNode [1] - I heard from one of the developers of the iGyne module that this took them a while to figure out. To avoid the issue, we should keep the old API in place as a deprecated method and even add a vtkWarningMessage so that developers will know to migrate to the new API but their code will not be broken. |
|
Commited in r21138 and https://github.com/fedorov/ChangeTrackerPy/commit/f8845164051aade523b4686f7136ad9a005e943b |
|
Backward compatibility functions added in r21139 Steve, very good point, I was going back and forth with the backward compatibility. Doesn't python throw an error when it can't find a method already ? It would also be great if we can have a mechanism to inform developer of obsolete methods. |
|
Yes, python raises and exception when the method doesn't exist, but that doesn't point you to the new API method (just like a linker error doesn't). If we really want to remove the method, we could do a stub that only prints the new suggested API at compile and/or run time. But I think that for stylistic renaming purposes it's better to provide the compatible API. |
|
vtkMRMLScene::GetNodesByClass() and vtkMRMLScene::GetNodesByClassByName() are also misleading and are prone to memory leak (see 0002621 or r21124). |
|
I agree that those methods are error prone and I've never cared for them. I wonder though if Find is really better than Get in this case? In some sense these are 'Get'ters in that they return pointers to nodes that are owned by the scene. It's the vtkCollection that is problematic in my view, so maybe we move to std containers of pointers? Probably we should think more generally about the MRML API and representation. There are some use cases, like getting/observing nodes by class type(s) and scene views, that could probably benefit from new methods. The slicer.util.getNodes method in python probably should have a C++ implementation and a more carefully thought out set of functionality. |
|
Yes, we should think more generally about the MRML API. I wouldn't mind using more std methods. Nonetheless, in that particuliar case, I don't think that GetNodesByClass() is a simple accessor, it really browses the entire scene, and "filters" the nodes to return only the ones that match a criteria. Another solution is to not return anything, but take the vtkCollection as paramater. |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2012-10-08 08:38 | finetjul | New Issue | |
2012-10-08 08:38 | finetjul | Status | new => assigned |
2012-10-08 08:38 | finetjul | Assigned To | => finetjul |
2012-10-08 08:39 | finetjul | Relationship added | related to 0002621 |
2012-10-08 21:05 | finetjul | Note Added: 0006440 | |
2012-10-08 21:05 | finetjul | Status | assigned => resolved |
2012-10-08 21:05 | finetjul | Fixed in Version | => Slicer 4.2.0 - coming release |
2012-10-08 21:05 | finetjul | Resolution | open => fixed |
2012-10-08 21:06 | finetjul | Note Added: 0006441 | |
2012-10-08 21:08 | finetjul | Note Edited: 0006440 | |
2012-10-09 04:38 | pieper | Note Added: 0006443 | |
2012-10-09 05:11 | fedorov | Note Added: 0006445 | |
2012-10-09 05:11 | fedorov | Status | resolved => feedback |
2012-10-09 05:11 | fedorov | Resolution | fixed => reopened |
2012-10-09 05:27 | finetjul | Note Added: 0006447 | |
2012-10-09 05:27 | finetjul | Status | feedback => resolved |
2012-10-09 05:27 | finetjul | Resolution | reopened => fixed |
2012-10-09 05:45 | pieper | Note Added: 0006451 | |
2012-10-09 05:45 | pieper | Status | resolved => closed |
2012-10-09 06:14 | finetjul | Note Added: 0006454 | |
2012-10-09 07:16 | pieper | Note Added: 0006462 | |
2012-10-09 07:35 | finetjul | Note Added: 0006466 | |
2013-02-15 10:57 | finetjul | Tag Attached: Deprecation |