Loading a previously stored nifty segmentation (file format `nii` leads to a crash if either
- the segmentation view is already open when the segmentation is loaded
- the segmentation view is opened after the segmentation was loaded
The error occurs here: `LabelSetImage::GetActiveLabelSet()`
- `m_LabelSetContainer` is unknown
- `this` is unknown
This comes from the fact that inside `QmitkSegmentationView::EstablishLabelSetConnection` the call `auto workingImage = dynamic_cast<mitk::LabelSetImage*>(m_WorkingNode->GetData())` returns a nullptr. While there is no check for nullptr I'm wondering why the nifty image is not recognized as a LabelSetImage.
I guess something was not written correctly to the file.
To reproduce:
- open MITK, load a simple image
- create a new segmentation with a layer and a label (no need to draw something)
- right click on the segmentation node and store as Nifty (*.nii)
- remove the segmentation node from the data storage
- load the saved nifty file
- either while the segmentation view is still open
- close the segmentation view before loading and open it again after loading