Page MenuHomePhabricator

mitk::image::GetPixelValueByIndex cannot be called from const pointer
Closed, ResolvedPublic

Description

mitk::image::GetPixelValueByIndex cannot be called from coinstPointer.
Only from normal mitk::Image::Pointer

Event Timeline

Declaring the GetData() as const method, which would be the best solution is not quite easy, since there are multiple non-const methods on the object called and they cannot be declared as const.

This should got solved by introducing the ImageAccessor ( @Joseph ? )

No it is not. Due to a missing const-correctness in Image and ImageDataItem, ImageAccessors also need a non-const pointer. One reason for this problem is T13324

Image::GetPixelValueByIndex is actually deprecated, but the same problem occurs with ImagePixelReadAccessor::GetPixelByIndexSafe, since the constructor of ImageAccessorBase needs a non-const image pointer.

Work on T17931 enabled the image read accessor classes to operate on a const image.