See http://docs.mitk.org/nightly-qt4/MitkImagePage.html#MitkImagePage_ImageAccessors
try
{
itk::Index<2> idx = {{ 12, 34 }}; mitk::ImagePixelReadAccessor<short,2> readAcces(image, image->GetSliceData(2)); short value = readAccess.GetPixelByIndex(idx); mitk::ImagePixelWriteAccessor<short,2> writeAccess(image, image->GetSliceData(4)); writeAccess.SetPixelByIndex(idx, 42);
}
catch(mitk::Exception& e)
{
// deal with the situation not to have access
}
The mistake is not very obvious and I always keep looking for missing includes, however, there is an "s" missing in the declaration of "readAcces".