20 from __future__
import print_function
21 from __future__
import division
23 import SimpleITK
as sitk
28 if len ( sys.argv ) < 4:
29 print(
"Usage: FFTConvolution <input> <kernel> <output>" )
33 inputFileName = sys.argv[1]
34 kernelFileName = sys.argv[2]
35 outputFileName = sys.argv[3]
43 pixelID = img.GetPixelID()
63 stats.Execute( kernel )
64 kernel =
sitk.Cast( kernel / stats.GetSum(), sitk.sitkFloat32 )
67 upadding[0] = int( math.floor( (size[0] - kernel.GetSize()[0])/2.0 ) )
68 upadding[1] = int( math.floor( (size[1] - kernel.GetSize()[1])/2.0 ) )
71 lpadding[0] = int( math.ceil( (size[0] - kernel.GetSize()[0])/2.0 ) )
72 lpadding[1] = int( math.ceil( (size[1] - kernel.GetSize()[1])/2.0 ) )
81 fftkernel.SetSpacing( fftimg.GetSpacing() )
82 fftkernel.SetOrigin( fftimg.GetOrigin() )
83 fftkernel.SetDirection( fftimg.GetDirection() )
99 if (
not "SITK_NOSHOW" in os.environ ):
SITKIO_EXPORT void WriteImage(const Image &image, const std::vector< std::string > &fileNames, bool useCompression=false)
Image MirrorPad(const Image &image1, const std::vector< unsigned int > &padLowerBound=std::vector< unsigned int >(3, 0), const std::vector< unsigned int > &padUpperBound=std::vector< unsigned int >(3, 0))
Increase the image size by padding with replicants of the input image value.
Compute min. max, variance and mean of an Image .
void SITKIO_EXPORT Show(const Image &image, const std::string &title="", const bool debugOn=ProcessObject::GetGlobalDefaultDebug())
Image ConstantPad(const Image &image1, const std::vector< unsigned int > &padLowerBound=std::vector< unsigned int >(3, 0), const std::vector< unsigned int > &padUpperBound=std::vector< unsigned int >(3, 0), double constant=0.0)
Increase the image size by padding with a constant value.
Image Flip(const Image &image1, const std::vector< bool > &flipAxes=std::vector< bool >(3, false), bool flipAboutOrigin=false)
Flips an image across user specified axes.
Image Cast(const Image &image, PixelIDValueEnum pixelID)
Image ForwardFFT(const Image &image1)
Base class for forward Fast Fourier Transform .
Image InverseFFT(const Image &image1)
Base class for inverse Fast Fourier Transform .
Image FFTShift(const Image &image1, bool inverse=false)
Shift the zero-frequency components of a Fourier transform to the center of the image.
Image Crop(const Image &image1, const std::vector< unsigned int > &lowerBoundaryCropSize=std::vector< unsigned int >(3, 0), const std::vector< unsigned int > &upperBoundaryCropSize=std::vector< unsigned int >(3, 0))
Decrease the image size by cropping the image by an itk::Size at both the upper and lower bounds of t...
SITKIO_EXPORT Image ReadImage(const std::vector< std::string > &fileNames, PixelIDValueEnum outputPixelType=sitkUnknown)
ReadImage is a procedural interface to the ImageSeriesReader class which is convenient for most image...