/// <summary> /// Create scalar copy of vtkImageData. /// </summary> /// <param name="data">Input data.</param> /// <returns>Copied data.</returns> public static vtkImageData scalarCopy(vtkImageData data) { /*DEPRECATED!!*/ //Get data extent int[] dims = data.GetExtent(); vtkImageData newdata = vtkImageData.New(); newdata.SetExtent(dims[0], dims[1], dims[2], dims[3], dims[4], dims[5]); for (int h = dims[0]; h <= dims[1]; h++) { for (int w = dims[2]; w <= dims[3]; w++) { for (int d = dims[4]; d <= dims[5]; d++) { double scalar = data.GetScalarComponentAsDouble(h, w, d, 0); newdata.SetScalarComponentFromDouble(h, w, d, 0, scalar); } } } return(newdata); }