omni.interfaces.common#
Functions
|
Appends a suffix to a given filename. |
|
Creates FOV masks for reference/source images. |
|
Gets prefix but leaves in the path. |
|
A convenient function for getting the filename without extension. |
|
Normalize an array. |
|
Changes the directory of a given filename. |
|
Replaces the last suffix in the given filename. |
|
Runs an outside terminal process. |
- omni.interfaces.common.append_suffix(filename: str, suffix: str) str [source]#
Appends a suffix to a given filename.
- Parameters:
- filename: str
Name of file to get the prefix and path.
- suffix: str
Suffix to add to filename
- Returns:
- str
Name of file with suffix
- omni.interfaces.common.create_fov_masks(ref_img: str, source_img: str, affine: str, ref_mask_path: Optional[str] = None, source_mask_path: Optional[str] = None)[source]#
Creates FOV masks for reference/source images.
This function generates FOV masks, defining the extents of the reference and source images provided.
- Parameters:
- ref_img: str
Path to reference image.
- source_img: str
Path to source image.
- affine: str
Affine transform (afni).
- ref_mask_path: str
Path to output reference mask. If None it will create a mask with a random name in the /tmp folder.
- source_mask_path: str
Path to output source mask. If None it will create a mask with a random name in the /tmp folder.
- Returns:
- str
Path to output reference mask.
- str
Path to output source mask.
- omni.interfaces.common.get_path_and_prefix(filename: str) str [source]#
Gets prefix but leaves in the path.
- Parameters:
- filename: str
Name of file to get the prefix and path.
- Returns:
- str
prefix of file with path.
- omni.interfaces.common.get_prefix(filename: str) str [source]#
A convenient function for getting the filename without extension.
- Parameters:
- filename: str
Name of file to get the prefix.
- Returns:
- str
prefix of file.
- omni.interfaces.common.normalize(data: ndarray) ndarray [source]#
Normalize an array.
- Parameters:
- data: np.ndarray
Data to 0/1 normalize.
- Returns:
- np.ndarray
Normalized data.
- omni.interfaces.common.repath(dirname: str, filename: str) str [source]#
Changes the directory of a given filename.
- Parameters:
- dirname: str
Directory name to use.
- filename: str
Filename whose path to change.
- Returns:
- str
Filename with changed path.
- omni.interfaces.common.replace_suffix(filename: str, suffix: str) str [source]#
Replaces the last suffix in the given filename.
- Parameters:
- filename: str
Name of file to get the prefix and path.
- suffix: str
Suffix to replace in the filename
- Returns:
- str
Name of file with new suffix
- omni.interfaces.common.run_process(process_string: str, stdout: bool = True) str [source]#
Runs an outside terminal process.
- Parameters:
- process_string: str
A string containing a valid terminal command to run.
- stdout: bool
Indicates whether the process string should be directed to stdout through the logging module.
- Returns:
- str
The formatted process_string.