API

Author : Jaime Barranco

bmArrayUtility

bmZeroCleaned(argA)
bmMax(x)
bmOne(argSize, argType)
bmMultiIndex2Index(argMultiInd, argSize)
bmInvPerm(myPerm)
bmLineReshape(argIn, argSize)
bmCell2Array(c)
bmIsScalar(x)
bmFirstIndex(argString, argVal, argVec)
bmMitosis(varargin)

bmMitosis - Process multiple input tables and masks, and return filtered tables.

Usage:

[outTable1, outTable2, …, outTableN] = bmMitosis(table1, table2, …, tableN, mask1, mask2, …, maskM) [outTable1, outTable2, …, outTableN] = bmMitosis(table1, table2, …, tableN, maskCellArray)

Inputs:

table1, table2, …, tableN : Input tables (arrays) where N is the number of output tables requested. mask1, mask2, …, maskM : Individual mask matrices (optional if masks are provided in a cell array). maskCellArray : A cell array containing all the mask matrices.

Outputs:

outTable1, outTable2, …, outTableN : Output tables after processing with the masks.

The function expects:
  • The first N arguments are the input tables.

  • The remaining arguments are either individual mask matrices or a single cell array containing all masks.

  • All input tables must have the same number of columns (last dimension).

  • Masks must be 2-dimensional matrices with the same number of columns as the input tables.

Example 1 - Using individual masks:

out1, out2 = bmMitosis(table1, table2, mask1, mask2);

Example 2 - Using a cell array of masks:

masks = {mask1, mask2}; out1, out2 = bmMitosis(table1, table2, masks);

Author:

Bastien Milani, CHUV and UNIL, Lausanne, Switzerland, May 2023

bmColReshape(argIn, argSize)

out = bmColReshape(argIn, argSize)

This function reshapes the data into column vectors, with each vector containing data of one channel. The data can be given in an array or cell array. In case of a cell array, the arrays in each cell are reshaped.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

argIn (array / cell array): Data that should be reshaped. argSize (list): Size of the data of one channel. Used to calculate the number of channels.

Results:

out (array / cell array): The data reshaped into column vectors. The type depends on the input.

bmSingle(a)
bmIndex2MultiIndex(argInd, argSize)

bmIndex2MultiIndex Convert a linear index to a multi-dimensional index.

This function takes a linear index (argInd) and the size of each dimension (argSize) of a multi-dimensional array, and converts the linear index to a multi-dimensional index.

Parameters:

argInd - The linear index to be converted. argSize - A vector specifying the size of each dimension of the multi-dimensional array.

Returns:

outInd - A vector containing the multi-dimensional index.

Example:

argInd = 5; argSize = [2, 3]; outInd = bmIndex2MultiIndex(argInd, argSize) % outInd will be [2, 1] since the 5th element in a 2x3 matrix is at (2, 1).

Author:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

bmArray2Cell(a, N_u)
bmRand(argSize, argType)
bmType(a)
bmZero(argSize, argType, varargin)

z = bmZero(argSize, argType, varargin)

This function creates a zero array of a given size and given type. Can also create a cell array containing zero arrays of the given size.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

argSize (list): The size of the zero array. argType (char): The type of the zero array. Can be ‘real_double’, ‘real_single’, ‘complex_double’ and ‘complex_single’. varargin{1}: List containing the size of the cell array if the result should be a cell array.

bmSingle_of_cell(arg_cell)
bmPointReshape(t, varargin)

out = bmPointReshape(t, varargin)

Reshapes the array or cell array given to express the points in their dimensions -> 2D array of shape [nCh, nPt]

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

t (array or cell array): Contains the points (ex. of a trajectory) and should be reshaped varargin{1}: Gives the number of dimensions the points should have

Returns:

out (array or cell array): Contains the reshaped array

Examples:

t = bmPointReshape(trajectory) t = bmPointReshape(bmTraj_fullRadial3_phyllotaxis_lineAssym2(myMriAcquisition_node))

bmPermuteToPoint(y, argSize)
bmIsBlockShape(x, N_u)

out = bmIsBlockShape(x, N_u)

This function checks if the data in array x is in the block format, i.e., contains a grid for each channel.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

x (array): Array of which the format should be tested. N_u (list): Size of the data of one channel in x.

Returns:

out (logical): 1 if x is in block format, 0 if not.

bmPermuteToCol(y, varargin)

out = bmPermuteToCol(y, varargin)

This function permutes an array or a cell array containing data such that the data is contained in the column. Each column represents the data of a channel. A cell array is returned as such with the arrays contained in each cell being reshaped to the column format.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:
y: Array or cell array containing the data that has to be permuted into

column format.

varargin (optional): Can contain a scalar or an array giving the number

of rows that the permuted data should have. This is enforced and can lead to errors if y can’t be reshaped to follow the given size. If an array is given, the entries are multiplied to transform it into a scalar.

Returns:
out: Array or cell array (depending on y) containing the data permuted

into column format.

Examples:
Cell array
y = { [1, 2, 3; 4, 5, 6], …

[7, 8; 9, 10; 11, 12], … {[13, 14; 15, 16]} };

out = bmPermuteToCol(y, 2);

Outputs out with cells permuted to
Cell 1:

1 4 2 5 3 6

Cell 2:

7 9 11 8 10 12

Cell 3:

{2×2 double} (13 15) (14 16)

Array

y = [1, 2, 3; 4, 5, 6]; out = bmPermuteToCol(y);

Outputs out permuted to
out:

1 4 2 5 3 6

bmNumOfDim(a)
bmCol(a)

out = bmCol(a)

This function returns the input data as a column vector. This is the same as doing: temp = a; out = a(:); But allows to do it in one line and thus nest in other function calls.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

a (array): Input data

Returns:

out (column vector): Data (a) as column vector

bmIsColShape(x, N_u)

out = bmIsColShape(x, N_u)

This function checks if the data in array x is in the column format, i.e., contains a column vector for each channel.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

x (array): Array of which the format should be tested. N_u (list): Size of the data of one channel in x.

Returns:

out (logical): 1 if x is in column format, 0 if not.

bmBlockReshape(argIn, N_u)

out = bmBlockReshape(argIn, N_u)

This function reshapes the input array argIn (or cell array) to have all arrays of size [N_u, nCh], which is of the same dimension as N_u if argIn has the same amount of elements as an array defined by the size N_u (nCh = 1) or + 1 if not.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

argIn (array): The data that should be reshaped into block from. N_u (list): Contains the size for the blocks (same for all).

Returns:
out (array): Contains the reshaped array, where the data is seperated

into nCh blocks of size N_u. The size is [N_u, nCh], which is [N_u] if prod(N_u) equals the elements in argIn. nCh is the number of blocks and of dim 1. Empty if argIn is empty.

Examples:
out = bmBlockReshape((1:884736), [96, 96, 96]);

size(out): [96, 96, 96]

out = bmBlockReshape((1:884736), [48, 48, 48]);

size(out): [48, 48, 48, 8]

bmCoilSense

automatic

thresholdRMS_MIP(colorMax, dataRMS, dataMIP, N_u, autoFlag)
[thRMS, thMIP] = thresholdRMS_MIP(colorMax, dataRMS, dataMIP, …

N_u, automaticFlag)

This function sets a threshold for the values of the RMS and MIP value calculated along the channels for 3D data. The threshold are automatically estimated by assuming the data to have a multimodal distribuition made out of two normal distributions. One for the noise and one for the actual data. A Gaussian mixture model (GMM) is fitted to the data and the point where the possibility of the pixel intensity belonging to the data is higher than the possibility of the intensity to be noise is taken as the treshold value. It is assumed that the mean of the noise distribution is lower (darker pixels).

Authors:

Dominik Helbing MattechLab 2024

Parameters:

colorMax (list): The value used to scale the RMS and MIP values. This gives the possible maximum of the threshold (colorMax-1). dataRMS (array): The RMS values of the data over its channels. This is a 3D image. dataMIP (array): The MIP values of the data over its channels. This is a 3D image. N_u (list): Size of the data in block format. autoFlag (logical): flag; Automatically decide on thresholds if true. Show figure and interrupt code to manually set if false.

Returns:

thRMS (int): The threshold value above which the RMS values are kept. thMIP (int): The threshold value above which the MIP values are kept.

selectROI(dataRMS, dataMIP, N_u, varargin)

coordinates = selectROI(dataRMS, dataMIP, N_u, varargin)

This function allows to manually set the bounding box around the region of interest (ROI) for every dimension of the image in dataRMS and dataMIP. For both data a figure is created (6 images in total). The bounding boxes update automatically to always use the same coordinates in all images. The code is interrupted until the selection is confirmed or the window is closed.

Authors:

Dominik Helbing MattechLab 2024

Parameters:

dataRMS (array): Data for RMS image. Has to be data of a 3D image. dataMIP (array): Data for MIP image. Has to be data of a 3D image. N_u (list): Contains the size of the data in every dimension. varargin{1}: Flag; allows changing of coordinates with input fields. Default value is false. varargin{2}: Array that contains the guessed position of the bounding box. Has to have the structure [xMin, xWidth; yMin, yWidth; zMin, zWidth]. Default value is [2, min(N_u)-4; 2, min(N_u)-4; 2, min(N_u)-4]

Returns:

coordinates (array): The updated coordinates of the bounding box including the same ROI for dataRMS and dataMIP. Has the structure [xMin, xMax; yMin, yMax; zMin, zMax]

detectROI(rawData, N_u)

bBox = detectROI(rawData, N_u)

This function guesses the region of interest (ROI) of the given 3D image by transforming the image into a binary representation using Otsu’s method and extracting the largest connected component.

Authors:

Dominik Helbing MattechLab 2024

Parameters:

rawData (array): Contains the data of a 3D image for which a bounding box around the ROI should be guessed. N_u (list): The size of each dimension.

Returns:

bBox (array): Contains the minimum value and the width of the box for every dimension. The array is structured like this: [xMin, xWidth; yMin, yWidth; zMin, zWidth]

from_prescan

bmCoilSense_prescan_mask(x_body, n_u, varargin)
bmCoilSense_prescan_coilSense(x_body, x_surface, m, n_u)

bmCoilSense_prescan_coilSense - Estimate coil sensitivity maps from pre-scan images.

Usage:

C = bmCoilSense_prescan_coilSense(x_body, x_surface, m, n_u)

Inputs:

x_body : Body coil prescan image (1D, 2D, or 3D). x_surface : Surface (array) coil prescan image (1D, 2D, or 3D). m : Mask segmenting the non-zero signal volume, with dimensions matching the images. n_u : Image size excluding channels (e.g., [96, 96] or [64, 56, 32]).

Outputs:

C : Estimated coil sensitivity maps (complex single).

Description:

This function estimates the sensitivity maps of MRI coils using pre-scan images from body and surface coils. It normalizes the coil images, estimates sensitivity maps using pseudo-diffusion, and refines them using the Laplace equation solver.

Steps:
  1. Reshape and normalize the body and surface coil images.

  2. Compute an initial estimate of the body coil sensitivity.

  3. Refine the sensitivity map using pseudo-diffusion and the Laplace equation solver.

  4. Estimate and refine sensitivity maps for each surface coil.

Author:

Bastien Milani, CHUV and UNIL, Lausanne, Switzerland, May 2023

map

bmCoilSense_pinv(C, x0, n_u)

x = bmCoilSense_pinv(C, x0, n_u)

This function performs image reconstruction using coil sensitivity profiles and a pseudoinverse.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

C (array): The coil sensitivity of each coil. Has the same amount of points as the data. x0 (array): The data acquired by each coil. Has the same amount of points as C. n_u (list): The size of the grid.

Returns:

x (array): The reconstructed image by combining the data of all coils. This is given in the block format.

Notes:

The reconstruction is done by multiplying the pseudoinverse of the coil sensitivity profiles with the recorded data. This comes from x0 = C * x -> x = (C*C)^-1 * (C*) * x0, with C* being the conjugate transpose of C and * being the matrix multiplication. C is a diagonal matrix (in theory, not matlab implementation)

nonCart

bmCoilSense_nonCart_data(reader, N_u)

varargout = bmCoilSense_nonCart_data(reader, N_u)

This function constraints data from a non cartesian 3D radial trajectory to fit into the given cartesian grid, adapting the resolution of the image. The data is read from a ISMRMRD file. It is assumed that the acquisition is done with self navigation

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) Mauro Leidi

Parameters:

reader (RawDataReader): Object to parse the file which contains the data. N_u (List): Contains the size of the grid for every dimension.

Returns (optional):

