Fixed crash for single time step segmentations
Description
Description
Details
Details
- Auditors
floca - Provenance
• kausch Authored on Apr 26 2019, 11:40 AM • kausch Pushed on Apr 26 2019, 11:40 AM - Parents
- rMITK55cb5498ee4d: Added Try-Catch For Multiple Timepoints Segmentation
- Branches
- Unknown
- Tags
Event Timeline
Comment Actions
The fix is not good and has several problems. See comment above. If it is not clear how to handle it properly, just drop by an I can explaine.
/Modules/ImageStatistics/mitkImageStatisticsContainer.cpp | ||
---|---|---|
129–130 | You cannot just create a container on the fly on the heap and pass it back as a reference. Don't do that. The correct way to handle this with the current API is to either
If the time step does not exist it is job of the caller to specify the fallback strategy. It is not part of the container to specify or enforce anything in this direction. |
/Modules/ImageStatistics/mitkImageStatisticsContainer.cpp | ||
---|---|---|
129–130 | One correction. It will not cause crash (that would be the case with smartpointers as raw pointers. Currently it will generate memory leaks. |
/Modules/ImageStatistics/mitkImageStatisticsContainer.cpp | ||
---|---|---|
129–130 | I second that. I also ran into this problem when using the classes for my own plugin. For testing I only added a mask at one time step -> crash. Checking in any way if 'GetStatisticsForTimeStep' is successfully without directly accessing 'm_Histogram' seems to be the correct way to go. |
Comment Actions
There seems to be another exception thrown when willing the table view. The statistics table is not filled. The idea is now not to change the GetStatisticsForTimeStep functionality but handle the exception in the level above (like we started before with the try-catch)
Comment Actions
We reverted the changes according to your concerns. Instead of creating a new ImageStatisticsObject in the GetStatisticsForTimeStep method, we now check whether the time step exists before calling the method. That fixed the problem. Statistics are now only shown for the time steps that have a segmentation associated with.