3D Geometries

Volume geometry

Create a 3D volume geometry:

vol_geom = astra.create_vol_geom([n_rows, n_cols, n_slices])
vol_geom = astra.create_vol_geom(n_rows, n_cols, n_slices)

Specify the extent of the 3D volume (note that rows are oriented along the Y axis, columns along the X axis and slices along the Z axis):

vol_geom = astra.create_vol_geom(
    n_rows, n_cols, n_slices,
    min_x, max_x,
    min_y, max_y,
    min_z, max_z
)

This can be used to control the voxel size, including specifying anisotropic voxels (note that the FDK algorithm does not currently support anisotropic voxels and will raise an exception).

Projection geometries

parallel3d

proj_geom = astra.create_proj_geom('parallel3d', det_col_spacing, det_row_spacing, det_row_count, det_col_count, angles)

Create a 3D parallel beam geometry.

  • det_col_spacing : distance between the centers of two horizontally adjacent detector pixels

  • det_row_spacing : distance between the centers of two vertically adjacent detector pixels

  • det_row_count : number of detector rows in a single projection

  • det_col_count : number of detector columns in a single projection

  • angles : projection angles in radians

cone

proj_geom = astra.create_proj_geom('cone',  det_col_spacing, det_row_spacing, det_row_count, det_col_count, angles, source_origin_distance, origin_detector_distance)

Create a 3D cone beam geometry.

  • det_col_spacing : distance between the centers of two horizontally adjacent detector pixels

  • det_row_spacing : distance between the centers of two vertically adjacent detector pixels

  • det_row_count : number of detector rows in a single projection

  • det_col_count : number of detector columns in a single projection

  • angles : projection angles in radians

  • source_origin_distance : distance between the source and the center of rotation

  • origin_detector_distance : distance between the center of rotation and the detector array

parallel3d_vec

proj_geom = astra.create_proj_geom('parallel3d_vec',  det_row_count, det_col_count, vectors)

Create a 3D parallel beam geometry specified by 3D vectors.

  • det_row_count : number of detector rows in a single projection

  • det_col_count : number of detector columns in a single projection

  • vectors : a matrix defining the geometry

Each row of vectors corresponds to a single projection, and consists of:

( dirX, dirY, dirZ, dX, dY, dZ, uX, uY, uZ, vX, vY, vZ )
  • dir : the illumination direction

  • d : the detector center coordinate

  • u : the vector from detector pixel (0,0) to (0,1)

  • v : the vector from detector pixel (0,0) to (1,0)

To illustrate this, here is a script to convert a single projection in a geometry of type “parallel3d” into such a 12-element row:

# ray direction
vectors[i,0] = numpy.sin(proj_geom['ProjectionAngles'][i])
vectors[i,1] = -numpy.cos(proj_geom['ProjectionAngles'][i])
vectors[i,2] = 0

# center of detector
vectors[i,3] = 0
vectors[i,4] = 0
vectors[i,5] = 0

# vector from detector pixel (0,0) to (0,1)
vectors[i,6] = numpy.cos(proj_geom['ProjectionAngles'][i]) * proj_geom['DetectorSpacingX']
vectors[i,7] = numpy.sin(proj_geom['ProjectionAngles'][i]) * proj_geom['DetectorSpacingX']
vectors[i,8] = 0

# vector from detector pixel (0,0) to (1,0)
vectors[i, 9] = 0
vectors[i,10] = 0
vectors[i,11] = proj_geom['DetectorSpacingY']

This conversion is also available as a function in the toolbox:

proj_geom_vec = astra.geom_2vec(proj_geom)

cone_vec

proj_geom = astra.create_proj_geom('cone_vec',  det_row_count, det_col_count, vectors)

Create a 3D cone beam geometry specified by 3D vectors.

  • det_row_count : number of detector rows in a single projection

  • det_col_count : number of detector columns in a single projection

  • vectors : a matrix defining the geometry

Each row of vectors corresponds to a single projection, and consists of:

( srcX, srcY, srcZ, dX, dY, dZ, uX, uY, uZ, vX, vY, vZ )
  • src : the illumination source position

  • d : the detector center coordinate

  • u : the vector from detector pixel (0,0) to (0,1)

  • v : the vector from detector pixel (0,0) to (1,0)

To illustrate this, here is a script to convert a single projection in a geometry of type “cone” into such a 12-element row:

# source
vectors[i,0] = numpy.sin(proj_geom['ProjectionAngles'][i]) * proj_geom['DistanceOriginSource']
vectors[i,1] = -numpy.cos(proj_geom['ProjectionAngles'][i]) * proj_geom['DistanceOriginSource']
vectors[i,2] = 0

# center of detector
vectors[i,3] = -numpy.sin(proj_geom['ProjectionAngles'][i]) * proj_geom['DistanceOriginDetector']
vectors[i,4] = numpy.cos(proj_geom['ProjectionAngles'][i]) * proj_geom['DistanceOriginDetector']
vectors[i,5] = 0

# vector from detector pixel (0,0) to (0,1)
vectors[i,6] = numpy.cos(proj_geom['ProjectionAngles'][i]) * proj_geom['DetectorSpacingX']
vectors[i,7] = numpy.sin(proj_geom['ProjectionAngles'][i]) * proj_geom['DetectorSpacingX']
vectors[i,8] = 0

# vector from detector pixel (0,0) to (1,0)
vectors[i, 9] = 0
vectors[i,10] = 0
vectors[i,11] = proj_geom['DetectorSpacingY']

cyl_cone_vec

Added in version 2.4.

Caution

This is an experimental feature, and the parameters or implementation may change in future releases.

proj_geom = astra.create_proj_geom('cyl_cone_vec',  det_row_count, det_col_count, vectors)

Create a 3D cylindrical detector cone beam geometry specified by 3D vectors. U axis of the detector will be curved.

  • det_row_count : number of detector rows in a single projection

  • det_col_count : number of detector columns in a single projection

  • vectors : a matrix defining the geometry

Each row of vectors corresponds to a single projection, and consists of:

( srcX, srcY, srcZ, dX, dY, dZ, uX, uY, uZ, vX, vY, vZ, R )
  • src : the illumination source position

  • d : the detector center coordinate

  • uthe vector tangential to the curved detector surface at the center of the

    detector; with length equal to the arc length covered by one column of the detector

  • v : the vector from detector pixel (0,0) to (1,0)

  • R : curvature radius of the cylindrical detector (U axis will be curved)