varargout{1} (y): 2D array containing the raw MRI data from the ISMRMRD file. The size is [#points, nCh]. varargout{2} (t): 2D array containing points of the trajectory in the k-space. The size is [3, #points]. varargout{3} (ve): Array containing the volume elements for every point of the trajectory.

bmCoilSense_nonCart_find_nSmooth_phi(y, Gn, m, nSmooth_phi)
bmCoilSense_nonCart_ref(y, Gn, m, nSmooth_phi)

[y_ref, C_ref] = bmCoilSense_nonCart_ref(y, Gn, m, nSmooth_phi)

This function uses the data given in y to create a reference that can be used to estimate the coil sensitvity of the surface coils. Using the mask that indicates the good pixels of the data, a Laplace solver algorithm is used to estimate the coil senstivity of the reference coil for the masked parts (m = 0).

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:
y (array): The acquired data of at least one reference coil. Complex

and in col format (nPt, nCh).

Gn (bmSparseMat): Sparse matrix of class bmSparseMat that grids the

non-uniform data (y) onto a uniform grid.

m (array): A mask of the same size as the datapoints in a channel,

which indicates the good data (pixels) with a 1 (or true).

nSmooth_phi (int): The number of iterations for pseudo diffusing the

complex data, resulting in the coil sensitvity being a complex array. If this is not wanted (WHICH IT IS FOR ALL USES ATM) please use [].

Returns:
y_ref (list): Column vector containing the acquired data in k-space of

the reference coil chosen.

C_ref (array): The estimated coil sensitvity of the chosen reference

coil, given in block format.

Notes:

The data in y should be acquired using body coils. The assumption can be made that C_ref is more uniform and can be estimated by diffusing and smoothing the data devided by the RMS instead of the image (C_ref = I_ref / I_anat, I_anat assumed to be similar to RMS)

bmCoilSense_nonCart_dataFromTwix(argFile, N_u, N, nSeg, nShot, nCh, FoV, nShotOff)
varargout = bmCoilSense_nonCart_dataFromTwix(argFile, N_u, N, nSeg, …

nShot, nCh, FoV, nShotOff)

This function constraints data from a non cartesian 3D radial trajectory to fit into the given cartesian grid, adapting the resolution of the image. The data is read from a a Siemens’ raw data file. It is assumed that the acquisition is done with self navigation

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

argFile (char): String containing the path to the file which contains the Twix object. N_u (1D array): Contains the size of the grid for every dimension N (int): Number of points per segment nSeg (int): Number of segments per shot nShot (int): Number of shots per acquisition nCh (int): Number of channels / coils FoV (1D array): Contains acquisition FoV (image space) nShotOff (int): Number of shots to be discarded from the start

Returns (optional):

varargout{1} (y): 2D array containing the raw MRI data from the twix object. The size is [#points, nCh]. varargout{2} (t): 2D array containing points of the trajectory in the k-space. The size is [3, #points]. varargout{3} (ve): Array containing the volume elements for every point of the trajectory.

bmCoilSense_nonCart_mask(y, Gn, varargin)

m = bmCoilSense_nonCart_mask(y, Gn, varargin)

This function creates a mask for the regridded data which is calculated with a matrix multiplication of Gn*y. The mask depends on the optional parameters (varargin) that allow to give a threshold value for RMS and MIP (Maximum Intensity Projection), and min and max values for x, y, z.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

y (array): Raw data that should be gridded onto the grid defined by the bmSparseMat in Gn. Gn (bmSparseMat): Sparse Matrix defining the new uniform grid. varargin{1}: Lower boundary of the x indices of the mask (ROI). varargin{2}: Upper boundary of the x indices of the mask (ROI). varargin{3}: Lower boundary of the y indices of the mask (ROI). varargin{4}: Upper boundary of the y indices of the mask (ROI). varargin{5}: Lower boundary of the z indices of the mask (ROI). varargin{6}: Upper boundary of the z indices of the mask (ROI). varargin{7}: Threshold for RMS value. varargin{8}: Threshold for MIP value. varargin{9}: Value (not yet commented) varargin{10}: Value (not yet commented) varargin{11}: Flag; Display images if true.

Returns:

m (array): Mask for grid defined by Gn masking all pixels outside the ROI and below threshold values, by setting their points in the mask to 0

Notes:

The x, y, z constrictions are meant to exclude high intensity pixels outside the main image. These could be due to artifacts. This is rerunnable multiple times therefore you can have as inputs the outputs.

bmCoilSense_nonCart_primary(y, y_ref, C_ref, Gn, ve, m)

C = bmCoilSense_nonCart_primary(y, y_ref, C_ref, Gn, ve, m)

This function estimates the coil sensitivity of all surface coils using the coil sensitvity and data of the reference coil. Using the mask that indicates the good pixels of the data, a Laplace solver algorithm is used to estimate the coil senstivity of the surface coils for the masked parts (m = 0).

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

y (array): The data of the surface coils. Has the size (nPt, nCh). y_ref (array): The column vector containing the data of the reference coil. C_ref (array): The coil sensitivity of the reference coil. Has the size of Gn.N_u (block format). Gn (bmSparseMat): The sparse matrix used to grid the non-uniform data to a uniform grid. ve (array): The volume elements for each point in y. Can be the size of one channel, a scalar or the size of y. m (array): The mask that masks the data that is not usefull with m = 0. Has the size of one channel in block format.

Returns:

C (array): The coil sensitvity of all surface coils (channels) in block format.

bmCoilSense_nonCart_secondary(y, C, y_ref, C_ref, Gn, Gu, Gut, ve, nIter, display_flag)
[C, varargout] = bmCoilSense_nonCart_secondary(y, C, y_ref, C_ref, Gn,

Gu, Gut, ve, nIter, display_flag)

This function uses a heuristic alternating gradient descent, between the reconstructed image x and the coil sensitivity C, to improve the estimation of the coil sensitivity map previously done.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

y (array): The acquired data of the surface coils in column format [nPt, nCh]. C (array): The primary estimation of the coil sensitivity map for all surface coils. y_ref (array): The acquired data of the reference (body) coil. C_ref (array): The estimation of the coil sensitivity of the reference coil. Gn (bmSparseMat): The approximate inverse mapping of the grid (backward mapping). Gu (bmSparseMat): The sparse matrix giving the forward mapping. Gut (bmSparseMat): The transpose of Gu (backward mapping). ve (array): Either an array containing the volume elements for each point in the trajectory, for each point in the trajectory of each channel or a skalar. nIter (integer): Number of steps done in the gradient descent. display_flag (logical): Show image after every step if true.

Returns:

C (array): The improved estimation of the coil sensitivity map for every surface coil. varargou{1}: Array containing the reconstructed combined image x.

bmCoilSense_nonCart_mask_automatic(y, Gn, autoFlag, varargin)

m = bmCoilSense_nonCart_mask(y, Gn, varargin)

This function creates a mask for the regridded data which is calculated with a matrix multiplication of Gn*y. The mask depends on the optional parameters (varargin) that allow to give a threshold value for RMS and MIP (Maximum Intensity Projection), and min and max values for x, y, z. ONLY WORKS FOR 3D DATA AT THE MOMENT (X,Y,Z and channels)

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

y (array): Raw data that should be gridded onto the grid defined by the bmSparseMat in Gn. Gn (bmSparseMat): Sparse Matrix defining the new uniform grid. autoFlag (Logical): Flag; Automatically decide on thresholds and borders for mask if true. varargin{1}: Double containing the voxel intensity threshold for RMS value. If this is kept empty, the value will be decided in this function. varargin{2}: Double containing the voxel intensity threshold for MIP value. If this is kept empty, the value will be decided in this function. varargin{3}: Array containing the min and max values for the 3 dimensions. Has the structure [xMin, xMax; yMin, yMax; zMin, zMax]. If this is kept empty, the value will be decided in this function. varargin{4}: Value (not yet commented). Default value is empty. varargin{5}: Value (not yet commented). Default value is empty.

Returns:

m (array): Mask for grid defined by Gn masking all pixels outside the ROI and below threshold values, by setting their points in the mask to 0

Examples:

m = bmCoilSense_nonCart_mask_automatic(y_body, Gn, autoFlag); m = bmCoilSense_nonCart_mask_automatic(y_body, Gn, autoFlag, [], … [], borders); m = bmCoilSense_nonCart_mask_automatic(y_body, Gn, autoFlag, thRMS, … thMIP, borders, open_size, close_size);

bmDialog

bmDispPercent(varargin)
bmGetString()
bmYesNo()
bmGetNat(varargin)

out = bmGetNat(varargin)

This function opens a input prompt asking for a natural number.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:
varargin{1}: String or char containing the prompt asking for one

number. Default is ‘Enter a natural number : ‘.

Returns:

out: A number that the user put in. Otherwise contains 0.

bmGetNum(varargin)

out = bmGetNum(varargin)

This function opens a input prompt asking for a number. The returned value can also be an array if the input contains , and ;.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:
varargin{1}: String or char containing the prompt asking for one or

multiple numbers. Default is ‘Enter a number : ‘.

Returns:

out: A number or an array that the user put in. Otherwise contains 0.

bmDicom

bmDicomInfo(varargin)
bmDicomViewer(varargin)
BMDICOMVIEWER MATLAB code for bmDicomViewer.fig

BMDICOMVIEWER, by itself, creates a new BMDICOMVIEWER or raises the existing singleton*.

H = BMDICOMVIEWER returns the handle to a new BMDICOMVIEWER or the handle to the existing singleton*.

BMDICOMVIEWER(‘CALLBACK’,hObject,eventData,handles,…) calls the local function named CALLBACK in BMDICOMVIEWER.M with the given input arguments.

BMDICOMVIEWER(‘Property’, ‘Value’, …) creates a new BMDICOMVIEWER or raises the existing singleton (1). Starting from the left, property value pairs are applied to the GUI before bmDicomViewer_OpeningFcn gets called. An unrecognized property name or invalid value makes property application stop. All inputs are passed to bmDicomViewer_OpeningFcn via varargin.

(1) See GUI Options on GUIDE’s Tools menu. Choose “GUI allows only one instance to run (singleton)”.

See also: GUIDE, GUIDATA, GUIHANDLES

bmDicomWrite(imagesTable, varargin)
bmDicomLoad(argDirectoryPath)

initial myItemList and myNameList —————————————

bmDicomRead(varargin)

bmElastix

bmElastix(argImageList, nDim, argParamFile, argTempDir, varargin)

constant —————————————————————-

bmTransformix(argImageList, nDim, argDeformParamFile)

constant —————————————————————-

bmFieldDisp2

bmFieldPlot2_griddPlot(argX, argY, varargin)
bmFieldPlot2_noImage(arg_x, arg_y, arg_vx, arg_vy, argSize, autoScaleFlag, myNorm_max)

argin initial ———————————————————–

bmFieldPlot2_image(arg_x, arg_y, arg_vx, arg_vy, autoScaleFlag, myNorm_max, argImage)

argin initial ———————————————————–

bmFieldPlot2(x, y, vx, vy, argSize, autoScaleFlag, normMax, varargin)

bmFieldDisp3

bmFieldPlot3(x, y, z, vx, vy, vz, argSize, autoScaleFlag, normMax, varargin)
bmFieldPlot3_image(arg_x, arg_y, arg_z, arg_vx, arg_vy, arg_vz, autoScaleFlag, myNorm_max, argImagesTable)

argin initial ———————————————————–

bmFieldPlot3_noImage(arg_x, arg_y, arg_z, arg_vx, arg_vy, arg_vz, argSize, autoScaleFlag, myNorm_max)

argin initial ———————————————————–

bmFit1

bmBiExpFit1(argImagesTable, argX, argX_middle, varargin)

varargin = [monoErrorTh biErrorTh monoLowerBound monoUpperBound biLowerBound biUpperBound] varargout = [monoExpFit biExpFit monoErrorMask biErrorMask]

bmAffinePhaseFit(argPhase, argX, varargin)
bmMonoExpFit(argImagesTable, argX, varargin)
bmAffineFit(argImagesTable, argX, varargin)
bmMonoExpFit1(argImagesTable, argX, argR, varargin)

bmFourier1

bmFourierDoor(argK, argEdge, varargin)
bmConv1(f, h, dx)
bmDFT1_conjTrans(x, N_u, dK_u)
bmIDF1(x, N_u, dK_u)
bmDFT1(x, N_u, dK_u)

Fx = bmDFT1(x, N_u, dK_u)

This function computes the discrete Fourier transform for one dimensional data using a fast Fourier transform (FFT) algorithm.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:

x (1D array): Contains the data on which the FFT should be performed. The zero-frequency component is assumed to be in the center of x. N_u (list): Contains the size of the grid. dK_u (list): Contains the distances between grid points in every dimension.

Returns:

Fx (array): Contains the transformed data, having the same size as x. The zero-frequency component is given in the center of Fx.

bmIDF1_conjTrans(x, N_u, dK_u)

bmFourier123

map_function

cartesian

bmNasha_cartesian(y, N_u, dK_u, varargin)

argin_initial ———————————————————–

bmShanna_cartesian(x, N_u, dK_u, varargin)

argin_initial ———————————————————–

bmDFT123_conjTrans(x, N_u, dK_u)
bmDFT123(x, N_u, dK_u)
bmIDF123(x, N_u, dK_u)
bmNakatsha_cartesian(y, N_u, dK_u, varargin)

argin_initial ———————————————————–

nonCartesian

bmMathilda(y, t, v, varargin)

Performs the gridded reconstruction. First data is regridded to a virtual cartesian grid, then the image is created via fft. Finally a deapotization step is peformed. If no coil sensitivity C is in the input, then the coil images are returned

bmShanna_FFTW_omp(x, G, KFC)

argin_initial ———————————————————–

bmShanna_CUFFT_omp(x, G, KFC)

argin_initial ———————————————————–

bmNakatsha_MATLAB(y, G, KFC_conj, C_flag, n_u)

x = bmNakatsha_MATLAB(y, G, KFC_conj, C_flag, n_u)

This function copmutes the conjugate transpose of the Fourier transform and the coil sensitvity of Y -> C*F*(Y) while gridding the points to the uniform grid.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

y (array): The data in the k-space to be gridded and transformed into the image space. G (bmSparseMat): The backward gridding sparse matrix which is used for transposing the conjugate. -> Gut KFC_conj (array): The kernel matrix used for deapodization multiplied with the conjugate Fourier factor and the conjugate transpose of the coil sensitivity. Can be missing the conjugate transpose of C. C_flag (logical): Indicates if KFC_conj contains the conjugate of C. If false, the conjugate is not included in KFC_conj. n_u (list): The size of the image space grid.

Returns:

x (array): The computed image space data (C*F*y = x). Combined into one image x if C_flag is true, otherwise x has an image for every coil.

Notes:

This comes from F(Cx) = y -> x = F*(C*y). If the coil sensitivity is not given in KFC_conj, then only y -> F*(y) = x is computed. The data needs to be multiplied by the volume elements for correct results.

Examples:

x = bmNakatsha_MATLAB(y, Gut, KFC_conj, C_flag, n_u);

bmShanna_MATLAB(x, G, KFC, n_u)

y = bmShanna_MATLAB(x, G, KFC, n_u)

This function copmutes the Fourier transform of CX -> F(CX) while gridding the points back to the trajectory.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

x (array): The reconstructed image. G (bmSparseMat): The forward gridding matrix (grid -> trajectory). KFC (array): The kernel matrix used for deapodization multiplied with the fourier factor and the coil sensitivity. n_u (list): The size of the image space grid.

Returns:

y (array): The computed k-space data (FXC = y).

Examples:

y = bmShanna_MATLAB(x, Gu, KFC, n_u);

bmNakatsha_FFTW_omp(y, G, KFC_conj)

argin_initial ———————————————————–

bmNakatsha(y, G, KFC_conj, C_flag, n_u, fft_lib_sFlag)

x = bmNakatsha(y, G, KFC_conj, C_flag, n_u, fft_lib_sFlag)

This function copmutes the conjugate transpose of the Fourier transform and the coil sensitvity of Y -> C*F*(Y) while gridding the points to the uniform grid. The inverse Fourier transform is calculated using the iFFT algorithm with different implementations.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

y (array): The data in the k-space to be gridded and transformed into the image space. G (bmSparseMat): The backward gridding sparse matrix which is used for transposing the conjugate. -> Gut KFC_conj (array): The kernel matrix used for deapodization multiplied with the conjugate Fourier factor and the conjugate transpose of the coil sensitivity. Can be missing the conjugate transpose of C. C_flag (logical): Indicates if KFC_conj contains the conjugate of C. If false, the conjugate is not included in KFC_conj. Can only be false if the MATLAB fft implementation is used. n_u (list): The size of the image space grid. fft_lib_sFlag (char): The iFFT algorithm to be used. The options are ‘MATLAB’ using the MATLAB intern iFFT algorithm, ‘FFTW’ using the fastest Fourier transform in the west software library or ‘CUFFT’ using the CUDA fast Fourier transform library.

Returns:

x (array): The computed image space data (C*F*y = x). Combined into one image x if C_flag is true, otherwise x has an image for every coil.

Notes:

This comes from F(Cx) = y -> x = F*(C*y). If the coil sensitivity is not given in KFC_conj, then only y -> F*(y) = x is computed. The data needs to be multiplied by the volume elements for correct results.

Examples:

x = bmNakatsha(ve.*y, Gut, KF_conj, false, N_u, ‘MATLAB’);

bmNonUniformFourier_pinv_gpuNUFFT(y, t, ve, C, N_u, n_u, dK_u, ve_max)

initial —————————————————————–

bmNakatsha_CUFFT_omp(y, G, KFC_conj)

argin_initial ———————————————————–

bmNasha(y, G, n_u, varargin)

x = bmNasha(y, G, n_u, varargin)

This function grids data from a non-uniform trajectory onto a uniform grid given by the sparse matrix in G. The data is transformed from the k-space to the image space, after which this function accounts for the blurring introduced in the gridding (Deapodization). If the optional coil sensitivity is given, the images of all coils are combined into one reconstructed image.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:
y (array): The data that should be gridded from a non-uniform

trajectory onto a uniform grid.

G (bmSparseMat): Object containing the sparse matrix that grids the

non-uniform trajectory onto a uniform grid.

n_u (list): The size of the grid that the returned data should have.

This can be smaller, but not bigger, than the grid given by G.

varargin{1}: Array containing the coil sensitivity of each coil for

which the data is given in y. Has the same amount of points as y.

varargin{2}: Array containing the kernel matrix used for deapodization

after gridding the data onto the new grid.

varargin{3}: Char containing which fast Fourier transform algorithm

should be used. Options are ‘MATLAB’ using the MATLAB intern FFT algorithm, ‘FFTW’ using the fastest Fourier transform in the west software library or ‘CUFFT’ using the CUDA fast Fourier transform library.

Results:
x (array): The data regridded onto the uniform grid of size n_u, given

in the image space and in the block format.

bmShanna(x, G, KFC, n_u, fft_lib_sFlag)

y = bmShanna(x, G, KFC, n_u, fft_lib_sFlag)

This function copmutes the Fourier transform of CX -> F(CX) while gridding the points back to the trajectory. The Fourier transform is calculated using the FFT algorithm with different implementations.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

x (array): The reconstructed image. G (bmSparseMat): The forward gridding matrix (grid -> trajectory). KFC (array): The kernel matrix used for deapodization multiplied with the fourier factor and the coil sensitivity. n_u (list): The size of the image space grid. fft_lib_sFlag (char): The FFT algorithm to be used. The options are ‘MATLAB’ using the MATLAB intern FFT algorithm, ‘FFTW’ using the fastest Fourier transform in the west software library or ‘CUFFT’ using the CUDA fast Fourier transform library.

Returns:

y (array): The computed k-space data (FXC = y).

Examples:

y = bmShanna(x, Gu, KF, N_u, ‘MATLAB’)

partialCartesian

bmNasha_partialCartesian(y, ind_u, C, N_u, n_u, dK_u)

argin_initial ———————————————————–

bmShanna_partialCartesian(x, ind_u, FC, N_u, n_u, dK_u)

argin_initial ———————————————————–

bmNakatsha_partialCartesian(y, ind_u, FC_conj, N_u, n_u, dK_u)

argin_initial ———————————————————–

other_function

bmOverSamplingFactor_for_gpuNUFFT(N_u, n_u)
bmFourierModulation(y, t, x_shift)

prep_function

bmKF_conj(C_conj, N_u, n_u, dK_u, nCh, varargin)

KF_conj = bmKF_conj(C_conj, N_u, n_u, dK_u, nCh, varargin)

This function generates a kernel matrix K used for deapodization of the data that was gridded to a uniform grid using windows, considering the conjugate of the coil sensitivity (if given) and the conjugate Fourier factor F_conj.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

C_conj (array): The conjugate of the coil sensitivity. Has to be given as the conjugate (conj(C)). Can be given as [] if the coil sensitvity should not be included. N_u (list): The size of the grid for which K should be generated. n_u (list): The size of the grid in the image space. dK_u (list): The distances between grid points in every dimension. Same size as N_u. nCh (int): Number of channels (coils). K will be repeated for each channel. varargin{1}: Char that contains the kernel type. Either ‘gauss’ or ‘kaiser’. Default value is ‘gauss’. varargin{2}: Integer that contains the window width. Default value is 3 for ‘gauss’ and ‘kaiser’. varargin{3}: List that contains the kernel parameter. Default value is [0.61, 10] for ‘gauss’ and [1.95, 10, 10] for ‘kaiser’.

Returns:

KF_conj (array): The kernel matrix scaled by the factor F and C_conj if given. The matrix is given as a single in the column format (nPt, nCh).

bmK(N_u, dK_u, nCh, varargin)

K = bmK(N_u, dK_u, nCh, varargin)

This function generates a kernel matrix K of size N_u to deapodizate data that was gridded to a uniform grid using windows.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

N_u (list): Contains the size of the grid. dK_u (list): Contains the distances between grid points in every dimension. Same size as N_u. nCh (int): Number of channels (coils). K will be repeated for each channel. varargin{1}: Char that contains the kernel type. Either ‘gauss’ or ‘kaiser’ with ‘gauss’ being the default value. varargin{2}: Integer that contains the window width. Default value is 3 for ‘gauss’ and ‘kaiser’. varargin{3}: List that contains the kernel parameter. Default value is [0.61, 10] for ‘gauss’ and [1.95, 10, 10] for ‘kaiser’.

Results:

K (array): Kernel matrix that will be multiplied element-wise to the gridded data to deapodize it.

bmFC(C, N_u, n_u, dK_u)

argin_initial ———————————————————–

bmKF(C, N_u, n_u, dK_u, nCh, varargin)

KF = bmKF(C, N_u, n_u, dK_u, nCh, varargin)

This function generates a kernel matrix K used for deapodization of the data that was gridded to a uniform grid using windows, considering the coil sensitivity (if given) and Fourier factor F.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

C (array): The coil sensitivity. Can be given as [] if the coil sensitvity should not be included. N_u (list): The size of the grid for which K should be generated. n_u (list): The size of the grid in the image space. dK_u (list): The distances between grid points in every dimension. Same size as N_u. nCh (int): Number of channels (coils). K will be repeated for each channel. varargin{1}: Char that contains the kernel type. Either ‘gauss’ or ‘kaiser’. Default value is ‘gauss’. varargin{2}: Integer that contains the window width. Default value is 3 for ‘gauss’ and ‘kaiser’. varargin{3}: List that contains the kernel parameter. Default value is [0.61, 10] for ‘gauss’ and [1.95, 10, 10] for ‘kaiser’.

Returns:

KF (array): The kernel matrix scaled by the factor F and C if given. The matrix is given as a single in the column format (nPt, nCh).

bmK_old(N_u, dK_u, nCh, varargin)

argin_initial ———————————————————–

bmK_bump(N_u)

argin initial ———————————————————–

bmFC_conj(C_conj, N_u, n_u, dK_u)

argin_initial ———————————————————–

solver_function

imDim

nonCartesian

bmSteva(x, z, u, y, ve, C, Gu, Gut, frSize, delta, rho, nCGD, ve_max, nIter, witnessInfo)

initial —————————————————————–

bmSleva(x, y, ve, C, Gu, Gut, frSize, delta, regul_mode, nCGD, ve_max, nIter, witnessInfo)

initial —————————————————————–

bmSensa(x, y, ve, C, Gu, Gut, frSize, nCGD, ve_max, nIter, witnessInfo)

initial —————————————————————–

partialCartesian

bmSensa_partialCartesian(x, y, ve, C, ind_u, N_u, frSize, dK_u, nCGD, ve_max, nIter, witnessInfo)

initial —————————————————————–

bmSteva_partialCartesian(x, z, u, y, ve, C, ind_u, N_u, frSize, dK_u, delta, rho, nCGD, ve_max, nIter, witnessInfo)

initial —————————————————————–

imDim_morphosia

nonCartesian

bmTevaMorphosia_chain_all_to_first(x, z, u, y, ve, C, Gu, Gut, frSize, Tu, Tut, delta, rho, regul_mode, nCGD, ve_max, nIter, witnessInfo)

initial —————————————————————–

bmTevaMorphosia_chain(x, z, u, y, ve, C, Gu, Gut, frSize, Tu, Tut, delta, rho, regul_mode, nCGD, ve_max, nIter, witnessInfo)

initial —————————————————————–

bmSensitivaMorphosia_sheet(x, y, ve, C, Gu, Gut, frSize, Tu1, Tu1t, Tu2, Tu2t, delta, regul_mode, nCGD, ve_max, nIter, witnessInfo)

initial —————————————————————–

bmSensitivaMorphosia_chain(x, y, ve, C, Gu, Gut, frSize, Tu, Tut, delta, regul_mode, nCGD, ve_max, nIter, witnessInfo)

initial —————————————————————–

bmTevaMorphosia_sheet(x, z1, z2, u1, u2, y, ve, C, Gu, Gut, frSize, Tu1, Tu1t, Tu2, Tu2t, delta, rho, regul_mode, nCGD, ve_max, nIter, witnessInfo)

initial —————————————————————–

bmSensaMorphosia_chain(x, y, ve, C, Gu, Gut, frSize, Tu, Tut, nCGD, ve_max, nIter, witnessInfo)

initial —————————————————————–

bmTevaDuoMorphosia_chain(x, z1, z2, u1, u2, y, ve, C, Gu, Gut, frSize, Tu1, Tu1t, Tu2, Tu2t, delta, rho, regul_mode, nCGD, ve_max, nIter, witnessInfo)

initial —————————————————————–

bmSensitivaDuoMorphosia_chain(x, y, ve, C, Gu, Gut, frSize, Tu1, Tu1t, Tu2, Tu2t, delta, regul_mode, nCGD, ve_max, nIter, witnessInfo)

initial —————————————————————–

partialCartesian

bmTevaMorphosia_partialCartesian(x, z, u, y, ve, C, N_u, frSize, dK_u, ind_u, Tu, Tut, delta, rho, regul_mode, nCGD, ve_max, nIter, witnessInfo)

initial —————————————————————–

bmFourier2

bmFourierDisc(argK, argR, varargin)
bmIDF2(x, N_u, dK_u)
bmDFT2_conjTrans(x, N_u, dK_u)
bmFourierSquare(argK, argEdge, varargin)
bmDFT2(x, N_u, dK_u)

Fx = bmDFT2(x, N_u, dK_u)

This function computes the discrete Fourier transform for two dimensional data using a fast Fourier transform (FFT) algorithm.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:

x (2D array): Contains the data on which the FFT should be performed. The zero-frequency component is assumed to be in the center of x. N_u (list): Contains the size of the grid. dK_u (list): Contains the distances between grid points in every dimension.

Returns:

Fx (array): Contains the transformed data, having the same size as x. The zero-frequency component is given in the center of Fx.

bmConv2(f, h, dx, dy)
bmIDF2_conjTrans(x, N_u, dK_u)

bmFourier3

bmFourierSphere(argK, argR, varargin)
bmDFT3_conjTrans(x, N_u, dK_u)
bmFourierCube(argK, argEdge, varargin)
bmDFT3(x, N_u, dK_u)

Fx = bmDFT3(x, N_u, dK_u)

This function computes the discrete Fourier transform for three dimensional data using a fast Fourier transform (FFT) algorithm.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:

x (3D array): Contains the data on which the FFT should be performed. The zero-frequency component is assumed to be in the center of x. N_u (list): Contains the size of the grid. dK_u (list): Contains the distances between grid points in every dimension.

Returns:

Fx (array): Contains the transformed data, having the same size as x. The zero-frequency component is given in the center of Fx.

bmConv3(f, h, dx, dy, dz)
bmIDF3_conjTrans(x, N_u, dK_u)
bmIDF3(x, N_u, dK_u)

iFx = bmDFT3(x, N_u, dK_u)

This function computes the inverse discrete Fourier transform for three dimensional data using a fast Fourier transform (FFT) algorithm.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:

x (3D array): Contains the data on which the iFFT should be performed. The zero-frequency component is assumed to be in the center of x. N_u (list): Contains the size of the grid. dK_u (list): Contains the distances between grid points in every dimension.

Returns:

iFx (array): Contains the transformed data, having the same size as x. The zero-frequency component is given in the center of iFx.

bmFourierN

bmIDF(f, k, varargin)

argin_treatement ——————————————————–

bmDFT(f, x, varargin)

argin_treatement ——————————————————–

bmFunction1

bmFourierOfBigDoor_function(k, L, a)
bmFourierOfGauss_function(~, myMu, mySigma)
bmLittleDoor_function(x, L, a)
bmDoor2Bump(m, jump_width)
bmDirichletKernel(x, N)
bmDirichlet_A(N_over_2, dk, x)
bmDirichlet_S(N_over_2, dk, x)
bmFourierOfLittleDoor_function(k, L, a)
bmBigDoor_function(x, L, a)
bmGauss_function(x, myMu, mySigma)
bmSinc(x)
bmBump(x, xCut)
bmGauss(x, mySigma, varargin)
bmKaiser(x, alpha, tau)

bmGeom1

bmVolumeElement1(x)

out = bmVolumeElement1(x)

This function computes volume elements or differences between points in a sorted manner and returns these differences in the original input order.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:

x (array): Contains the points and size must be [N, nLine] with N the number of points per line

Returns:

out (array): Array with differences between midpoints calculated with x sorted after its first dimension. The size and order of the array is the same as x.

Examples:

dr = bmVolumeElement1(dr)

bmGeom123

bmVolumeElement_replace_radial_v2(x, v)
bmConvexFaceArea(x, sort_on)
bmVolumeElement_replace_radial_v3(x, v)
bmVoronoi(x, varargin)

out = bmVoronoi(x, varargin)

This function makes use of the ‘voronoin’ and ‘conhulln’ functions of matlab to calculate the area or volume from a list of seed points.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:
x (array): Contains the seeds from which the Voronoi cell is

calculated. Must be of size p x nPt, where nPt is the number of positions in the p-dimensional space. p can be 1,2 or 3. varargin: Can contain bool for the dispFlag to print the end of the calculations

Returns:

out (list): Contains Voronoi volume or area calculated from x and is of size [1, nPt]. Contains -1 at indexes where the values are invalid (should be filtered out afterwards).

Note:

The trajectory x must be separated i.e. the list of positions contained in x must be a list of pairwise different positions.

After ‘voronoin’ and ‘convhulln’, the problematic volume elements have to be replaced by a realistic value. This is done by one of the bmVoronoi_replace_vXXX function, the choice being specified by the string replaceVersion given in varargin.

bmVolumeElement(argTraj, argType, varargin)

bmVolumeElement - Compute volume elements based on different trajectory types.

varargout = bmVolumeElement(argTraj, argType, varargin)

Inputs:
argTraj - Trajectory data. Can be a matrix or a cell array of matrices

representing trajectories.

argType - Type of volume element computation. Supported types are:
  • ‘voronoi_center_out_radial2’: Computes volume using Voronoi method for 2D trajectories. It’s for 2D radial trajectory UTE, which means that the first sampled point is in the center, for each spoke.

  • ‘voronoi_center_out_radial3’: Computes volume using Voronoi method for 3D trajectories. It’s for 3D radial trajectory UTE, which means that the first sampled point is in the center, for each spoke.

  • ‘center_out_radial3’: Computes volume using center-out radial method for 3D trajectories. It is not using Voronoi but assumes the trajectory is uniformly distributed on the sphere. Faster but less precise.

  • ‘voronoi_full_radial2’: Computes volume using full radial method for 2D trajectories. It’s for radial 2D trajectories, where the spokes are full radial (diameters), instead of half radial.

  • ‘voronoi_full_radial3’: Computes volume using full radial method for 3D trajectories. It’s for radial 3D trajectories, where the spokes are full radial (diameters), instead of half radial.

  • ‘voronoi_full_radial2_nonUnique’: Computes volume using full radial method for 2D trajectories with non-unique points. This is for trajectory that have duplicates, but not only the center.

  • ‘voronoi_full_radial3_nonUnique’: Computes volume using full radial method for 3D trajectories with non-unique points. This is for trajectory that have duplicates, but not only the center.

  • ‘voronoi_box2’: Computes volume using box method for 2D trajectories. Cannot have duplicate. Any type of trajectory.

  • ‘voronoi_box3’: Computes volume using box method for 3D trajectories. Cannot have duplicate. Any type of trajectory. Not computationally feasible with realistic 3D acquisitions.

  • ‘imDeformField2’: Computes efficiently volume elements for 2D deformation field.

  • ‘imDeformField3’: Computes efficiently volume elements for 3D image deformation fields.

  • ‘cartesian2’: Computes volume elements for 2D Cartesian trajectories. Assumes that along each edge the point in position N/2 + 1 is zero.

  • ‘cartesian3’: Computes volume elements for 3D Cartesian acquisition trajectories. Assumes that along each edge the point in position N/2 + 1 is zero.

  • ‘randomPartialCartesian2_x’: Computes volume elements for 2D Cartesian trajectories. Some points can be missing from the grid.

  • ‘randomPartialCartesian3_x’: Computes volume using random partial Cartesian method for 3D trajectories.

  • ‘full_radial3’: Computes volume elements using full radial method for 3D trajectories. Some points can be missing from the grid.

varargin - Additional arguments required depending on the argType:
  • For ‘voronoi_full_radial2_nonUnique’: Number of averages.

  • For ‘imDeformField2’ and ‘imDeformField3’: Parameters for image deformation.

Outputs:

varargout{1} - Volume elements computed based on the specified argType.

Notes:
  • This function handles both single trajectory matrices and cell arrays of trajectory matrices.

  • It checks for NaN values in the computed volume elements and issues a warning if found.

Example:

% Compute volume elements using Voronoi method for 2D trajectories trajData = rand(100, 2); % Example 2D trajectory data vol = bmVolumeElement(trajData, ‘voronoi_center_out_radial2’);

See also:

bmVolumeElement_voronoi_center_out_radial2(), bmVolumeElement_voronoi_center_out_radial3(), bmVolumeElement_voronoi_full_radial2(), bmVolumeElement_voronoi_full_radial3(), bmVolumeElement_voronoi_full_radial2_nonUnique(), bmVolumeElement_voronoi_full_radial3_nonUnique(), bmVolumeElement_voronoi_box2(), bmVolumeElement_voronoi_box3(), bmVolumeElement_imDeformField2(), bmVolumeElement_imDeformField3(), bmVolumeElement_cartesian2(), bmVolumeElement_cartesian3(), bmVolumeElement_randomPartialCartesian2_x(), bmVolumeElement_randomPartialCartesian3_x(), bmVolumeElement_full_radial3(), bmVolumeElement_center_out_radial3()

Author: Bastien Milani Affiliation: CHUV and UNIL, Lausanne - Switzerland Date: May 2023

bmVoronoi_with_test(x)

initial —————————————————————–

bmVolumeElement_replace_cartesian(arg_v, N_u)
bmVolumeElement_replace_radial_v1(x, v)

bmGeom2

bmVolumeElement_randomPartialCartesian2_x(t, N_u, dK_u)
bmVolumeElement_voronoi_center_out_radial2(t)
bmNormalVector2(ex)
bmTwoLinesIntersect(ax, ay, bx, by, cx, cy, dx, dy)
bmVolumeElement_voronoi_full_radial2_nonUnique(t, nAverage)
bmVolumeElement_voronoi_full_radial2(t)

check ——————————————————————-

bmVolumeElement_voronoi_box2(t, N_u, d_u)
bmVolumeElement_cartesian2(t)
bmVolumeElement_imDeformField2(vf, N_u)

bmGeom3

bmQuickFitPlane(point_list, varargin)
bmVolumeElement_imDeformField3(vf, N_u)
bmVolumeElement_voronoi_center_out_radial3(t)

check ——————————————————————-

class bmPlane3

Bases: handle

Property Summary
class_type
n
p
bmVolumeElement_center_out_radial3(t)
bmLengthParamPath(p, length_between_neighbors)
bmVolumeElement_randomPartialCartesian3_x(t, N_u, dK_u)
bmVolumeElement_cartesian3(t)
bmVolumeElement_voronoi_box3(t, N_u, d_u)
bmVolumeElement_full_radial3(t)
bmHalfPlane3(argPlane, N_u)
bmTheta_phi(n)

[theta, phi] = bmTheta_phi(n)

This function calculates the spherical coordinates describing the given the vector n.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:
n (list): The vector of which the spherical coordinates should be

calculated.

Returns:
theta (double): Polar angle between n and the Z-axis (3rd axis).

Describes the tilt away from the Z-axis.

phi (double): Azimuthal angle describing the orientation of n in the

XY-plane.

Notes:

This function can be used to calculate the yaw and pitch Euler angles of a rotation. The calculation only works if the applied rotation is a rotation of a plane around the rotation axis n or the rotation matrix is calculated using proper Euler angles and a matrix multiplication of Z(phi)Y(theta)Z(psi), where Y and Z are the rotation matrices around the respectve axis.

n = [sin(theta)cos(phi), sin(theta)sin(phi), cos(theta)]’ in spherical coordinates.

bmNormalVector3(ez)
bmPsi_theta_phi(R)

[psi, theta, phi] = bmPsi_theta_phi(R)

This function calculates the proper Euler angles for a rotation matrix of R = Z(phi)Y(theta)Z(psi), where Z and Y are the rotation matrices around the respective axes.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:
R (array): Contains the rotation matrix calculated by multiplying

Z(phi)Y(theta)Z(psi). Is of size [3,3] or [9].

Returns:

psi (double): Euler angle of the third elementary rotation matrix. theta (double): Euler angle of the second elementary rotation matrix. phi (double): Euler angle of the first elementary rotation matrix.

bmVolumeElement_voronoi_full_radial3(t)

v = bmVolumeElement_voronoi_full_radial3(t)

This function calculates the volume elements of a sphere using a radial trajectory to be defined. This is done by calculating the surface of the sphere through Voronoi cells.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:

t (array): Radial trajectory with nPt points.

Returns:
v (array): Row vectory containing the volume element for each point in

the trajectory. Has size [1, nPt].

bmVolumeElement_voronoi_full_radial3_nonUnique(t)

check ——————————————————————-

bmGeomN

class bmPointList

Bases: handle

Property Summary
N
N_u

cartesian gridd

check_flag
d_u
f
f_dim
f_type
nLine
nPt
nSeg
nShot
v
v_dim
v_type
ve
ve_type
x

lists

x_dim

sizes

x_type

types

Method Summary
bmTraj()

Constructor for bmPointList.

check()

Check the integrity of the point list.

line_reshape()

Reshape the lines.

point_reshape()

Reshape the points.

bmGridding123

m

bmGridder_n2u(data_n, t, Dn, N_u, dK_u, varargin)

argin initial ———————————————————–

bmGriddingMatrix_prepare(t, N_u, d_u, nCh, gridding_type, varargin)

argin initial ———————————————————–

bmImDeformField2SparseMat(v, N_u, varargin)

argin initial ———————————————————–

bmImDeformField_multipleSparseMat(v, N_u, varargin)

argin initial ———————————————————–

class bmGriddingMatrix

Bases: handle

Property Summary
N_u
Nx

Size x of the pillar gridd. Is non-zero for imDim > 0. Scalar.

Ny

Size y of the pillar gridd. Is non-zero for imDim > 1. Scalar.

Nz

Size z of the pillar gridd. Is non-zero for imDim > 2. Scalar.

d_u
gridding_type
kernelParam
kernel_type
nPt

Number of points in the arbitrary gridd. Scalar.

nWin
secrete_length

int64 !!!

u_ind

List of index-jumps in the pillar_values array. Vector.

w

Gridding weights i.e. entries of the gridding matrix. Vector.

bmImDeformField2sparseMat_ind_weight(v, N_u, Dn, torus_flag)

initial —————————————————————–

bmGut_partialCartesian(y, ind_u, N_u)
bmTraj2SparseMat(t, v, N_u, dK_u, varargin)

varargout = bmTraj2SparseMat(t, v, N_u, dK_u, varargin)

This function computes the gridding matrices that allow to map the trajectory points onto the new grid and do the inverse. The returned matrices are either sparse matrices or objects of the class bmSparseMat, depending on the first optional argument.

Gn = Approximation of inverse -> backward mapping Gu = Forward mapping (grid to trajectory) Gut = Transpose of Gu -> backward mapping

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:

t (array / cell array): Contains all points of the trajectory. v (array / cell array): Contains the volume elements for each point in the trajectory. (1, nPt) N_u (list): The size of the cartesian k-space grid on which the trajectory is regridded. dK_u (list): The distance between the new grid points in the k-space for every dimension. In the physical sense 1/reconFoV. Same size as N_u. varargin{1}: Char that contains the sparse type. The function returns objects of class bmSparseMat if it is ‘bmSparseMat’ or empty and sparse matrices if anything else. Default value is ‘bmSparseMat’. varargin{2}: Char that contains the kernel type. Either ‘gauss’ or ‘kaiser’ with ‘gauss’ being the default value. varargin{3}: Integer that contains the window width. Default value is 3 for ‘gauss’ and ‘kaiser’. varargin{4}: List that contains the kernel parameter. Default value is [0.61, 10] for ‘gauss’ and [1.95, 10, 10] for ‘kaiser’.

Returns:

Gn as varargout{1}: Gn is a normalized sparse matrix or a bmSparseMat, depending on the sparseType (varargin{1}). If Gn is a sparse matrix, each row represents a grid point, and the entries represent the weighted contribution of trajectory points to each grid point. The size is [Nu_tot, nPt], where Nu_tot is prod(N_u) and nPt the number of trajectory points. Gn is the approximation of the inverse gridding. It grids the trajectory to the grid. Gu as varargout{1} or {2}: Gu is a normalized sparse matrix or a bmSparseMat, depending on the sparseType (varargin{1}). If Gu is a sparse matrix, each row represents a trajectory point, and the entries represent the weighted contribution of grid points to each trajectory point. The size is [nPt, Nu_tot], where Nu_tot is prod(N_u) and nPt the number of trajectory points. Gu is the forward mapping, which maps the grid points to the trajectory points. Gut as varargout{3}: Gut is a normalized sparse matrix or a bmSparseMat, depending on the sparseType (varargin{1}). Gut is the transpose of Gu and is backward mapping.

Examples:
Gn = bmTraj2SparseMat(

t, ve, N_u, dK_u, ‘bmSparseMat’, ‘gauss’, … 3, [0.61, 10] );

[Gu, Gut] = bmTraj2SparseMat(t, ve, N_u, dK_u); [Gn, Gu, Gut] = bmTraj2SparseMat(t, ve, N_u, dK_u);

bmGridder_n2u_leight(data_n, t, Dn, N_u, dK_u, varargin)

argin initial ———————————————————–

bmGu_partialCartesian(x, ind_u, N_u)

mex

bmImage1

m

bmImWaveletInv1(cA, cD, n_u, varargin)
bmImWavelet1(x, n_u, varargin)

mex

bmImage123

bmImGradient(argIm)
bmImDeform(Tu, x, n_u, K)
bmImIDF(argIm, varargin)
bmImConv_fourier(a, b)
bmImClose(argIm, argShiftList)
bmImLaplacian(argIm)

out = bmImLaplacian(argIm)

This function efficiently calculates the Laplacian of the given 1D, 2D, 3D, real or complex data.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

argIm (array): The data of which the Laplacian should be calculated.

Returns:

out (array): The Laplacian of the data (same size as argIm).

bmImErode(argIm, argShiftList)
bmImShiftList(argType, a, myPercent, varargin)
bmImPseudoDiffusion(argIm, varargin)

myIm = bmImPseudoDiffusion(argIm, varargin)

This function performes smoothing on data by averaging the data over its direct neighbors (not diagonal), by diffusing the data. The edge cases take as neighbors the edges on the other side as a circular shift is used. This function can be applied to 1D, 2D and 3D data.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

argIm (array): The data that should be diffused. varargin{1}: Integer containing the number of iterations of averaging applied to smooth the data. The default value is 1.

Returns:

myIm (data): The data smoothed.

bmImConv_byShiftList(argIm, argShiftList, varargin)

varargin —————————————————————-

bmImShiftList_to_image(argShiftList, varargin)
bmImGaussFiltering(argIm, argSigma, blackBorder)
bmImGrid(n_u, X, Y, Z)
bmImLaplaceIterator(imStart, m, nIter, varargin)

out = bmImLaplaceIterator(imStart, m, nIter, varargin)

This function iteratively solves the Laplace equation for the masked parts of the data (m = 0) using functions written in c++ to efficiently perform the computations. This is done to estimate and smooth the masked part of the data to match it to the unmasked data. The data can be 1D, 2D or 3D and openMP can be used for parallel processing.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

imStart (array): Data of which the Laplace equation should be solved. m (array): Mask that indicate which parts of the data should be kept as the original data (m = 1) and for which parts the equation should be solved (m = 1). nIter (int): Number of iterations done in this function. varargin{1}: Char or flag that allows parallized processing with openMP. This is done if the value is ‘omp’ or true. Default value is false. varargin{2}: Integer giving the number of blocks processed by a thread. Default value is the the max size of imStart -> all blocks in one thread.

Returns:

out (array): The data with the masked parts solved using an iterative solver and the unmasked parts the same as the original data.

bmImShiftList_to_structEl(argShiftList)
bmImDFT(argIm, varargin)
bmImConv_inMask_byShiftList(argIm, argShiftList, argMask, varargin)
bmImPseudoDiffusion_inMask_byShiftList(argIm, argShiftList, argMask, varargin)
bmImDilate(argIm, argShiftList)
bmStructEl_to_imShiftList(argStructEl)
bmImContrastEnhance(argIm, enhence_factor)
bmImPseudoDiffusion_inMask(argIm, argMask, varargin)

myIm = bmImPseudoDiffusion_inMask(argIm, argMask, varargin)

This function performes smoothing on data by averaging the data over its direct neighbors (not diagonal), by diffusing the data. The edge cases take as neighbors the edges on the other side as a circular shift is used. This operation is restricted to only modify and consider the unmasked data (where argMask is 1). The masked data keeps the values of the original data. This function can be applied to 1D, 2D and 3D data.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

argIm (array): The data that should be diffused. argMask (array): Of the same size as argIm and masks the regions with 0 that should not be modified and considered in the smoothing. varargin{1}: Integer containing the number of iterations of averaging applied to smooth the data. The default value is 1.

Returns:
myIm (data): The data smoothed at the unmasked points and the original

data at the masked points.

bmImBumpFiltering(argIm, nPixFilter)
bmImDeformT(Tut, x, n_u, K)
bmImCrossMean(argIm)
bmImSqueeze(argIm)
bmImResize(argIm, n_u, N_u, varargin)
bmImPseudoDiffusion_byShiftList(argIm, argShiftList, varargin)
bmImLaplaceEquationSolver(imStart, m, nIter, L_th, varargin)

out = bmImLaplaceEquationSolver(imStart, m, nIter, L_th, varargin)

This function solves a Laplace equation by iteration to estimate the values of the image at the masked parts (m = 0). After nIter iterations the residual is compared to the given threshold to decide if the solution converged enough in the masked parts. This indicates that no rough places or edges exist anymore. This function is used to estimate the coil sensitivity at the masked parts of the data.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

imStart (array): Real or complex data of which the masked parts should be estimated. m (array): Mask with the same size as imStart (masked where m = 0). nIter (int): Number of iterations before the result is checked. L_th (double): Threshold for the residual to determine if the solution converged enough. varargin{1}: Flag; use openMP for parallel processing if true. Default value is [] (false) varargin{1}: Number of blocks per thread (not used atm).

Returns:

out (array): Estimate for the coil sensitvity at the masked parts of the data. The unmasked parts have the original data values.

bmImReshape(argIm)

[outIm, imDim, imSize, varargout] = bmImReshape(argIm)

This function returns the number of dimensions and size of the input array. Can optionally return the x, y and z size, which are the size of the first three dimensions of the input array. If the input array is a vector (1D), the returned array is a column vector.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:
argIm (array): The array of which the dimension and size should be

returned. Cannot be empty.

Returns:

outIm (array): Same as argIm except if argIm is 1D, then the outIm is reshaped to a column vector. imDim (int): The number of dimensions. imSize (list): The size of each dimension as a list. varargout{1}: Integer containing the size of the first dimension. varargout{1}: Integer containing the size of the second dimension. Empty if imDim < 2 varargout{1}: Integer containing the size of the third dimension. Empty if imDim < 3

bmImCrope(arg_im, N_u, n_u)

croped_im = bmImCrope(arg_im, N_u, n_u)

This function croppes the data from grid of size N_u to grid of size n_u. Both sizes have to be either even or odd. N_u has be bigger than n_u.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

arg_im (array): Data that should be cropped. N_u (list): Size of the grid occupied by the data in block format. n_u (list): Size of the grid on which the data should be cropped. If N_u is odd, this has to be odd as well. Same for N_u even.

Results:

cropped_im (array): Data cropped and given in block format. Or the same format as the input if no cropping is needed.

bmImOpen(argIm, argShiftList)
bmImZeroFill(arg_im, N_u, n_u, argType)

out_im = bmImZeroFill(arg_im, N_u, n_u, argType)

This function padds the image data with zeros if the k-space grid is bigger than the image space grid.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

arg_im (array): The data in the image space to be padded. N_u (list): The grid size in the k-space. n_u (list): The grid size in the image space. argType (char): The type of the to be padded array. Can be ‘real_double’, ‘real_single’, ‘complex_double’ and ‘complex_single’.

bmImCrossMean_omp(argIm)
bmImExtend(argIm, nPix)

bmImage2

m

bmImRotate2(arg_im, phi, varargin)
bmImWaveletInv2(cA, cH, cV, cD, n_u, varargin)
bmImShift2(im, s)
bmImWavelet2(x, n_u, varargin)
bmImDeformField_hardThresholding2(v, n_u, argTh)

mex

bmImage3

m

bmImWaveletInv3(cA, cH, cV, cD, n_u, varargin)
bmImDeformField_hardThresholding3(v, n_u, argTh)
bmImRotate3(arg_im, psi, theta, phi, varargin)
bmImWavelet3(x, n_u, varargin)

mex

bmImageN

bmRMS(x, N_u)

a = bmRMS(x, N_u)

This function calculates the root mean square (RMS) value for each data point across all channels.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

x (array): The data for which the RMS should be calculated. N_u (list): The size of the data of one channel in x.

Results:
a (array): The RMS for every data point in either block or column

format depending on the format of x (block or other).

bmImDim(a)

[n, s, varargout] = bmImDim(a)

This function returns the number of dimensions and size of the input array. Can optionally return the x, y and z size, which are the size of the first three dimensions of the input array.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:
a (array): The array of which the dimension and size should be

returned. Can be empty.

Returns:

n (int): The number of dimensions. s (list): The size of each dimension as a list. varargout{1}: Integer containing the size of the first dimension. Empty if n < 1 varargout{1}: Integer containing the size of the second dimension. Empty if n < 2 varargout{1}: Integer containing the size of the third dimension. Empty if n < 3

bmMIP(y, N_u)

a = bmMIP(y, N_u)

This function performs a Maximum Intensity Projection (MIP) on the input data.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

y (array): The data for which the MIP should be calculated. N_u (list): The size of the data of one channel in y.

Results:
a (array): The MIP for every data point in either block or column

format depending on the format of x (block or other).

bmImDisp

class bmImageViewerParam

Bases: handle

bmImageViewerParam < handle

This class only has properties and a constructor to fill the properties. This class contains the parameters used to create and manage an interactive figure that visualizes data as an image.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation) MattechLab 2024

Constructor Parameters:
argIn: Either an object of this class to create a copy, or an

integer from 2 to 5 defining the dimension of the image.

varargin{1}: The image data that should be displayed by a figure

with these parameters. Required if argIn is only an integer.

Constructor Summary
bmImageViewerParam(argIn, varargin)
Property Summary
class_type
colorLimits
colorLimits_0
curImNum
curImNum_4
curImNum_5
imDim
imSize
mirror_flag
numOfImages
numOfImages_4
numOfImages_5
permutation
phi
point_A
point_B
point_C
point_list
psi
reverse_flag
rotation
theta
transpose_flag
bmImDeformFieldInverse_checkerboardDisp2(v, n_u, cell_width)
bmNanColor(argImage)
bmImage(argImage, varargin)

varargout = bmImage(argImage, varargin)

This function creates an interactive figure displaying data from a 2D, 3D, 4D or 5D array. If the data is complex, the absolute value will be used.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

argImage (array): Contains the data to be displayed as an image. varargin{1}: Object of class bmImageViewerParam, giving the parameters for the image.

Returns:
varargout{1}: Object of class bmImageViewerParam that was used in the

creation of the figure and containing the coordinates of placed points.

bmImage5(argImagesTable, varargin)

initial —————————————————————–

bmImage2(argImagesTable, varargin)

argin initial ———————————————————–

bmImDeformFieldInverse_gridDisp2(v, n_u, cell_width, varargin)
bmImage3(argImagesTable, varargin)

varargout = bmImage3(argImagesTable, varargin)

This function creates an interactive figure for 3D data. The figure visualizes the data by plotting a greyscale heatmap for two dimensions and allows to scroll through the third dimension. There are other options that allow to modify the view. These options are further explained in the console by pressing h (for help).

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation, Comments, Help and Bug fixing) MattechLab 2024

