The mean was computed with a minus operator...
New problem identified : when SetImage is called after the crop, the SliceOrientation is always 2!
// Prevent crash when reload -> change slice if outside extent
if (Slice < extent[SliceOrientation*2] || Slice>=extent[SliceOrientation*2+1]) {
- Slice = (extent[SliceOrientation*2+1]-extent[SliceOrientation*2])/2.0;
+ Slice = (extent[SliceOrientation*2+1]+extent[SliceOrientation*2])/2.0;
}
// Make sure that the required part image has been computed