|
new file mode 100644 | |
1 1 | 174 movingInterpolator.SetThreshold(threshold) # We can then specify a threshold above which the volume's intensities will be integrated. 1 import itk 2 from sys import argv 3 import numpy as np 4 5 if len(argv) != 4: 6 print("Usage: " + argv[0] + " <fixed2DImage> " + " <moving3DVolume> " + " <outputImage> " ) 7 exit(1) 8 9 10 # ---------- User-defined parameters ---------------- 11 movInitTranslx = 0. 12 movInitTransly = 0. 13 movInitTranslz = 0. 14 15 # parameters for the Ray cast interpolator (same ones used to generate the FixedImage) 16 focal_length = 1000. 17 threshold = 0 # threshold above which the volume's intensities will be integrated. 18 19 # parameters for the resampled DRR (same ones used to generate the FixedImage) 20 dx = 1000 # size (# pixels) of the output image 21 dy = 1000 # size (# pixels) of the output image 22 sx = 0.5 # spacing x [mm] of the output image 23 sy = 0.5 # spacing y [mm] of the output image 24 o2Dx = 0 # principal points coordinate x [mm] (usually the 2D projection normal is assumed to be perpendicular ) 25 o2Dy = 0 # principal points coordinate y [mm] 26 27 # ---------- Initializations ---------------- 28 fixedImageFile = argv[1] 29 movingImageFile = argv[2] 30 31 PixelType = itk.F 32 Dimension = 3 33 ScalarType = itk.D 34 35 FixedImageType = itk.Image[PixelType, Dimension] 36 MovingImageType = itk.Image[PixelType, Dimension] 37 38 fixedImageReader = itk.ImageFileReader[FixedImageType].New() 39 movingImageReader = itk.ImageFileReader[MovingImageType].New() 40 41 OptimizerType = itk.RegularStepGradientDescentOptimizerv4[ScalarType] 42 43 RegistrationType = itk.ImageRegistrationMethodv4[FixedImageType, 44 MovingImageType] 45 46 TransformType = itk.TranslationTransform[ScalarType, Dimension] 47 48 MetricType = itk.MeanSquaresImageToImageMetricv4[FixedImageType, 49 MovingImageType] 50 51 FixedInterpolatorType = itk.LinearInterpolateImageFunction[FixedImageType, ScalarType] 52 MovingInterpolatorType = itk.RayCastInterpolateImageFunction[MovingImageType, ScalarType] 53 54 #WriterTypeOutput = itk.ImageFileWriter[OutputImageType] 55 56 57 # ---------- Instantiate the classes for the registration framework ---------------- |