Parameters:

argImagesTable (3D array): The data to be visualized varargin{1}: bmImageViewerParam object containing the parameters for the image. varargin{2}: Logical (flag) that interrupts the code execution until the figure is closed if true.

Returns:

varargout{1}: bmImageViewerParam object containing the parameter for the image. Useful to get the coordinates of placed points.

bmImage4(argImagesTable, varargin)

initial —————————————————————–

bmImDeformField_meshDisp2(v, n_u, every_n_line)

bmImReg

class

class bmImReg_directTransfrom

Bases: handle

Property Summary
class_type
v
class bmImReg_translationTransform

Bases: handle

Property Summary
class_type
t
class bmImReg_solidTransform

Bases: handle

Property Summary
R
c_ref
class_type
t
class bmImReg_affineTransform

Bases: handle

Property Summary
R
S
c_ref
class_type
t

m

bmImReg_deformField_to_positionField(v, n_u, X, Y, Z, varargin)
bmImReg_getInitialTranslationTransform_estimate(imRef, imMov, X, Y, Z)
bmImReg_leastSquare_solidTransform_registration(x_ref_0, x_0, nIter_max_list, resolution_level_list, initialSolidTransform, X, Y, Z)

method_param ————————————————————

bmImDeformFieldSheet_imRegDemons23(x, n_u, sheet_type, nIter, nSmooth, arg_name, varargin)
bmImReg_deform(v, x, n_u, X, Y, Z, varargin)
bmImReg_transform_to_deformField(argTransform, n_u, X, Y, Z)
bmImReg_getInitialSolidTransform_recursive(imRef, imMov, nIter_max, initialTranslationTransform, X, Y, Z)
bmImReg_getInitialSolidTransform_estimate(imRef, imMov, X, Y, Z)
bmImDeformFieldChain_imRegDemons23(x, n_u, chain_type, nIter, nSmooth, arg_name, varargin)
bmImReg_getCenterMass_estimate(argIm, X, Y, Z, varargin)
bmImReg_getInitialTranslationTransform_estimate_2(imRef, imMov, X, Y, Z)
bmImReg_getInitialTranslationTransform_recursive(imRef, imMov, nIter_max, X, Y, Z)
bmImReg_solidTransform_distance(T1, T2, half_imRadius)

