ImFusion SDK 4.3
ImFusion::CT::GeometryUtils Namespace Reference

Utility functions for geometry processing and manipulation. More...

Detailed Description

Utility functions for geometry processing and manipulation.

Classes

struct  FullGeometryRepresentation
 Struct for the collection off all components needed to represent the full geometry of a frame. More...
 

Functions

void resetPersistentIndexAndRange (SharedImageSet &sis)
 Reset persistent index and range parameters for SharedImageSet.
 
std::vector< FullGeometryRepresentationperFrameGeometry (const SharedImageSet &sis)
 Collect the perFrameGeometry for all frames in a given SharedImageSet.
 
FullGeometryRepresentation frameGeometryFromOpenCVMatrix (const mat34 &matrix, int width, int height, const vec2 &pixelSpacing)
 Converts an OpenCV projection matrix to FullGeometryRepresentation.
 
FullGeometryRepresentation frameGeometryFromOpenCVMatrixComponents (const mat3 &K, const mat3 &R, const vec3 &t, const vec2 &detSpacing, const vec2i &detDim)
 Converts the OpenCV projection matrix components to FullGeometryRepresentation.
 
FullGeometryRepresentation frameGeometryFromOpenGLMatrix (const mat4 &matrix, const vec2 &detSize)
 Converts an OpenGL projection matrix to FullGeometryRepresentation.
 
FullGeometryRepresentation frameGeometryFromOpenGLMatrix (const mat4 &matrix, int width, int height, const vec2 &pixelSpacing)
 Converts an OpenGL projection matrix to FullGeometryRepresentation.
 
std::vector< FullGeometryRepresentationconvertConeBeamGeometryToPerFrameGeometry (const ConeBeamGeometry &geom, int numFrames)
 Compute the perFrameGeometry for a given ConeBeamGeometry.
 
void applyFullGeometryRepresentation (SharedImageSet &sis, const FullGeometryRepresentation &geom, int frame)
 Apply FullGeometryRepresentation to a single frame of a SharedImageSet.
 
void applyFullGeometryRepresentation (SharedImageSet &sis, const std::vector< FullGeometryRepresentation > &geom)
 Apply FullGeometryRepresentation to SharedImageSet.
 
std::tuple< mat3, mat3, vec3 > matrixComponentsOpenCVToImage (const FullGeometryRepresentation &geom)
 Return K (to image (mm)), R, t in OpenCV convention represented by this ConeBeamGeometry.
 
std::tuple< mat3, mat3, vec3 > matrixComponentsOpenCVToPixel (const FullGeometryRepresentation &geom)
 Return K (to image (px)), R, t in OpenCV convention represented by this ConeBeamGeometry.
 
mat34 matrixOpenCVToImage (const FullGeometryRepresentation &geom)
 Return P = K (to image (mm)) * [R | t] in OpenCV convention represented by this ConeBeamGeometry.
 
mat34 matrixOpenCVToPixel (const FullGeometryRepresentation &geom)
 Return P = K (to image (px)) * [R | t] in OpenCV convention represented by this ConeBeamGeometry.
 
std::tuple< mat4, mat4 > matrixComponentsGl (const FullGeometryRepresentation &geom)
 Return projection matrices in OpenGL convention, i.e. PM and MV.
 
