Skip to content

ImageCPRMapper

Introduction

CPR in vtkImageCPRMapper stands for Curved Planar Reformation. This mapper can be used to visualize tubular structures such as blood vessels. It can be used in projected mode, stretched mode or straightened mode depending on the settings @see getUseUniformOrientation , @see getCenterPoint and the distance function of @see getOrientedCenterline .

This specialised mapper takes as input a vtkImageData representing a volume ( @see setImageData ) and a vtkPolyData representing a centerline ( @see setCenterlineData ). The mapper also need to have an orientation per point or for all points. This can be specified using a uniform orientation ( @see getUniformOrientation @see getUseUniformOrientation ) or a point data array ( @see getOrientationArrayName ). Every point, vector or length specified to the mapper (centerline points, orientation, width...) use model coordinates of the volume used as input ( @see setImageData ).

For each segment of the centerline the mapper creates a quad of the specified width ( @see getWidth ) and of height equal to the length of the segment. The position and the orientation of the centerline are interpolated along the y-axis of the quad. The position is linearly interpolated (lerp) and the orientation is interpolated using spherical linear interpolation (slerp). For a point (x, y) on the quad, the value of y gives the interpolated position P and interpolated orientation O which combined with tangentDirection gives D ( @see getTangentDirection ). The value of x between -0.5 and 0.5 then gives the position to sample in the volume: P + x*D.

By computing the right centerline positions and orientations, one can simulate Stretched CPR and Straightened CPR.

This class resolves coincident topology with the same methods as vtkMapper.

Methods

extend

Method used to decorate a given object (publicAPI+model) with vtkImageCPRMapper characteristics.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesIImageCPRMapperInitialValuesNo(default: {})

getBitangentDirection

For each point on the oriented centerline, the bitangent direction forms with the normal and the tangent direction a new basis Default value: [0, 1, 0]

getCenterPoint

A point used to offset each line of pixel in the rendering The line of pixel is offseted such as the center of the line is as close as possible to the center point This can be used in combination with @see getUseUniformOrientation and a custom distance function for @see getOrientedCenterline to visualize a CPR in projected mode or stretched mode Defaults to null.

Returns

TypeDescription
the center point

getCenterlinePositionAndOrientation

ArgumentTypeRequiredDescription
distanceYesDistance from the beginning of the centerline, following the centerline, in model coordinates

Returns

TypeDescription
The position and orientation which is at the given distance from the beginning of the centerline. If the distance is negative or greater than the length of the centerline, position and orientation are not defined.
If the centerline is not oriented, orientation is not defined.

getCenterlineTangentDirections

Returns

TypeDescription
A flat array of vec3 representing the direction at each point of the centerline It is computed from the orientations of the centerline and tangentDirection
Uses caching to avoid recomputing at each frame

getDirectionMatrix

The direction matrix is the matrix composed of tangent, bitangent and normal directions It is used to orient the camera or the actor

getHeight

Returns

TypeDescription
The total height of the image in model coordinates.

getNormalDirection

For each point on the oriented centerline, the normal direction is the direction along the centerline Default value: [0, 0, 1]

getOrientationArrayName

OrientationArrayName specifies the name of the data array which gives an orientation for each point of the centerline The data array has to be in the PointData attribute of the centerline input If null, look for the orientation data array in: "Orientation", "Direction", Vectors, Tensors, Normals The data array should be an array of mat4, mat3, quat or vec3 but using vec3 makes the CPRInteractor unusable Default to null.

getOrientationDataArray

Find the data array to use for orientation in the input polydata ( @see getOrientationArrayName )

getOrientedCenterline

Recompute the oriented centerline from the input polydata if needed and return the result If there is no polydata as input, return the last oriented centerline It means that if no polydata is given as input and the centerline is set using @see setOrientedCenterline , the given centerline will be used

getPreferSizeOverAccuracy

This flag indicates wether the GPU should use half float or not When true, will use half float When false, may use half float if there is no loss of accuracy (see in Texture: checkUseHalfFloat) Defaults to false.

Returns

TypeDescription
the preferSizeOverAccuracy flag

getProjectionMode

The different modes of projection Available modes include MIP, MinIP and AverageIP

getProjectionSlabNumberOfSamples

Total number of samples of the volume done by the projection mode If this number is equal or less than 1, projection is disabled Using an odd number is advised If this number is even, the center of the slab will not be sampled

getProjectionSlabThickness

Thickness of the projection slab in image coordinates (NOT in voxels) Usually in millimeters if the spacing of the input image is set from a DICOM

getTangentDirection

