Page MenuHomePhabricator

[LabelSetImage] Ambigious meaning of "layer" in LabelSetImage
Open, NormalPublic


Looking through the mitkLabelSetImage-class I found several functions that use the word layer or activeLayer but two different things are meant by this:

  1. the number / ID of the (current / active) layer
  2. the (current / active) label set

For 1. see void mitk::LabelSetImage::SetActiveLayer(unsigned int layer)
For 2. see unsigned int mitk::LabelSetImage::AddLayer(mitk::LabelSet::Pointer lset)

So this makes me thing what a "Layer" actually is. For me it seems as if this is basically the number / ID of a LabelSet in a LabelSetImage, since a LabelSetImage can contain multiple LabelSets (see std::vector<LabelSet::Pointer> m_LabelSetContainer inside mitkLabelSetImage.h).
newLabelSetId is also the returned variable inside the mentioned unsigned int mitk::LabelSetImage::AddLayer(mitk::LabelSet::Pointer lset).

This can also be seen by this functions:

mitk::LabelSet *mitk::LabelSetImage::GetLabelSet(unsigned int layer)
  if (m_LabelSetContainer.size() <= layer)
    return nullptr;
    return m_LabelSetContainer[layer].GetPointer();


unsigned int mitk::LabelSetImage::GetNumberOfLayers() const
  return m_LabelSetContainer.size();

However, there is also a std::vector<Image::Pointer> m_LayerContainer which is something completely different.

I want to discuss the names and see if we can simplify the concept and make the different names easier to understand.