VMreadnifti

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Import/Export
Introduced first in SolidGeometry 4.8, Creation date: 2019-12-03, Last change: 2025-09-14

reads in a nifty volumentric file

Description

a nifty file is an already segmented file consisting of 0 and 1
with additonal parameter similar to a standard dicom file

See Also: VMreaddicom , VMreaddicomdir

Example Illustration

 missing image of VMreadnifti(fname)

Syntax

[VM,vs]=VMreadnifti([fname])

Input Parameter

fname: filename

Output Parameter

VM: Voxel Model
vs: voxel size

Examples


VMreadnifti()




Copyright 2019-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

The function `VMreadnifti` is designed to read a NIfTI volumetric file, which is a type of medical imaging file format. The function outputs a voxel model and the voxel size. Below is a detailed explanation of the algorithm and its parameters: **Input Parameters:** - `fname`: This is the filename of the NIfTI file to be read. It is an optional parameter and can be provided as an argument to the function. **Output Results:** - `VM`: This is the Voxel Model, which represents the 3D structure of the data in the NIfTI file. - `vs`: This is the voxel size, which indicates the dimensions of each voxel in the model. **Algorithm Steps:** 1. **Filename Handling:** - The function starts by setting a default filename using `getfuncparams(1,varargin,'')`. This function retrieves the first argument from `varargin` or sets it to an empty string if not provided. - It then attempts to get a file using `tryuigetfile(fname,'*.nii')`, which opens a file dialog if `fname` is not specified or invalid, allowing the user to select a `.nii` file. 2. **NIfTI File Information:** - The function retrieves metadata from the NIfTI file using `niftiinfo(fname)`. This includes information such as pixel dimensions, which is stored in `vs`. 3. **Reading the NIfTI File:** - The actual voxel data is read from the file using `niftiread(fname)`, and this data is stored in `VM`. 4. **Output Handling:** - If no output arguments are specified (`nargout==0`), the function proceeds to visualize the data: - It prints a command to the console for re-executing the function with the current filename. - It processes the voxel data to create a surface model using `SGofVMisosurface(smooth3(VM>0 Algorithm explaination created using ChatGPT on 2025-08-19 00:06. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21