Skip to content

# Resample

## Resample dataset

Back to MIB | User interface | Menu | Dataset

## Overview

Resample the image and corresponding Selection, Mask, and Model layers to adjust voxel sizes or dataset dimensions.

Resampling can be done using:

- Dimensions mode
- Voxels mode
- Percentage XYZ mode
- Percentage XY mode

Demonstration

- Resample dataset demonstration

Select the resampling mode to define how the dataset is resized.
In Dimensions mode, specify the new width, height, and depth in pixels using
Width, Height, and Depth fields.

In Voxels mode, enter the desired voxel sizes in physical units (e.g., micrometers) for each dataset dimension.

Choose the resampling function from the Resampling Function dropdown to determine the interpolation technique.

Select methods for images and models using Resampling Method and Resampling Method Models.

Click the Resample button to apply the changes, or use the Reset button to restore default settings.

## Dimensions Mode

In Dimensions mode, you define the new size of the dataset by entering the desired width, height, and depth in pixels:

- Width field: set the number of pixels along the X-axis.
- Height set the number of pixels along the Y-axis.
- Depth set the number of pixels along the Z-axis.

This mode is ideal for adjusting the dataset to a specific resolution, such as reducing a large dataset for faster processing or matching another dataset’s dimensions.

The image and associated layers (Selection, Mask, Model) are resized to the specified pixel counts, maintaining the aspect ratio if X, Y, and Z are scaled proportionally.

## Voxels Mode

In Voxels mode, you specify the desired voxel sizes in physical units (e.g., micrometers) to adjust the dataset’s spatial resolution:

- Voxel Xenter the voxel size along the X-axis.
- Voxel Yenter the voxel size along the Y-axis.
- Voxel Zenter the voxel size along the Z-axis.

This mode recalculates the dataset’s pixel dimensions based on the provided voxel sizes and the dataset’s physical dimensions. It’s useful for standardizing datasets to a common resolution (e.g., for multi-modal imaging) or correcting anisotropic voxel sizes.

The resampling process adjusts all layers to match the new voxel dimensions.

Info

The voxel size of the dataset are specified in Menu->Dataset->Parameters

## Percentage XYZ Mode

In Percentage XYZ mode, you define a single scaling factor to resize all dimensions of the dataset:

Scaling Factor enter a percentage (e.g., 50 for half size, 200 for double size).

All dimensions (width, height, depth) are scaled uniformly by this factor, affecting the image and all layers.

Info

This mode is convenient for quick resizing tasks, such as creating a lower-resolution preview or enlarging a dataset for detailed inspection, while preserving the dataset’s proportions.

## Percentage XY Mode

In Percentage XY mode, you define a scaling factor that applies only to the XY dimensions, leaving the Z dimension unchanged:

Scaling Factor enter XY percentage (e.g., 50 for half size, 200 for double size)..

Only the width (X) and height (Y) of the dataset are resized, making this mode suitable for adjusting in-plane resolution without altering the number of slices in a 3D stack.

It’s particularly useful for datasets with anisotropic voxels where Z-resolution differs significantly from XY, allowing targeted scaling of the image and layers.

## Resampling Functions

The Resampling Function dropdown offers three MATLAB-based methods to compute the resampled dataset, each with specific interpolation options for images and models:

interpn

Uses MATLAB’s interpn function for n-dimensional interpolation, suitable for precise resampling of 3D and 4D datasets. It calculates new pixel values by interpolating between existing ones, supporting isotropic and anisotropic scaling.

- Image resample methods:
  - `nearest`: assigns the value of the nearest pixel (fast, blocky).
  - `linear`: linear interpolation for smooth transitions (balanced speed and quality).
  - `spline`: spline interpolation for higher smoothness (slower, high quality).
  - `cubic`: cubic interpolation, similar to spline but slightly different curve fitting.
- Model resample methods: Same as image methods (`nearest`, `linear`, `spline`, `cubic`), ensuring consistent resampling of segmented layers.

imresize

Employs MATLAB’s imresize function, optimized for 2D image resizing but extended to 3D datasets slice-by-slice.
It’s faster for large datasets but less flexible for anisotropic scaling.

- Image resample methods:
  - `nearest`: Nearest-neighbor interpolation (fastest, least smooth).
  - `box`: Box kernel averaging (simple, moderate quality).
  - `triangle`: Triangular kernel (bilinear-like, balanced).
  - `cubic`: Bicubic interpolation (smooth, high quality).
  - `lanczos2`: Lanczos kernel with 2-lobe window (sharp, detailed).
  - `lanczos3`: Lanczos kernel with 3-lobe window (sharpest, slowest).
  - `osc`: Custom oscillation-based method (experimental, high quality).
- Model resample methods:
  - Only `nearest` is supported, as models require discrete values to preserve segmentation boundaries.

tformarray

Utilizes MATLAB’s tformarray function for affine transformation-based resampling, ideal for complex scaling and alignment tasks.

It applies a transformation matrix to the entire dataset.

- Image resample methods:
- `nearest`: Nearest-neighbor interpolation (fast, preserves edges).
- `linear`: Linear interpolation (smooth, moderate quality).
- `cubic`: Cubic interpolation (smoothest, computationally intensive).
- Model resample methods:
- Same as image methods (`nearest`, `linear`, `cubic`), allowing flexible resampling of model layers.

Select the desired method for images via Resampling Method and for models via Resampling Method Models to balance quality and performance based on your dataset’s needs.

Note

For large datasets, use `nearest` or `imresize` for faster processing, and test settings on a small region using the ROI panel before resampling the entire dataset.

Back to MIB | User interface | Menu | Dataset