bmInterp1

bmPhaseInterp1(t, phi, s)
bmInterp1(x, y, k)

bmInterp2

bmPhaseInterp2(t1, t2, phi, s1, s2)
bmInterp2(argIm, argMethod, varargin)

bmInterp3

bmPhaseInterp3(t1, t2, t3, phi, s1, s2, s3)
bmInterp3(argIm, argMethod, varargin)

bmLinAlg2

bmRotation2(phi)
bmRotation2_inv(phi)

bmLinAlg3

bmOmega3(psi, theta, phi)
bmRotation3_inv(psi, theta, phi)
bmRotation3(psi, theta, phi)

R = bmRotation3(psi, theta, phi)

This function calculates the rotation matrix R by means of matrix multiplication of three single matrices that each represent the elemental rotation around an axis (X, Y, Z or 1,2,3). This rotation matrix is calculated as R = Z(phi)*Y(theta)*Z(psi).

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

psi (double): Euler angle of the third elementary rotation matrix. theta (double): Euler angle of the second elementary rotation matrix. phi (double): Euler angle of the first elementary rotation matrix.

Returns:

R (array): A 3x3 rotation matrix.

bmLinSpace

bmX_norm(x, d_u, varargin)
bmProx_oneNorm(w, s)
bmY_ve_reshape(ve, y_size)

