Is your feature request related to a problem? Please describe.
Thanks for the great work. I am using tiger's AX method to get a projection of a CT image, but what are the intrinsic and extrinsic matrices for this projection?
How should I calculate these?
Describe the solution you'd like
···
class ConeGeometry(object):
"""
Cone beam CT geometry. Note that we convert to meter from millimeter.
"""
def init(self, data):
# VARIABLE DESCRIPTION UNITS
# -------------------------------------------------------------------------------------
self.DSD = data["DSD"]/1000 # Distance Source Detector (m) 2
self.DSO = data["DSO"]/1000 # Distance Source Origin (m) 1
# Detector parameters
self.nDetector = np.array(data["nDetector"]) # number of pixels 256 (px)
self.dDetector = np.array(data["dDetector"])/1000 # size of each pixel 0.002 (m)
self.sDetector = self.nDetector * self.dDetector # total size of the detector 0.512 (m)
# Image parameters
self.nVoxel = np.array(data["nVoxel"]) # number of voxels 256 (vx)
self.dVoxel = np.array(data["dVoxel"])/1000 # size of each voxel 0.001 (m)
self.sVoxel = self.nVoxel * self.dVoxel # total size of the image 0.256 (m)
# Offsets
self.offOrigin = np.array(data["offOrigin"])/1000 # Offset of image from origin (m)
self.offDetector = np.array(data["offDetector"])/1000 # Offset of Detector (m)
# Auxiliary
self.accuracy = data["accuracy"] # Accuracy of FWD proj (vx/sample) # noqa: E501
# Mode
self.mode = data["mode"] # parallel, cone ...
self.filter = data["filter"]
def compute_intrinsics(self):
# Focal lengths in terms of pixel size
f_x = self.DSD /self.dDetector[0]
f_y = self.DSD /self.dDetector[1]
# Principal point
c_x = self.nDetector[0] / 2 + self.offDetector[0] / self.dDetector[0]
c_y = self.nDetector[1] / 2 + self.offDetector[1] / self.dDetector[1]
# Intrinsic camera matrix
K = np.array([
[f_x, 0, c_x],
[0, f_y, c_y],
[0, 0, 1]
])
return K
def compute_extrinsics(self,angle):
# Extrinsic camera matrix
phi1 = -np.pi / 2
R1 = np.array([[1.0, 0.0, 0.0],
[0.0, np.cos(phi1), -np.sin(phi1)],
[0.0, np.sin(phi1), np.cos(phi1)]])
phi2 = np.pi / 2
R2 = np.array([[np.cos(phi2), -np.sin(phi2), 0.0],
[np.sin(phi2), np.cos(phi2), 0.0],
[0.0, 0.0, 1.0]])
R3 = np.array([[np.cos(angle), -np.sin(angle), 0.0],
[np.sin(angle), np.cos(angle), 0.0],
[0.0, 0.0, 1.0]])
rot = np.dot(np.dot(R3, R2), R1)
trans = np.array([self.DSO * np.cos(angle), self.DSO * np.sin(angle), 0])
T = np.eye(4)
T[:-1, :-1] = rot
T[:-1, -1] = trans
return T
···
Is your feature request related to a problem? Please describe. Thanks for the great work. I am using tiger's AX method to get a projection of a CT image, but what are the intrinsic and extrinsic matrices for this projection? How should I calculate these? Describe the solution you'd like ··· class ConeGeometry(object): """ Cone beam CT geometry. Note that we convert to meter from millimeter. """ def init(self, data):
Is this calculation correct?