svr#

This command implements a classical slice-to-volume registration/reconstruction pipeline with a robust motion correction method (SVoRT). It can only be applied to data with rigid motion (e.g., brain).

usage: nesvor svr [--input-stacks str [str ...]]
                  [--thicknesses float [float ...]] [--input-slices str]
                  [--stack-masks str [str ...]] [--volume-mask str]
                  [--stacks-intersection] [--background-threshold float]
                  [--otsu-thresholding] --output-volume str
                  [--output-slices str] [--simulated-slices str]
                  [--output-json str] [--output-resolution float]
                  [--output-intensity-mean float] [--inference-batch-size int]
                  [--n-inference-samples int] [--output-psf-factor float]
                  [--sample-orientation str] [--sample-mask str]
                  [--segmentation] [--batch-size-seg int]
                  [--no-augmentation-seg] [--dilation-radius-seg float]
                  [--threshold-small-seg float] [--bias-field-correction]
                  [--n-proc-n4 int] [--shrink-factor-n4 int] [--tol-n4 float]
                  [--spline-order-n4 int] [--noise-n4 float] [--n-iter-n4 int]
                  [--n-levels-n4 int] [--n-control-points-n4 int]
                  [--n-bins-n4 int] [--metric str] [--filter-method str]
                  [--cutoff float] [--batch-size-assess int]
                  [--no-augmentation-assess] [--registration str]
                  [--svort-version str] [--scanner-space]
                  [--no-slice-robust-statistics]
                  [--no-pixel-robust-statistics] [--no-local-exclusion]
                  [--no-global-exclusion] [--global-ncc-threshold float]
                  [--local-ssim-threshold float] [--with-background]
                  [--n-iter int] [--n-iter-rec int [int ...]] [--psf str]
                  [--delta float] [--device int] [--verbose int]
                  [--output-log str] [--seed int] [--debug]

inputs#

--input-stacks

Type: str [str ...]

Paths to the input stacks (NIfTI).

--thicknesses

Type: float [float ...]

Slice thickness of each input stack. If not provided, use the slice gap of the input stack. If only a single number is provided, Assume all input stacks have the same thickness.

--input-slices

Type: str

Folder of the input slices. i.e., the motion corrected slices generated by nesvor register. If input-slices are provided and input-stacks will be ignored.

input stacks masking#

--stack-masks

Type: str [str ...]

Paths to masks of input stacks.

--volume-mask

Type: str

Paths to a 3D mask which will be applied to each input stack.

--stacks-intersection

Only consider the region defined by the intersection of input stacks. Will be ignored if --volume-mask is provided.

--background-threshold

Type: float

Default: 0

pixels with value <= this threshold will be ignored.

--otsu-thresholding

Apply Otsu thresholding to each input stack.

outputs#

--output-volume

Type: str

Paths to the reconstructed volume

--output-slices

Type: str

Folder to save the motion corrected slices

--simulated-slices

Type: str

Folder to save the simulated (extracted) slices from the reconstructed volume

--output-json

Type: str

Path to a json file for saving the inputs and results of the command.

outputs sampling#

--output-resolution

Type: float

Default: 0.8

Isotropic resolution of the reconstructed volume

--output-intensity-mean

Type: float

Default: 700.0

mean intensity of the output volume

--inference-batch-size

Type: int

batch size for inference

--n-inference-samples

Type: int

number of sample for PSF during inference

--output-psf-factor

Type: float

Default: 1.0

Determind the psf for generating output volume: FWHM = output-resolution * output-psf-factor

--sample-orientation

Type: str

Path to a nii file. The sampled volume will be reoriented according to the transformatio in this file.

--sample-mask

Type: str

3D Mask for sampling INR. If not provided, will use a mask esitmated from the input data.

fetal brain masking#

--segmentation

Perform 2D fetal brain segmentation/masking for each input stack.

--batch-size-seg

Type: int

Default: 16

Batch size for segmentation

--no-augmentation-seg

Disable inference data augmentation in segmentation

--dilation-radius-seg

Type: float

Default: 1.0

Dilation radius for segmentation mask in millimeter.

--threshold-small-seg

Type: float

Default: 0.1

Threshold for removing small segmetation mask (between 0 and 1). A mask will be removed if its area < threshold * max area in the stack.

N4 bias field correction#

--bias-field-correction

Perform bias field correction using the N4 algorithm.