ve_out = bmY_ve_reshape(ve, y_size)

This function reshapes the array with the volume elements calculated for the data y to match the size of y given in y_size. If y_size indicates more elements than given in ve, the values in ve are repeated to match the given size. This means that if y_size has more channels than ve, ve is repeated for every channel. If ve is a scalar, ve is repeated for every datapoint.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

ve (array): The volume elements of the data that should be resized and reshaped to match the size given in y_sze. y_size (list): The size of the data.

Returns:
ve_out (array): Array (or vector) matching the size given in y_size,

with some ve values repeated if necessary.

bmY_norm(y, d_n, varargin)

n = bmY_norm(y, d_n, varargin)

This function computes the weighted norm of the data y with the volume elements d_n. The norm is computed for every channel.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

y (array): The data containing datapoints per channel. d_n (array): The volume elements for every datapoint. Can be a scalar taken for every datapoint, or can have different values for different channels. varargin{1}: Flag; collapses the output into a single value if true. Another norm is calculated across channels to receive this value. Default value is false.

Returns:

n (list): The norms for every channel computed over the datapoints. Only a scalar if y only contains one channel or the optional flag is true. Row or column vector depending on y -> if size(y,2) = nCh then size(n,2) = nCh and n is a row vector.

bmY_prod(y1, y2, d_n)
bmX_prod(x1, x2, d_u)