For each point on the oriented centerline, the tangent direction is the direction in which the mapper will sample Let O (a mat3) be the orientation at a point on a centerline, and N (a vec3) the tangent direction Then the mapper will sample along O * N Default value: [1, 0, 0]

getUniformDirection

Returns

TypeDescription
The direction to sample, in model space, computed using uniform orientation and tangent direction

getUniformOrientation

Use @see getUseUniformOrientation to use the uniform orientation instead of the orientation specified by the centerline

Returns

TypeDescription
the uniform orientation of the centerline

getUseUniformOrientation

This flag specifies wether the mapper should use the uniformOrientation ( @see getUniformOrientation ) or the orientation specified in centerline at centerline input ( @see setCenterlineData ) Defaults to false.

Returns

TypeDescription
the useUniformOrientation flag

getWidth

Returns

TypeDescription
the width of the image in model coordinates of the input volume

isProjectionEnabled

Returns wether projection is enabled It is based on the number of samples

newInstance

Method used to create a new instance of vtkImageCPRMapper

ArgumentTypeRequiredDescription
initialValuesIImageCPRMapperInitialValuesNofor pre-setting some of its content

preRenderCheck

Returns

TypeDescription
A boolean indicating if the mapper is ready to render

setBitangentDirection

ArgumentTypeRequiredDescription
bitangentYes

setCenterPoint

ArgumentTypeRequiredDescription
pointYes

setCenterlineConnection

Same as setCenterlineData except it uses an output port instead of a polydata You can also use publicAPI.setInputConnection(centerlineConnection, 1);

ArgumentTypeRequiredDescription
centerlineConnectionYes

setCenterlineData

Set the polydata used as a centerline You can also use publicAPI.setInputData(centerlineData, 1); Use all the segments of all the polylines (the centerline can be in multiple pieces) The polydata can contain a PointData DataArray to specify the direction in which the mapper should sample for each point of the centerline ( @see getDirectionArrayName @see getDirectionArrayOffset ) If no such point data is specified, a uniform direction can be used instead ( @see getUniformDirection @see getUseUniformOrientation ) The points of the centerline are in model coordinates of the volume used as input ( @see setImageDataData ) and not index coordinates (see MCTC matrix of the OpenGL ImageCPRMapper) Use imageData.getWorldToIndex(); or imageData.getIndexToWorld(); to go from model coordinates to index coordinates or the other way around

ArgumentTypeRequiredDescription
centerlineDataYesA polydata containing one or multiple polyline(s) and optionnally a PointData DataArray for direction

setDirectionMatrix

ArgumentTypeRequiredDescription
matYes

setImageConnection

Set the connection for the volume You can also use publicAPI.setInputConnection(imageData, 0);

ArgumentTypeRequiredDescription
imageDataYes

setImageData

Set the volume which should be sampled by the mapper You can also use publicAPI.setInputData(imageData, 0); The model coordinates of this imageData are used by this mapper when specifying points, vectors or width (see MCTC matrix of the OpenGL ImageCPRMapper) You can use imageData.getWorldToIndex(); or imageData.getIndexToWorld(); to go from this model coordinates to index coordinates or the other way around

ArgumentTypeRequiredDescription
imageDataYes

setNormalDirection

ArgumentTypeRequiredDescription
normalYes

setOrientationArrayName

ArgumentTypeRequiredDescription
arrayNameYes

setOrientedCenterline

Set the internal oriented centerline WARNING: this centerline will be overwritten if the polydata centerline is specified (input 1 @see setCenterlineData )

ArgumentTypeRequiredDescription
centerlineYesAn oriented centerline

setPreferSizeOverAccuracy

ArgumentTypeRequiredDescription
preferSizeOverAccuracyYes

setProjectionMode

ArgumentTypeRequiredDescription
projectionModeYes

setProjectionSlabNumberOfSamples

ArgumentTypeRequiredDescription
projectionSlabNumberOfSamplesYes

setProjectionSlabThickness

ArgumentTypeRequiredDescription
projectionSlabThicknessYes

setTangentDirection

ArgumentTypeRequiredDescription
tangentYes

setUniformOrientation

ArgumentTypeRequiredDescription
orientationYes

setUseUniformOrientation

ArgumentTypeRequiredDescription
useUniformOrientationYes

setWidth

ArgumentTypeRequiredDescription
widthYes

useStraightenedMode

Configure the mapper and the centerline to be in straightened CPR mode

useStretchedMode

Configure the mapper and the centerline to be in strectched CPR mode

ArgumentTypeRequiredDescription
centerPointYesThe center point, optional, default to the first point of the centerline or [0, 0, 0]