Пример #1
0
 /// <summary>
 /// Interpolate image by interpolation type and output pixel type.
 /// </summary>
 /// <param name="img"></param>
 /// <param name="interpolator"></param>
 /// <param name="pixelIDValueEnum"></param>
 /// <returns>interpolated image</returns>
 public static sitk.Image InterpolateImage(sitk.Image img, sitk.InterpolatorEnum interpolator, sitk.PixelIDValueEnum pixelIDValueEnum, double defaultPixelType = 0.0)
 {
     sitk.ResampleImageFilter resampleImageFilter = new sitk.ResampleImageFilter();
     resampleImageFilter.SetSize(img.GetSize());
     resampleImageFilter.SetOutputOrigin(img.GetOrigin());
     resampleImageFilter.SetOutputDirection(img.GetDirection());
     resampleImageFilter.SetOutputSpacing(img.GetSpacing());
     resampleImageFilter.SetInterpolator(interpolator);
     resampleImageFilter.SetOutputPixelType(pixelIDValueEnum);
     resampleImageFilter.SetDefaultPixelValue(defaultPixelType);
     return(resampleImageFilter.Execute(img));
 }
 /// <summary>
 /// Set interpolation type manually.
 /// </summary>
 /// <param name="interpolationType">interpolation method</param>
 public void SetInterpolationType(sitk.InterpolatorEnum interpolationType)
 {
     this.interpolationType = interpolationType;
 }