bmMask123

bmElipsoidMask(arg_size, r, varargin)

bmMask2

bm2DimInBorderMask(M)
bmOutBorderMask2(M)
bmDiskMask(argSize, argCenter, argRadius)

bmMask3

bmOutBorderMask3(M)
bmSphereMask(argImage, argCenter, argRadius)
bm3DimInBorderMask(M)
bmMidPlanMask(a, b, d_plan, d_mid)
bmSmoothMask3(argMask, nPixFilter)

bmMaskN

bmBluryMaskExctract(argBluryMask, argArray)

bmMathDisp

bmMountainPlot(M, varargin)
bmLineListPlot(argLines, argLinAssym, varargin)
bmPlot(x, y, varargin)

bmMathOp

bmSquaredNorm(x, H)
bmPlus(x, y)
bmAxpy(a, x, y)
bmEuclideProd(x1, x2, H)
bmMinus(x, y)
bmNorm(x, H)
bmMult(x, y)

bmMex

m

compile_mex_for_monalisa()

compile_mex_for_monalisa - Compiles the necessary files based on the operating system.

Usage:
compile_mex_for_monalisa()

Automatically detects the OS and sets the necessary variables.

bmMexClean(varargin)
bmMexTest_omp()
bmMex_cell2command(c, cuda_I_dir, cuda_L_dir, fftw_I_dir, fftw_L_dir)
bmMex(argDir, varargin)
bmMex_extern_dir(arg_file)

mex

bmMitosius

bmMitosius_load(mitosius_dir, arg_name, varargin)
bmMitosius_clean(mitosius_dir, varargin)
bmMitosius_create(mitosius_dir, varargin)
bmMitosius_nCell(mitosius_dir)
bmMitosius_save(mitosius_dir, file_name, var_name, arg_var, varargin)

bmMriPhi

bmMriPhi_phase_to_mask(phi, nPhase, argPercent)
bmMriPhi_fromSI_collect_signal_list(filter_type, t_ref, nu_ref, mySI, lowPass_filter, bandPass_filter, nCh, N, nSeg, nShot, nSignal_to_select, signal_exploration_level, ind_shot_min, ind_shot_max, ind_SI_min, ind_SI_max, s_reverse_flag)
bmMriPhi_manually_exclude_signal_of_list(s_in)
bmMriPhi_fromSI_get_standart_reference_signal(rmsSI, ~, N, nSeg, nShot)

initial —————————————————————–

bmMriPhi_fromSI_standartSignal_to_reformatedSignal(s_filtered, nSeg, nShot, ind_shot_min, ind_shot_max, varargin)
bmMriPhi_signalList_to_phaseList(s)
bmMriPhi_signal_selection(s, t_ref, nu_ref, lowPass_filter, bandPass_filter, nSignal_to_select)
bmMriPhi_fromSI_rawPerShotSignal_to_standartSignal(s, nSeg, ~, ind_shot_min, ind_shot_max)

signal is croped

bmMriPhi_fromSI_get_rawPerShotSignal(rmsSI, ind_SI_min, ind_SI_max, s_reverse_flag)
bmMriPhi_signalList_to_phase(signal_extracted_list)
bmMriPhi_magnitude_to_mask(s, nMask, nSeg, ~, ind_shot_min, ~)
bmMriPhi_graphical_frequency_selector(varargin)
BMMRIPHI_GRAPHICAL_FREQUENCY_SELECTOR MATLAB code for bmMriPhi_graphical_frequency_selector.fig

BMMRIPHI_GRAPHICAL_FREQUENCY_SELECTOR, by itself, creates a new BMMRIPHI_GRAPHICAL_FREQUENCY_SELECTOR or raises the existing singleton*.

H = BMMRIPHI_GRAPHICAL_FREQUENCY_SELECTOR returns the handle to a new BMMRIPHI_GRAPHICAL_FREQUENCY_SELECTOR or the handle to the existing singleton*.

BMMRIPHI_GRAPHICAL_FREQUENCY_SELECTOR(‘CALLBACK’, hObject, eventData, handles, …) calls the local function named CALLBACK in BMMRIPHI_GRAPHICAL_FREQUENCY_SELECTOR.M with the given input arguments.

BMMRIPHI_GRAPHICAL_FREQUENCY_SELECTOR(‘Property’, ‘Value’, …) creates a new BMMRIPHI_GRAPHICAL_FREQUENCY_SELECTOR or raises the existing singleton (1). Starting from the left, property value pairs are applied to the GUI before bmMriPhi_graphical_frequency_selector_OpeningFcn gets called. An unrecognized property name or invalid value makes property application stop. All inputs are passed to bmMriPhi_graphical_frequency_selector_OpeningFcn via varargin.

(1) See GUI Options on GUIDE’s Tools menu. Choose “GUI allows only one instance to run (singleton)”.

See also: GUIDE, GUIDATA, GUIHANDLES

bmMriPhi_fromSI_plot_signal(s, ind_shot_min, ind_shot_max, ind_SI_min, ind_SI_max, plot_factor)
bmMriPhi_fromSI_rmsSI(argSI, nCh, N, nShot)
bmMriPhi_fromSI_imNav(rmsSI, ~, nSeg, ~, ind_shot_min, ind_shot_max, ~, ~, ind_imNav_min, ind_imNav_max, ~)

bmMriRecon

class

class bmMriAcquisitionParam

Bases: handle

Constructor Summary
bmMriAcquisitionParam(arg_name)

Constructor for bmMriAcquisitionParam.

Property Summary
FoV
N
check_flag
class_type
imDim
mainFile_name
nCh
nEcho
nLine
nPar
nPt
nSeg
nShot
nShot_off
name
node_type
raw_N_u
raw_dK_u
roosk_flag
selfNav_flag
timestamp
traj_type
Method Summary
create(reconDir)

Create a new acquisition parameter set.

refresh()

Refresh the acquisition parameters.

save(reconDir)

Save the acquisition parameters to a file.

function

bmSimulateMriData(h, C, t, N_u, n_u, dK_u)
bmMergeMriData_partialCartesian3_x(y, t, N_u, dK_u)
bmLowRes(c, t, ve, N_u, dK_u)

varargout = bmLowRes(c, t, ve, N_u, dK_u)

This function ensures that the points of the trajectory are inside the new grid defined by N_u and dK_u. It removes the points, the corresponding data from the channels and the volume elements and returns them if asked for.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

c (array): Contains the data from the channels corresponding to the points in the trajectory t. t (array): Contains the trajectory (coordinates). ve (array): Contains the volume elements for each point in the trajectory. N_u (array): Has the same dimension as t and contains the size of the new grid for each dimension. dK_u (array): Has the same dimension as N_u and contains the distance between every point of the new grid in each dimension.

Returns:
varargout{1} (array): Channel data of size [nCh, nPt], where nPt is the

new number of points after excluding the points outside the new grid.

varargout{2} (array): Trajectory of size [nDim, nPt], where nPt is the

new number of points after excluding the points outside the new grid.

varargout{3} (list): Volume elements of size [1, nPt], where nPt is the

new number of points after excluding the points outside the new grid.

bmUnionOfMriData_partialCartesian(y_cell, t_cell, N_u, dK_u)
bmCheckCoilPositions(im_main, im_prescan, n_u)
bmSimbaCluster_to_lineMask(simbaCluster, nSeg, nShot)
bmMriNoiseDecor(noise_meas, y, C, C_n_u)

initial —————————————————————–

bmLowRes_cartesian(c, N_u_curr, dK_u_curr, N_u_new, dK_u_new)

bmOptim

