/// <summary> /// Write ITK image to file. /// </summary> /// <param name="img">image</param> /// <param name="outputFileName">output filename</param> public static void WriteSitkImage(sitk.Image img, string outputFileName) { sitk.ImageFileWriter writer = new sitk.ImageFileWriter(); writer.SetFileName(outputFileName); writer.Execute(img); writer.Dispose(); }
/// <summary> /// Write transformed file to disk. /// </summary> /// <param name="imagename">filename</param> public static void WriteTransformedImage(sitk.Image img, string fullFilename) { sitk.CastImageFilter castImageFilter = new sitk.CastImageFilter(); castImageFilter.SetOutputPixelType(sitk.PixelIDValueEnum.sitkVectorUInt8); sitk.Image temp = castImageFilter.Execute(img); sitk.ImageFileWriter writer = new sitk.ImageFileWriter(); writer.SetFileName(fullFilename); writer.Execute(temp); }
/// <summary> /// Write transformed image to disk. /// </summary> /// <param name="imagename">image filename</param> public void WriteTransformedImage(string imagename) { sitk.CastImageFilter castImageFilter = new sitk.CastImageFilter(); castImageFilter.SetOutputPixelType(sitk.PixelIDValueEnum.sitkVectorUInt8); sitk.Image temp = castImageFilter.Execute(transformedImage); sitk.ImageFileWriter writer = new sitk.ImageFileWriter(); writer.SetFileName(Path.Combine(registrationParameters.OutputDirectory, imagename)); writer.Execute(temp); }
public itk.simple.Image WstepnePrzetwarzanie(itk.simple.Image image) { itk.simple.BinaryMorphologicalClosingImageFilter closer = new BinaryMorphologicalClosingImageFilter(); closer.SetKernelType(KernelEnum.sitkCross); closer.SetKernelRadius(1); closer.SetForegroundValue(511); itk.simple.Image imClose = closer.Execute(image); itk.simple.SmoothingRecursiveGaussianImageFilter gauss = new SmoothingRecursiveGaussianImageFilter(); gauss.SetSigma(1); itk.simple.Image gausImage = gauss.Execute(imClose); itk.simple.CastImageFilter caster = new CastImageFilter(); caster.SetOutputPixelType(itk.simple.PixelIDValueEnum.sitkInt16); itk.simple.Image castImage = caster.Execute(gausImage); itk.simple.ImageFileWriter writer = new itk.simple.ImageFileWriter(); writer.SetFileName("WstepnePrzetwarzanie.dcm"); writer.Execute(image); return(castImage); }
public static void WriteImage(sitk.Image image, string fileName) { sitk.ImageFileWriter imageFileWriter = new sitk.ImageFileWriter(); imageFileWriter.SetFileName(fileName); imageFileWriter.Execute(image); }
public itk.simple.Image WstepnePrzetwarzanie(itk.simple.Image image) { itk.simple.BinaryMorphologicalClosingImageFilter closer = new BinaryMorphologicalClosingImageFilter(); closer.SetKernelType(KernelEnum.sitkCross); closer.SetKernelRadius(1); closer.SetForegroundValue(511); itk.simple.Image imClose = closer.Execute(image); itk.simple.SmoothingRecursiveGaussianImageFilter gauss = new SmoothingRecursiveGaussianImageFilter(); gauss.SetSigma(1); itk.simple.Image gausImage = gauss.Execute(imClose); itk.simple.CastImageFilter caster = new CastImageFilter(); caster.SetOutputPixelType(itk.simple.PixelIDValueEnum.sitkInt16); itk.simple.Image castImage = caster.Execute(gausImage); itk.simple.ImageFileWriter writer = new itk.simple.ImageFileWriter(); writer.SetFileName("WstepnePrzetwarzanie.dcm"); writer.Execute(image); return castImage; }
static void SaveImage(sitk.Image image, string pathToFile) { sitk.ImageFileWriter writer = new sitk.ImageFileWriter(); writer.SetFileName(pathToFile); writer.Execute(image); }