falconz package
Submodules
falconz.constants module
This module contains the constants that are used in the falconz.
The variables in this module can be imported and used in other modules within the falconz.
falconz.display module
This module shows predefined display messages for the falconz.
- Usage:
The functions in this module can be imported and used in other modules within the falconz to show predefined display messages.
- falconz.display.default_parameters(input_args)[source][source]
Display default parameters for FALCON.
- Parameters:
input_args (argparse.Namespace) – Input arguments for FALCON.
- Returns:
None
- falconz.display.derived_parameters(input_args)[source][source]
Display derived parameters for FALCON.
- Parameters:
input_args (argparse.Namespace) – Input arguments for FALCON.
- Returns:
None
falconz.download module
Note
Research Group: Quantitative Imaging and Medical Physics (QIMP) Team
Version: 0.1.0
Date: 04.07.2023
Usage
The functions in this module can be imported and used in other modules within the falconz to download the necessary binaries and models for the falconz.
falconz.falconz module
falconz.file_utilities module
This module provides various utilities to handle file operations necessary for the falconz project.
- Usage:
The functions in this module can be imported and used in other modules within the falconz to perform file operations.
- falconz.file_utilities.copy_file(file, destination)[source][source]
Copies a file to the destination directory.
- falconz.file_utilities.copy_files_to_destination(files: list, destination: str)[source][source]
Copies the files inside the list to the destination directory in a parallel fashion.
- falconz.file_utilities.create_directory(directory_path: str)[source][source]
Creates a directory at the specified path.
- Parameters:
directory_path (str) – The path to the directory.
- falconz.file_utilities.get_files(directory_path: str, wildcard: str)[source][source]
Gets the files from the specified directory using the wildcard.
- falconz.file_utilities.get_number_of_possible_jobs(process_memory: int, process_threads: int) int[source][source]
Gets the number of available jobs based on system specifications and process parameters.
- falconz.file_utilities.get_system()[source][source]
Gets the system and architecture information.
- Returns:
A tuple containing the system and architecture information.
- Return type:
- Raises:
ValueError – If the system or architecture is not supported.
- falconz.file_utilities.get_virtual_env_root()[source][source]
Gets the root directory of the virtual environment.
- Returns:
The root directory of the virtual environment.
- Return type:
- falconz.file_utilities.move_file(file, destination)[source][source]
Moves a file to the destination directory.
- falconz.file_utilities.numeric_sort_key(file_path: str) int[source][source]
Extracts the numeric portion from a filename for sorting purposes.
- falconz.file_utilities.organise_files_by_modality(tracer_dirs: list, modalities: list, pumaz_dir) None[source][source]
Organises the files by modality.
- falconz.file_utilities.select_files_by_modality(tracer_dirs: list, modality_tag: str) list[source][source]
Selects the files with the selected modality tag from the tracer directory.
- falconz.file_utilities.set_permissions(file_path, system_type)[source][source]
Set permissions for a file based on the operating system.
- Parameters:
- Returns:
None
- Return type:
None
- Raises:
ValueError if the operating system is not supported.
This function sets permissions for a file based on the operating system. If the operating system is Windows, it uses the icacls command to grant full access to everyone. If the operating system is Linux or Mac, it uses the chmod command to add execute permission for the owner, read permission for the group, and read permission for others. If the operating system is not supported, it raises a ValueError.
- Raises:
ValueError if the operating system is not supported.
- Raises:
subprocess.CalledProcessError if the icacls command fails on Windows.
- Raises:
PermissionError if the chmod command fails on Linux or Mac.
- Raises:
Exception if an unknown error occurs.
- Example:
>>> set_permissions('/path/to/file', 'linux')
falconz.image_conversion module
This module handles image conversion for the falconz.
- Usage:
The functions in this module can be imported and used in other modules within the falconz to perform image conversion.
- class falconz.image_conversion.NiftiConverter(input_directory: str, output_directory: str = None)[source][source]
Bases:
objectA utility for converting various medical image formats in a directory into 3D NIFTI files.
- Attributes:
input_directory (str): Path to the directory containing input images. output_directory (str): Path to the directory where the converted images will be saved.
- dcm2niix(input_path: str, output_dir: str) str[source][source]
Converts DICOM files to NIfTI format using dcm2niix.
- Args:
input_path (str): The path to the input directory. output_dir (str): The path to the output directory.
- Returns:
str: The path to the output directory.
- Raises:
NiftiConverterError: If there’s an error during DICOM to NIFTI conversion.
- falconz.image_conversion.merge3d(nifti_dir: str, wild_card: str, nifti_outfile: str) None[source][source]
Merge 3D NIFTI files into a 4D NIFTI file using nibabel :param nifti_dir: Directory containing the 3D NIFTI files :param wild_card: Wildcard to use to find the 3D NIFTI files :param nifti_outfile: User-defined output file name for the 4D NIFTI file
falconz.image_processing module
falconz.input_validation module
This module handles input validation for the falconz.
- Usage:
The functions in this module can be imported and used in other modules within the falconz to perform image conversion.
falconz.resources module
This module contains the urls and filenames of the binaries that are required for the falconz.
- Usage:
The variables in this module can be imported and used in other modules within the falconz to download the necessary binaries for the falconz.