bmBackGradient_nT(x, n_u, dX_u, n)
class bmWitnessInfo

Bases: handle

Constructor Summary
bmWitnessInfo(varargin)

constructor

Property Summary
creationTime
finalCallTime
finalInd
param
param_name
save_witnessIm_flag
witness_im
witness_ind
witness_name
witness_time
Method Summary
watch(curr_ind, x, n_u, loop_or_final, varargin)
bmTV_gradient(x, N_u, dX_u)
bmTV(x, N_u, dX_u)
bmBackGradientT(g, n_u, dX_u)
bmInitialWitnessInfo(witnessInfo, varargin)
bmBackGradient(x, n_u, dX_u)
bmTSV_gradient(x, N_u, dX_u)
bmTSV(x, N_u, dX_u)
class bmConvergeCondition

Bases: handle

Constructor Summary
bmConvergeCondition(varargin)

constructor

Property Summary
endTime
min_denom
nIter_curr
nIter_max
nIter_statu
startTime
targDist_curr
targDist_history
targDist_prev
targDist_statu
targDist_th
targProgression_curr
targProgression_flag
targProgression_hisotry
targProgression_statu
targProgression_th
x_travel_curr
x_travel_history
x_travel_statu
x_travel_th
y_travel_curr
y_travel_history
y_travel_statu
y_travel_th
Method Summary
check(varargin)
disp_info(varargin)
plot()
bmBackGradient_n(x, n_u, dX_u, n)

bmPartition

bmIntegerEquipartition(nTask, nProcess, process_id, index_mode)
bmCircular_ind_next(nRank, ind_curr, index_mode)
bmRound(varargin)
bmScalarBinning(x, nBin)
bmCircular_ind_prev(nRank, ind_curr, index_mode)

bmPhaseLift

bmLocalPhaseLift3(argImagesTable, argTime, varargin)
bmPhaseLift1(argSignal, varargin)

bmPhysicNum

bmGammaBar_H()
bmGetGyro(argString, varargin)

Arg string is the name of an element. Ex : ‘Na’ or ‘23Na’. Varargin accepts ‘Hz’ or ‘Rad’ or nothing. out = gyromagnetic_ratio in Rad Hz / T or in Hz / T. Varargout = [unit, element_name].

bmGamma_H()

bmQuickSolve

bmDoubleFA_solve(c, beta, ratio, precision)
bmAffineSolve(y, f, x)

bmReadWrite

bmGetDir()
bmCheckDir(argDir, dlgFlag)
bmDeleteFolder(argDir)
bmNameList(argDir, varargin)
bmCell2TextFile(arg_cell, arg_file)
bmBinary2Array_cData(argDir, argFileName_real, argFileName_imag)
bmGetFile()
bmNumList(argNum)
bmCheckFile(argFile, dlgFlag)
bmUpdateMonalisa(dir_bmToolBox, dir_monalisa)
bmArray2Binary(argArray, argDir, argFileName, argType)
bmVarName(arg_in)
bmFile2Array(argDir, argName, argChar, argType)
bmBinary2Array_sparseMat(argDir)
bmCsvReshape(argArray, argSize)
bmSave(arg_file, arg_var)
bmDeleteFile(arg_file)
bmCreateDir(argDir, varargin)
bmTextFile2Cell(arg_file)
bmLoad(arg_file)
bmBinary2Array(argDir, argFileName)
bmArray2Binary_sparseMat(s, argDir)
bmDirList(argDir, recursive_flag)
bmClearDir(argDir)
bmArray2File(argDir, argName, argArray, argChar, argType)
bmFindFileContainingString(argDir, argString)
bmArray2Binary_cData(realData, imagData, argDir, realFileName, imagFileName)
bmCheckPath(argPath, dlgFlag)

bmSparseMat

m

bmSparseMat_bmSparseMat2matlabSparse(a)
class bmSparseMat

Bases: handle

Property Summary
N_u
block_length
block_type
check_flag
d_u
kernelParam
kernel_type
l_block_start
l_ind

This is the index list of non zero left entry. It is empty by default.

l_jump

This is empty if there is no left sparsity. If it is empty, it is interpretated as a list of ones of length l_size. Vector.

l_nJump

This is the number of l_jump, and is equal to l_size if l_jump is empty. Scalar.

l_size

Left size of the matrix. Scalar.

l_squeeze_flag
m_block_start

int64 !!!

m_val

This is paired to r_jump. Vector.

nBlock
nWin
r_ind

This is the list of right index. Vector.

r_jump

This is the list of right jump. Vector.

r_nJump

This is a list, one entry for each line of the matrix.

r_size

Right size of the matrix. Scalar.

type

possible : void, matlab_ind, l_squeezed_matlab_ind, cpp_prepared, l_squeezed_cpp_prepared

Method Summary
check()

Check the integrity of the sparse matrix.

cpp_prepare(argMode, nJumpPerBlock_factor, blockLengthMax_factor)

Prepare the matrix for C++ processing.

l_squeeze()

Squeeze the left side of the matrix.

bmSparseMat_vec(s, v, varargin)

w = bmSparseMat_vec(s, v, varargin)

This function performes sparse matrix-matrix multiplication using mex functions to perform the computation efficiently in c++.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:
s (bmSparseMat): Sparse matrix object that contains the left matrix of

the matrix multiplication.

v (2D array): Matrix containing vectors of data. The length of the

vectors must be the same size as the columns of the sparse matrix. This is the right matrix of the matrix multiplication.

varargin{1}: Char containing ‘omp’, or a logical. If ‘omp’ or true, the

computation uses openMP to perform parallel processing using threads. The default value is false.

varargin{2}: Char containing ‘complex’ or ‘real’, or a logical. If

‘complex’ or false, the v is processed as a complex vector, otherwise, v is assumed to be real. The default value is true (‘real’)

varargin{3}: Logical flag if v has to be transposed. If true, v is

processed as containing row vectors (row length = sparse column length). If false, v is processed as containing column vectors (column length = sparse column length). If not given, the dimension of smaller size is assumed to contain the vectors, as normally there is more data than vectors.

Returns:
w (2D array): Result of the matrix multiplication. Real or complex,

depending on the input.

bmSparseMat_blockPartition(r_nJump, nJumpPerBlock_factor, blockLengthMax_factor, varargin)

[l_block_start, block_length, nBlock, zero_block_flag] = … bmSparseMat_blockPartition(r_nJump, nJumpPerBlock_factor, … blockLengthMax_factor, varargin)

This function partitiones the r_nJump array into blocks.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:
r_nJump (array): Contains for each point the number of points in the

second dimension of the sparse matrix, the number of indices jumped in a flattened array to get to the next point.

nJumpPerBlock_factor: Factor of the maximum of number of jumps in

r_nJump that gives the maximum number of jumps allowed to be in one block. (sum of entries)

blockLengthMax_factor: Factor of the maximum of number of jumps in

r_nJump that gives the maximum number of indices allowed to be in one block. (sum of indices)

varargin{1} (char): Contains ‘one’ the array should only be partitioned

into one block.

Returns:

l_block_start: Integer or row vector containing start index of each block. block_length: Integer or row vector containing length of each block. nBlock (int): Contains the number of blocks. zero_block_flag (bool): Is true if the sum of jumps for any block is zero or negative.

bmSparseMat_matlabSparse2bmMultipleSparseMat(ms, i, matlabSparseMat, N_u, d_u, kernelType, nWin, kernelParam)
bmSparseMat_cell2line(argCell, varargin)
bmSparseMat_matlabSparse2bmSparseMat(a, N_u, d_u, kernelType, nWin, kernelParam)

b = bmSparseMat_matlabSparse2bmSparseMat(a, N_u, d_u, kernelType, nWin, kernelParam)

This function creates a object of class bmSparseMat, fills it out with the given arguments and returns the object.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:

a (sparse matrix): Main sparse matrix of size [prod(N_u), NPt], where NPt is the number of points in the trajectory. N_u (list): Contains the number of points in the grid in each dimension. d_u (lits): Contains the distance between the grid points in each dimension. kernelType (char): Kernel type for the gridding. nWin (int): Window-width for the gridding. kernelParam (list): Kernel parameters corresponding to the kernel type.

Returns:

b (bmSparseMat): Object filled in with the given parameters

bmSparseMat_isequal(s, t)
bmSparseMat_completeMatlabSparse(argSparse, mySize)

mySparse = bmSparseMat_completeMatlabSparse(argSparse, mySize)

This function completes the sparse matrix to match the size given with the second argument. If the given size is bigger than the size of argSparse, argSparse is increased by adding all zero sparse matrices. If the given size is smaller or equal, no changes are done.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:

argSparse (sparse matrix): The sparse matrix to be completed. mySize (list): 1D array containing the size (column, row) that the sparse matrix (argSparse) has to have at a minimum.

Results:

mySparse (sparse matrix): argSparse padded with all zero sparse matrices.

bmSparseMat_r_nJump2index(r_nJump)

out = bmSparseMat_r_nJump2index(r_nJump)

This function expands the input array into indices based on the number of grid points repeated for each point, using a mex function to efficiently do this in c++.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:

r_nJump (array): Contains for each point the number of points in the second dimension (grid), the number of indices jumped in a flattened array to get to the next point.

Returns:

out (array): Contains a list that repeats r_njJump(index) times the corresponding index in r_nJump for every point / index and is of size sum(r_nJump).

Examples:
out = bmSparseMat_r_nJump2index([3, 1, 0, 2])

out = [1, 1, 1, 2, 4, 4]

out = bmSparseMat_r_nJump2index([0, 0, 0, 10, 0, 10])

out = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]

Notes:

bmSparseMat_r_nJump2index is the inverse operation of histcounts(out, (1:size(r_nJump, 2) + 1) - 0.5)

bmSparseMat_vec_2(s, v, varargin)

mex

bmSparseMat_help_function

bmSparseMat_vec

bmTime

bmTimeInSecond()

bmTraj1

bmTraj_random1_k0(nPt, N_u, dK_u)
bmTraj_random1_non_k0(nPt, N_u, dK_u)
bmTraj_randomPartialCartesian1(N_u, dK_u, perOne)
bmTraj_cartesian1_lineAssym2(varargin)
bmTraj_exp1_lineAssym2(N_u, dK_u, arg_exponent)

bmTraj123

bmTraj_resolution(t)
bmTraj_rescaleToUnitCube(t, N_u, dK_u)
bmTraj_nLine(argTraj)

[nLine, varargout] = bmTraj_nLine(argTraj)

This function counts the number of straight line segments containing three or more points. If two points are “too” far away, they are considered as lying in different segments (see the code). Non-separated points are considered as out of straight segments and they break straight segments.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:

argTraj (array): Trajectory that should be split into lines

Returns:

nLine (int): Number of lines found varargout: {1} : N, the number of points on a line {2} : inN_integer, bool to show if N is an integer (indicates if the trajectory can be converted into lines) {3} : dK_list, the list of the distances between points on each line

bmTraj_squaredNorm(t)

mySquaredNorm = bmTraj_squaredNorm(t)

This function calculates the squared norm (||t||^2) of the given trajectory.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:
t (array): Trajectory of any size of which the squared norm has to be

calculated.

Returns:
squaredNorm (array): Calculated squared norm of the trajectory with the

same size as t.

bmTraj_dK_u(t, varargin)
bmTraj_N_u(t)
bmTraj_lineDirection(t)

e = bmTraj_lineDirection(t)

This function calculates a normalized direction vector for every line

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:

t (array): The trajectory given in lines. It must have the size [imDim, N, nLine], with N being the number of points per line

Returns:

e (array): Contains the normalized directional vector for every line

bmTraj_partialCartesian_ind_u(t, N_u, dK_u)
bmTraj_lineReshape(t, varargin)

[out, varargout] = bmTraj_lineReshape(t, varargin)

This function transforms a trajectory to be defined in lines (if possible)

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:

t (array): The trajectory to be changed varargin{1}: Trajectory to be reshaped in the same way as t (except for the dimension, which is taken from varargin{1})

Returns:

out (array): The changed trajectory varargout{1}: The second trajectory to be changed (if varargin is given)

bmTraj_N_u_dK_u(t, varargin)
bmTraj_norm(t)
bmTraj_formatTraj(argTraj, varargin)

bmTraj2

bmTraj_fullRadial2_lineAssym2(N, nSeg, dK_n)
bmTraj_randomPartialCartesian2_x(N_u, dK_u, myPerOne)
bmTraj_cartesian2_lineAssym2(varargin)
bmTraj_random2_non_k0(nPt, N_u, dK_u)
bmTraj_gaussRandom_linePartialCartesian2_x(N_u, dK_u, nLine, argSigma)
bmTraj_random2_k0(nPt, N_u, dK_u)

bmTraj3

bmTraj_random3_k0(nPt, N_u, dK_u)
bmTraj_UTE_r(N, t0, t_grad_start, t_grad_ramp, dt, dK_n)
bmTraj_cartesian3_lineAssym2(varargin)
bmTraj_centerOutRadial3_phyllotaxis(nseg, nshot, flagSelfNav, r)
bmTraj_random3_non_k0(nPt, N_u, dK_u)
bmTraj_fullRadial3_phyllotaxis_lineAssym2(varargin)

myTraj = bmTraj_fullRadial3_phyllotaxis_lineAssym2(varargin)