--n-proc-n4

Type: int

Default: 8

number of workers for the N4 algorithm.

--shrink-factor-n4

Type: int

Default: 2

The shrink factor used to reduce the size and complexity of the image.

--tol-n4

Type: float

Default: 0.001

The convergence threshold in N4.

--spline-order-n4

Type: int

Default: 3

The order of B-spline.

--noise-n4

Type: float

Default: 0.01

The noise estimate defining the Wiener filter.

--n-iter-n4

Type: int

Default: 50

The maximum number of iterations specified at each fitting level.

--n-levels-n4

Type: int

Default: 4

The maximum number of iterations specified at each fitting level.

--n-control-points-n4

Type: int

Default: 4

The control point grid size in each dimension. The B-spline mesh size is equal to the number of control points in that dimension minus the spline order.

--n-bins-n4

Type: int

Default: 200

The number of bins in the log input intensity histogram.

stack assessment#

--metric

Possible choices: ncc, matrix-rank, volume, iqa2d, iqa3d, none

Default: none

Metric for assessing input stacks.

  1. ncc (↑): cross correlaiton between adjacent slices;

  2. matrix-rank (↓): motion metric based on the rank of the data matrix;

  3. volume (↑): volume of the masked ROI;

  4. iqa2d (↑): image quality score generated by a 2D CNN (only for fetal brain), the score of a stack is the average score of the images in it;

  5. iqa3d (↑): image quality score generated by a 3D CNN (only for fetal brain);

  6. none: no metric used for assessment.

Note: (↑) means a stack with a higher score will have a better rank.

--filter-method

Possible choices: top, bottom, threshold, percentage, none

Default: none

Method to remove low-quality stacks.

  1. top: keep the top C stacks;

  2. bottom: remove the bottom C stacks;

  3. threshold: remove a stack if the metric is worse than C;

  4. percentatge: remove the bottom (num_stack * C) stacks;

  5. none: no filtering.

The value of C is specified by --cutoff.

--cutoff

Type: float

The cutoff value for filtering, i.e., the value C in --filter-method

--batch-size-assess

Type: int

Default: 8

Batch size for IQA network

--no-augmentation-assess

Disable inference data augmentation in IQA network

rigid registration#

--registration

Possible choices: svort, svort-only, svort-stack, stack, none

Default: svort

The type of registration method applied before reconstruction.

  1. svort: try SVoRT and stack-to-stack registration and choose the one with better NCC;

  2. svort-only: only apply the SVoRT model;

  3. svort-stack: only apply the stack transformations of SVoRT;

  4. stack: stack-to-stack rigid registration;

  5. none: no rigid registration.

Note: The SVoRT model can be only applied to fetal brain data.

--svort-version

Possible choices: v1, v2

Default: v2

Version of SVoRT model

--scanner-space

Perform registration in the scanner space. Default: register the data to the atlas space when svort or svort-stack are used.

outlier removal#

--no-slice-robust-statistics

Disable slice-level robust statistics for outlier removal.

--no-pixel-robust-statistics

Disable pixel-level robust statistics for outlier removal.

--no-local-exclusion

Disable pixel-level exclusion based on SSIM.

--no-global-exclusion

Disable slice-level exclusion based on NCC.

--global-ncc-threshold

Type: float

Default: 0.5

Threshold for global exclusion.

--local-ssim-threshold

Type: float

Default: 0.4

Threshold for local exclusion.

optimization#

--with-background

Reconstruct the background in the volume.

--n-iter

Type: int

Default: 3

Number of iterations (outer loop)

--n-iter-rec

Type: int [int ...]

Default: [7]

Number of iterations of super-resolution reconstruction (inner loop). Should be a list of int with length = n-iter. If a single number N is provided, will use [N, N, ..., N*3].

--psf

Possible choices: gaussian, sinc

Default: gaussian

Type of point spread function (PSF) used in data acquisition.

regularization#

--delta

Type: float

Default: 0.2

Parameter to define intensity of an edge in edge-preserving regularization.

miscellaneous#

--device

Type: int

Default: 0

Id of the device to use. Use GPU if it is nonnegative and use CPU if it is negative.

--verbose

Possible choices: 0, 1, 2

Default: 1

Level of verbosity: (0: warning/error, 1: info, 2: debug)

--output-log

Type: str

Path to the output log file

--seed

Type: int

Random seed

--debug

Debug mode.