summaryrefslogtreecommitdiffstats
path: root/Wrappers
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2018-04-17 18:07:25 +0100
committerEdoardo Pasca <edo.paskino@gmail.com>2018-04-17 18:07:25 +0100
commit1d7313fe6f66d4b87efab95c88cd510ff44e26e1 (patch)
tree8183e0ff30817ce38927b49e4b2c813fb9a9955c /Wrappers
parent1f9e7441198a6f088dfed311a067e8acf05d4d3b (diff)
downloadframework-plugins-1d7313fe6f66d4b87efab95c88cd510ff44e26e1.tar.gz
framework-plugins-1d7313fe6f66d4b87efab95c88cd510ff44e26e1.tar.bz2
framework-plugins-1d7313fe6f66d4b87efab95c88cd510ff44e26e1.tar.xz
framework-plugins-1d7313fe6f66d4b87efab95c88cd510ff44e26e1.zip
added setupCCPiGeometries
Diffstat (limited to 'Wrappers')
-rwxr-xr-xWrappers/Python/ccpi/plugins/processors.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/Wrappers/Python/ccpi/plugins/processors.py b/Wrappers/Python/ccpi/plugins/processors.py
index e05c6ca..df580e0 100755
--- a/Wrappers/Python/ccpi/plugins/processors.py
+++ b/Wrappers/Python/ccpi/plugins/processors.py
@@ -27,6 +27,51 @@ from scipy import ndimage
import matplotlib.pyplot as plt
+def setupCCPiGeometries(voxel_num_x, voxel_num_y, voxel_num_z, angles, counter):
+
+ vg = ImageGeometry(voxel_num_x=voxel_num_x,voxel_num_y=voxel_num_y, voxel_num_z=voxel_num_z)
+ Phantom_ccpi = ImageData(geometry=vg,
+ dimension_labels=['horizontal_x','horizontal_y','vertical'])
+ #.subset(['horizontal_x','horizontal_y','vertical'])
+ # ask the ccpi code what dimensions it would like
+
+ voxel_per_pixel = 1
+ geoms = pbalg.pb_setup_geometry_from_image(Phantom_ccpi.as_array(),
+ angles,
+ voxel_per_pixel )
+
+ pg = AcquisitionGeometry('parallel',
+ '3D',
+ angles,
+ geoms['n_h'], 1.0,
+ geoms['n_v'], 1.0 #2D in 3D is a slice 1 pixel thick
+ )
+
+ center_of_rotation = Phantom_ccpi.get_dimension_size('horizontal_x') / 2
+ ad = AcquisitionData(geometry=pg,dimension_labels=['angle','vertical','horizontal'])
+ geoms_i = pbalg.pb_setup_geometry_from_acquisition(ad.as_array(),
+ angles,
+ center_of_rotation,
+ voxel_per_pixel )
+
+ #print (counter)
+ counter+=1
+ #print (geoms , geoms_i)
+ if counter < 4:
+ if (not ( geoms_i == geoms )):
+ print ("not equal and {0}".format(counter))
+ X = max(geoms['output_volume_x'], geoms_i['output_volume_x'])
+ Y = max(geoms['output_volume_y'], geoms_i['output_volume_y'])
+ Z = max(geoms['output_volume_z'], geoms_i['output_volume_z'])
+ return setupCCPiGeometries(X,Y,Z,angles, counter)
+ else:
+ print ("return geoms {0}".format(geoms))
+ return geoms
+ else:
+ print ("return geoms_i {0}".format(geoms_i))
+ return geoms_i
+
+
class CCPiForwardProjector(DataProcessor):
'''Normalization based on flat and dark