This function creates and returns a phyllotaxis trajectory.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

varargin: This input is either an bmMriAcquisitionParam object containing the needed variables or the 6 variables separately: N (int): Number of points on line nSeg (int): Number of segments nShot (int): Number of shots dK_n (double): Distance between points of trajectory (1/FoV) flagSelfNav (bool): First segment of each shot is at the top of the sphere if true nShot_off (int): Number of shots to be discarded

Returns:

myTraj (array): Containing the trajectory in the shape [3, N, M], where M = (nShot - nShot_off) * (nSeg - flagSelfNav)

bmLineList(psi, theta, phi, d, deltaK, dK, N, lineAssym)
bmTraj_fullRadial3_phyllotaxis_chris_lineAssym2(varargin)

myTraj = bmTraj_fullRadial3_phyllotaxis_lineAssym2(varargin)

This function creates and returns a phyllotaxis trajectory.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:

varargin: This input is either an bmMriAcquisitionParam object containing the needed variables or the 6 variables seperatly: N (int): Number of points on line nSeg (int): Number of segments nShot (int): Number of shots dK_n (double): Distance between points of trajectory (1/FoV) flagSelfNav (bool): First segment of each shot is at the top of the sphere if true nShot_off (int): Number of shots to be discarded

Returns:

myTraj (array): Containing the trajectory in the shape [3, N, M], where M = (nShot - nShot_off) * (nSeg - flagSelfNav)

bmPhyllotaxisAngle3(nseg, nshot, varargin)

[theta, phi] = bm3DimPhyllotaxisAngle(nseg, nshot, varargin)

Calculates spherical coordinates for all points (nseg * nshot) of the phyllotaxis spiral. This spiral covers the north hemisphere only. The radius r is constant and not defined by this function.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

This fucntion was written based on the code of

Davide Piccini

More information can be found in

“Spiral phyllotaxis: the natural way to construct a 3D radial trajectory in MRI”, MRM 2011.

Parameters:

nseg (int): Number of segments per shot nshot (int): Number of shots of the acquisition varargin (bool, optional): Flag if the first segment acquired is the same for all shots (self navigation). Default value is 0.

Returns:

theta (array): List containing the polar angle for every point of the spiral phi (array): List containing the azimuthal angle for every point of the spiral

bmTraj_randomPartialCartesian3_x(N_u, dK_u, myPerOne)

bmTrajN

bmTraj(mriAcquisition_node)

bmTwix

bmTwix_getFirstProjOfShot(argFile)
bmTwix_data(myTwix, myMriAcquisition_node)

y_raw = bmTwix_data(myTwix, myMriAcquisition_node)

Returns raw MRI data from a Twix object based on acquisition parameters.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation) MattechLab 2024

Parameters:

myTwix (struct): Struct containing Twix MRI data. myMriAcquisition_node (struct): Struct containing acquisition parameters.

Returns:

y_raw (array): Raw MRI data in the [nCh, N, nLine] shape, where nLine is nShot * nSeg, which can change depending on the selfNav_flag and nShot_off in myMriAcquisition_node.

Notes:

This function reshapes and processes the raw data based on the acquisition parameters such as the number of segments, shots, channels, and echoes. It also handles optional flags for self navigation and ROOSK.

Example:

y_raw = bmTwix_data(myTwix, myMriAcquisition_node);

bmTwix(argFile)

myTwix = bmTwix(argFile)

Extracts the Twix object as a struct from a Siemens raw data file

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:

argFile (char): A string with the path to the data file

Returns:

myTwix (struct): A struct containing the extracted Twix object

bmTwix_info(myArg)

bmTwix_info(myArg)

Prints information included in the Siemens’ raw data file’s Twix object used in the reconstruction process of the image.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:
myArg (struct/char): Either the path to the Siemens’ raw data file or

a Twix object

bmTwix_getCenterOfLine(argFile)

bmVarargin

bmVarargin_rLineMask(inMask, nLine)
bmVarargin_false(varargin)
bmVarargin_oLineMask(inMask, nLine)
bmVarargin(varargin)

varargout = bmVarargin(varargin)

This function is returning given optional arguments and returning empty arrays [] for missing optional paramters. This is a custom way to handle default valued, variable size input parameters.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation & Comments) MattechLab 2024

Parameters:
varargin (cell array): Contains any kind of arguments which are to

be distributed to the given outputs. Can be empty

Returns:
varargout (cell array): Contains Any kind of variables to be filled

with values from varargin or to be initialized with an empty vector.

Examples:

argSize = bmVarargin(varargin); [var1, var2, var3] = bmVarargin(varargin); var1 = bmVarargin();

bmVarargin_sparseType(sparseType)

out = bmVarargin_sparseType(sparseType)

This function returns the default sparse type if sparseType is empty.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters;

sparseType (char): Char containing the sparse type, default value is ‘bmSparseMat’.

Returns:

out (char): Contains given sparse type or default value if empty.

bmVarargin_kernelType_nWin_kernelParam(varargin)

function [kernelType, nWin, kernelParam] = bmVarargin_kernelType_nWin_kernelParam(varargin)

This function sets default values for kernelType, nWin and kernelParam and checks if given values are valid.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Parameters:

varargin{1}: Char containing the kernel type. Default value is ‘gauss’. varargin{2}: Integer containing the window width. Default value is 3 for ‘gauss’ and ‘kaiser’. varargin{3}: List containing the kernel parameter. Default value is [0.61, 10] for ‘gauss’ and [1.95, 10, 10] for ‘kaiser’.

Returns:

kernelType (char): Kernel type given or default value. Empty if error. nWin (int): Window width given or default value. Empty if error. kernelParam: Kernel parameter given or default value. Empty if error.

bmVarargin_N_u_dK_u(t, varargin)
bmVarargin_true(varargin)
bmVarargin_RMS_flag(myRMS_flag)
bmVarargin_eLineMask(inMask, nLine)
bmVarargin_empty()
bmVarargin_cLineMask(inMask, nLine)

ISMRMRD

ISMRMRD_readParam(argFile, autoFlag)

varargout = ISMRMRD_readParam(argFile, automaticFlag)

This function extracts the meta data from the ISMRM raw data file. Allows for user modification of the meta data if the flag is set to true. The code execution is interrupted during the modification.

Authors:

Dominik Helbing MattechLab 2024

Parameters:

argFile (Char): The path to the file. autoFlag (Logical): Flag; Does allow user modification if false. Simplifies use if true.

Returns:

varargout{1}: bmMriAcquisitionParam object containing the extracted meta data. varargout{2}: Double containing the extracted reconstruction FoV.

bmISMRMRD_data(myData, myMriAcquisition_node)

y_raw = bmISMRMRD_data(myData, myMriAcquisition_node)

This function returns the raw MRI data from ISMRMRD file /dataset/data struct based on acquisition parameters.

Authors:

Bastien Milani CHUV and UNIL Lausanne - Switzerland May 2023

Contributors:

Dominik Helbing (Documentation)

Parameters:

myData (struct): Struct containing MRI data in ISMRMRD style. myMriAcquisition_node (struct): Struct containing acquisition parameters.

Returns:
y_raw (array): Raw MRI data in the [nCh, N, nLine] shape, where nLine

is nShot * nSeg, which can change depending on the selfNav_flag and nShot_off in myMriAcquisition_node. Given in single precision.

Notes:

This function reshapes and processes the raw data based on the acquisition parameters such as the number of segments, shots, channels, and echoes. It also handles optional flags for self navigation and ROOSK.

Example:

y_raw = bmISMRMRD_data(myData, myMriAcquisition_node);

checkMetadataInteractive(mySI, s_mean, s_center_mass, myMriAcquisition_node, reconFoV)
[myMriAcquisition_node, reconFoV] = ISMRMRD_info(mySI, s_mean,

s_center_mass, myMriAcquisition_node, reconFoV)

This function plots the magnitude spectrum which shows at which shot the steady state is reached. It also opens an interactive figure showing the extracted metadata that will be used, and allowing modifications. This function should only be called when the automatic flag is set to true and will interrupt code execution.

Authors:

Dominik Helbing MattechLab 2024

Parameters:

mySI (array): The SI magnitude calculated for every shot. s_mean (list): The mean of mySI calculated for every shot. s_center_mass (list): The center of mass of mySI calculated for every shot. myMriAcquisition_node (bmMriAcquisitionParam): The extracted meta data. reconFoV (int): The extracted reconstruction FoV.

Returns:
myMriAcquisition_node (bmMriAcquisitionParam): The extracted meta data,

possibly modified by the user.

reconFoV (int): The extracted reconstruction FoV, possibly modified by

the user.

rawDataReader

class mleRawDataReader

The idea behind the RawData reader is that it acts as an intermediary with a clear interface between rawData and the rest of the code. This is necessary to abstract away the file format (Siemens, ismrmRD, etc.) from the rest of the code. For each file format a subclass is defined. To initialize a reader you need to use the createRawDataReader() that acts as a Factory Pattern to initiate the correct subclass based on the raw data file extension. Refer to createRawDataReader() for usage examples. Author: Mauro Leidi

Constructor Summary
mleRawDataReader(filepath, autoFlag)
Property Summary
acquisitionParams

Stores the result of _ReadParam

argFile

Filepath to the raw data

autoFlag

Whether manual interaction is allowed or not

Method Summary
readMetaData()
readRawData(flagSS, flagNoSI)
createRawDataReader(filepath, autoFlag)

Factory patterns for RawDataReader. Example usage: myreader = createRawDataReader(‘my/path/to/file.ext’, false) metadata = myreader.ReadMetaData() to get metadata y = myreader.mleReadRawData() to get the rawdata Supported file formats: Siemens (.dat), ISMRMRD (.mrd). Author: Mauro Leidi Extract file extension

ismrmrd

dhIsmrmrdReadMetaData(obj)

varargout = dhIsmrmrdReadMetaData(obj)

This function extracts the meta data from the ISMRM raw data file. Allows for user modification of the meta data if the flag is set to true. The code execution is interrupted during the modification.

Authors:

Dominik Helbing adapted by: Mauro Leidi MattechLab 2024

Parameters:

obj (mleIsmrmrdReader) the reader object to handle ismrmrd files.

Returns:

varargout{1}: bmMriAcquisitionParam object containing the extracted meta data. varargout{2}: Double containing the extracted reconstruction FoV.

class mleIsmrmrdReader

Bases: mleRawDataReader

Overload of the RawDataReader for ISMRMRD raw data files. NB: createRawDataReader() acts as a Factory Pattern to initiate the correct subclass. Never instanciate readerclasses in other ways. Author: Mauro Leidi

Constructor Summary
mleIsmrmrdReader(filepath, autoFlag)
Method Summary
readMetaData()
readRawData(flagSS, flagExcludeSI)

Handle default values for optional arguments: if no argument is passed there is no data filtering.

dhIsmrmrdReadRawData(obj, flagSS, flagExcludeSI)

varargout = dhIsmrmrdReadRawData(obj)

This function extracts the raw data from the ISMRM raw data file. Optional filtering is enabled with the flags: flagSS: filter out the non steady state shots (obj.acquisitionParams.nShot_off) flagExcludeSI: filter out the SI projections

Authors:

Dominik Helbing adapted by: Mauro Leidi MattechLab 2024

Parameters:

obj (mleIsmrmrdReader): The object that to handle radata. flagSS (Logical): Flag; Filter out non steady state shots if true. flagExcludeSI (Logical): Flag; Filter out SI projections if true.

Returns:

readouts: the extracted raw data in [nCh, N, nSeg*nShot] format.

siemens

class mleSiemensReader

Bases: mleRawDataReader

Overload of the RawDataReader for Siemens raw data files. NB: createRawDataReader() acts as a Factory Pattern to initiate the correct subclass. Never instanciate readerclasses in other ways. Author: Mauro Leidi

Constructor Summary
mleSiemensReader(filepath, autoFlag)
Method Summary
readMetaData()
readRawData(flagSS, flagExcludeSI)

Handle default values for optional arguments: if no argument is passed there is no data filtering.

bmSiemensReadRawData(obj, flagSS, flagExcludeSI)

varargout = bmSiemensReadRawData(obj)

This function extracts the raw data from the ISMRM raw data file. Optional filtering is enabled with the flags: flagSS: filter out the non steady state shots (obj.acquisitionParams.nShot_off) flagExcludeSI: filter out the SI projections

Authors:

Bastien Milani adapted by: Mauro Leidi MattechLab 2024

Parameters:

obj (mleSiemensReader): The object that to handle radata. flagSS (Logical): Flag; Filter out non steady state shots if true. flagExcludeSI (Logical): Flag; Filter out SI projections if true.

Returns:

readouts: the extracted raw data in [nCh, N, nSeg*nShot] format.

dhSiemensReadMetaData(obj)

varargout = dhSiemensReadMetaData(obj)

This function extracts the meta data from the ISMRM raw data file. Allows for user modification of the meta data if the flag is set to true. The code execution is interrupted during the modification.

Authors:

Dominik Helbing adapted by: Mauro Leidi MattechLab 2024

Parameters:

argFile (Char): The path to the file. autoFlag (Logical): Flag; Does allow user modification if false. Simplifies use if true.

Returns:

varargout{1}: bmMriAcquisitionParam object containing the extracted meta data. varargout{2}: Double containing the extracted reconstruction FoV.