mat4 matrixGlToImage (const FullGeometryRepresentation &geom)
 Return full projection matrix in OpenGL convention (.
 
mat4 matrixGlToImageTopLeft (const FullGeometryRepresentation &geom)
 Returns the projection matrix from matrix() but with the y-axis being flipped as we use a top-left system for our images.
 
mat4 matrixFromWorldToImage (const FullGeometryRepresentation &geom)
 Returns transformation matrix from world to image.
 
mat4 matrixFromImageToWorld (const FullGeometryRepresentation &geom)
 Returns transformation matrix from image to world.
 
vec3 sourcePositionWorld (const FullGeometryRepresentation &geom)
 Return source position in world coordinates.
 
double sourceToDetectorDistance (const FullGeometryRepresentation &geom)
 Returns the sourceToDetectorDistance in mm.
 
std::tuple< mat3, mat3, vec3 > matrixComponentsOpenCVToImage (const SharedImageSet &sis, int frame)
 Return K (to image (mm)), R, t in OpenCV convention represented by this ConeBeamGeometry.
 
std::tuple< mat3, mat3, vec3 > matrixComponentsOpenCVToPixel (const SharedImageSet &sis, int frame)
 Return K (to image (px)), R, t in OpenCV convention represented by this ConeBeamGeometry.
 
mat34 matrixOpenCVToImage (const SharedImageSet &sis, int frame)
 Return P = K (to image (mm)) * [R | t] in OpenCV convention represented by this ConeBeamGeometry.
 
mat34 matrixOpenCVToPixel (const SharedImageSet &sis, int frame)
 Return P = K (to image (px)) * [R | t] in OpenCV convention represented by this ConeBeamGeometry.
 
std::tuple< mat4, mat4 > matrixComponentsGl (const SharedImageSet &sis, int frame)
 Return projection matrices in OpenGL convention, i.e. PM and MV.
 
mat4 matrixGlToImage (const SharedImageSet &sis, int frame)
 Return full projection matrix in OpenGL convention (.
 
mat4 matrixGlToImageTopLeft (const SharedImageSet &sis, int frame)
 Returns the projection matrix from matrix() but with the y-axis being flipped as we use a top-left system for our images.
 
mat4 matrixFromWorldToImage (const SharedImageSet &sis, int frame)
 Returns transformation matrix from world to image.
 
mat4 matrixFromImageToWorld (const SharedImageSet &sis, int frame)
 Returns transformation matrix from image to world.
 
vec3 sourcePositionWorld (const SharedImageSet &sis, int frame)
 Return source position in world coordinates.
 
double sourceToDetectorDistance (const SharedImageSet &sis, int frame)
 

Function Documentation

◆ frameGeometryFromOpenCVMatrix()

FullGeometryRepresentation frameGeometryFromOpenCVMatrix ( const mat34 & matrix,
int width,
int height,
const vec2 & pixelSpacing )

Converts an OpenCV projection matrix to FullGeometryRepresentation.

Parameters
matrixOpenCV projection matrix
detSizesize of the detector in mm

◆ frameGeometryFromOpenCVMatrixComponents()

FullGeometryRepresentation frameGeometryFromOpenCVMatrixComponents ( const mat3 & K,
const mat3 & R,
const vec3 & t,
const vec2 & detSpacing,
const vec2i & detDim )

Converts the OpenCV projection matrix components to FullGeometryRepresentation.

Note
The input matrices should be in OpenCV convention. I.e. K is in pixel units
Parameters
KK matrix in OpenCV convention
RR matrix in OpenCV convention
tt vector in OpenCV convention
detSpacingspacing of the detector pixel in mm
detDimdimension of the detector in pixel

◆ frameGeometryFromOpenGLMatrix() [1/2]

FullGeometryRepresentation frameGeometryFromOpenGLMatrix ( const mat4 & matrix,
const vec2 & detSize )

Converts an OpenGL projection matrix to FullGeometryRepresentation.

Note
The image descriptor of the returned FullGeometryRepresentation will contain a dummy descriptor. Specifically, it will contain an ImageDescriptorWorld with a single pixel, where the spacing is set to
Parameters
detSize,ensuringthat the extent is also
detSize.
matrixOpenGL projection matrix
detSizesize of the detector in mm

◆ frameGeometryFromOpenGLMatrix() [2/2]

FullGeometryRepresentation frameGeometryFromOpenGLMatrix ( const mat4 & matrix,
int width,
int height,
const vec2 & pixelSpacing )

Converts an OpenGL projection matrix to FullGeometryRepresentation.

Sets the image descriptor of FullGeometryRepresentation with respect to

Parameters
width

param height , and

Parameters
pixelSpacingcorrectly
widthin pixels
heightin pixels
pixelSpacingpixel sizes in mm

◆ convertConeBeamGeometryToPerFrameGeometry()

std::vector< FullGeometryRepresentation > convertConeBeamGeometryToPerFrameGeometry ( const ConeBeamGeometry & geom,
int numFrames )

Compute the perFrameGeometry for a given ConeBeamGeometry.

Warning
since this function does not know the number of pixels per frame if sis is nullptr, it defaults to a homogeneous pixel spacing of 1

◆ matrixComponentsOpenCVToImage()

std::tuple< mat3, mat3, vec3 > matrixComponentsOpenCVToImage ( const FullGeometryRepresentation & geom)

Return K (to image (mm)), R, t in OpenCV convention represented by this ConeBeamGeometry.

Note
By image coordinate system, we refer to the coordinate systems as defined in Coordinate Systems. I.e. the image system has the origin in the center.

◆ matrixComponentsOpenCVToPixel()

std::tuple< mat3, mat3, vec3 > matrixComponentsOpenCVToPixel ( const FullGeometryRepresentation & geom)

Return K (to image (px)), R, t in OpenCV convention represented by this ConeBeamGeometry.

Note
By pixel coordinate system, we refer to the coordinate systems as defined in Coordinate Systems. I.e. the pixel system has the origin at the top-left corner.

◆ matrixOpenCVToImage()

mat34 matrixOpenCVToImage ( const FullGeometryRepresentation & geom)

Return P = K (to image (mm)) * [R | t] in OpenCV convention represented by this ConeBeamGeometry.

Note
By image coordinate system, we refer to the coordinate systems as defined in Coordinate Systems. I.e. the image system has the origin in the center.

◆ matrixOpenCVToPixel()

mat34 matrixOpenCVToPixel ( const FullGeometryRepresentation & geom)

Return P = K (to image (px)) * [R | t] in OpenCV convention represented by this ConeBeamGeometry.

Note
By pixel coordinate system, we refer to the coordinate systems as defined in Coordinate Systems. I.e. the pixel system has the origin at the top-left corner.

◆ matrixGlToImage() [1/2]

mat4 matrixGlToImage ( const FullGeometryRepresentation & geom)

Return full projection matrix in OpenGL convention (.

See also
matrixComponentsGl())

◆ matrixGlToImageTopLeft() [1/2]

mat4 matrixGlToImageTopLeft ( const FullGeometryRepresentation & geom)

Returns the projection matrix from matrix() but with the y-axis being flipped as we use a top-left system for our images.

Same is true for our texture coordinates in OpenGL. By default our origin in texture coordinates is at the top-left corner

◆ matrixGlToImage() [2/2]

mat4 matrixGlToImage ( const SharedImageSet & sis,
int frame )

Return full projection matrix in OpenGL convention (.

Note
This function also supports the legacy geometry

◆ matrixGlToImageTopLeft() [2/2]

mat4 matrixGlToImageTopLeft ( const SharedImageSet & sis,
int frame )

Returns the projection matrix from matrix() but with the y-axis being flipped as we use a top-left system for our images.

Note
This function also supports the legacy geometry
Search Tab / S to search, Esc to close