| genre | Resample |
| status | stable |
| author | Florian Link |
| package | MeVisLab/Standard |
| dll | MLResample1 |
| definition | MLResample1.def |
| see also | MPRPath, OrthoMPR, Reformat |
The module MPR calculates a multiplanar reformatted image from its input image.
The reformatting requires sampling of the input image, which can be done with different filters. The MPR is optimized (using fixpoint arithmetic) for int8 and int16 types, but has a fallback implementation for the other basic datatypes.
Depending on the Memory Access mode, it uses different strategies to access the input image.
The MPR outputs a reformatted slice (or a slice stack if the Output Depth parameter is != 1) that is defined by its center world position (Translation) and a Rotation.
The edge length of the reformatted output slices is given by the Field Of View parameter (in mm), the resolution is specified by the Output Size parameter (in pixels).
The coordinate system of the output image is defined by coordinate vectors wx, wy and wz, denoting the direction of the image's pixel rows and columns and the depth direction, respectively. These vectors are computed from the Rotation parameter R by
(wx, wy, wz) = R (ex, ez, -ey),
where ex, ey and ez are the unit vectors. This definition, especially the swapping of the Y and Z direction, is compatible to the conventions used for Open Inventor draggers, which define the Y-axis as the direction normal. Accordingly, the translation and rotation fields of an Inventor Dragger (e.g. SoJackDragger, SoPlaneDragger) can directly be connected to the fields of an MPR module.
In order to obtain the MPR rotation parameter for a given plane normal, compute:
rotation = SbRotation(SbVec3f(0,1,0), planeNormal);
If three points p1, p2 and p3 on a plane are given, the plane normal can be computed using the cross product:
SbVec3f dir1 = p2-p1;
SbVec3f dir2 = p3-p1;
SbVec3f planeNormal = dir1.cross(dir2);
The voxel-to-world-matrix W of the MPR's output image is computed from the rotation R and the translation T by
W = T R M S D,
where
- D describes the translation from image center to origin (-sx/2, -sy/2, 0),
- S describes the voxel size, and
- M rotates y to z and z to -y.
Here is the corresponding code snippet:
double voxelSize = fieldOfView / outputSize;
dir1 = rotation * vec3(1, 0, 0) * voxelSize;
dir2 = rotation * vec3(0, 0, 1) * voxelSize;
dir3 = rotation * vec3(0, -1, 0) * voxelSize;
vec3 trans = translation - outputSize/2*dir1 - outputSize/2*dir2 - 1/2*dir3;
toWorldMatrix = mat4(dir1, dir2, dir3, trans);
The above figure shows an input image box drawn in world coordinates and an MPR slice that defines an oblique slice within this box.
The center of the slice is given as the Translation parameter, the slice normal is given by the Rotation applied to the negative world Y-axis.
Provides the MPR image slice (or slice stack if Output Depth > 1).
| Activate clip plane: Bool | Field Of View: Float | Output Depth: Integer |
| Alpha: Float | Fill Value: Double | Output Size: Integer |
| Aspect Ratio: Float | Flip Clip Plane: Bool | Plane: Plane |
| Axial: Trigger | Force Upright: Bool | Represent Input Slice: Trigger |
| Blend Mode: Enum | Image Color: Color | Rotation: Rotation |
| Border Color: Color | Interactive manipulator: Bool | Sagittal: Trigger |
| Clip Plane Offset: Float | Interpolation: Enum | Slice No.: Integer |
| Coronal: Trigger | Memory Access: Enum | Translation: Vector3 |
| Draw axes: Bool | On (borderOn): Bool | Use Z buffer: Bool |
| Enable Plane Edit: Bool | On (drawImageOn): Bool |
Sets the rotation of the MPR slice, mapping the world X-, Y-, and Z-axes to the MPR image's X-, negative Z-, and Y-axes, respectively.
The easiest way to edit the rotation is to use an OpenInventor dragger and connect its rotation field to this parameter.
Sets the translation vector to the center of the (first) MPR slice (in world coordinates).
Sets the plane containing the first slice of the MPR output image.
If checked, the Plane field can be used as an input field.
Incremental modifications of the Plane field are transformed to modifications of the Rotation and Translation parameters.
Sets the value used for regions outside of the input image.
Sets the extent of the MPR slice in the world coordinate system (in mm).
Sets the resolution of the output slice (X,Y) in pixels.
Sets the depth (Z size) of the output image.
If set to 1, a single slice is generated. If set to a value > 1, the output image is a stack of MPR's, where the translation defines the center of the first slice.
Sets the aspect ratio of the MPR.
Values larger than 1.0 produce portrait, smaller than 1.0 landscape output.
If checked, the MPR slice's Y-axis is forced to be close to the world Y-axis (or Z-axis if the MPR slice normal is parallel to the Y-axis).
Sets the slice number to be reproduced by the Represent Input Slice trigger.
If pressed, Field Of View, Output Size, Aspect Ratio, Translation, and Rotation are being adjusted such that the output exactly matches the input slice number Slice No..
Defines the interpolation used for resampling.
Values:
| Title | Name | Description |
|---|---|---|
| Nearest Neighbor | NearestNeighbor | No interpolation, picks the nearest input image voxel. Fastest mode. |
| Trilinear | Trilinear | Trilinear filtering. The 8-voxel-neighborhood is used for linear interpolation. Slowest mode. |
| Trilinear Skip Border | TrilinearSkipBorder | Same as Trilinear, but all output voxels that depend on a voxel outside of the input image are filled with Fill Value. Faster than Trilinear. |
Defines how the module accesses the input image.
Values:
| Title | Name | Deprecated Name | Description |
|---|---|---|---|
| Paged | Paged | TRUE | Slower than global, except for small MPR's in large input images. The output MPR is split into tiles that are processed individually. For each tile, the module requests the corresponding 3D region of the input image. If not enough memory is available, the module falls back to Virtual Volume access. |
| Global | Global | FALSE | Fastest, but highest memory cosumption and initialization time. The input image is accessed as a global image (via the ML memory image). This consumes a lot of memory for large datasets. If not enough memory is available, the module falls back to the Virtual Volume memory access. |
| Virtual Volume | VirtualVolume | Slowest, but works on huge datasets. All pages of the input image are requested via the virtual volume mechanism, thus only small portions of the input image are needed at the same time. |
Sets the color used to display the image data.
Sets the color used to draw the slice border.
Enables/disables the drawing of the slice border.
Enables/disables the drawing of the image data.
Enables/disablse a 3D manipulator that can be used to translate, rotate and scale the MPR slice in the Inventor scene.
Enables/disables a clip plane applied to the Open Inventor scene on one side of the MPR plane.
If checked, the halfspace that is clipped by the clip plane is flipped.
Sets an offset to the clip plane in the direction of the MPR slice normal.
Enables/disables drawing of the MPR output image coordinate axes.
Sets an alpha value used to draw the image data.