CastToItk behaves differently depending on the original data type and the target data type:
if the target type is the same as the original, only a pointer to the data is set
thus increasing the reference count, whereas if the data types differ a new itk image is created, and the reference counter to the original image remains the same.
This will cause problems where the modified data is converted back to Mitk using
GrabItkImageMemory - upon descruction of the original image the reference counts seem to be wrong and the program crashes.
Dirty quickfix so far is not to perform a GrabItkImageMemory if the data type is the same as the target (CastToItk).
This is a undefiend behavior that will result in nasty bugs/crashed