resomapper.core.utils

Functions

select_directory()

Allows selection of root directory showing a file explorer window.

select_file()

Allows selection of a file showing a file explorer window.

select_modalities_to_process()

Select from a checklist those modalities to be processed.

close_window(root)

ask_user_parameters(parameter_dict)

Select values for different parameters in an emergent window. If a new value is

ask_user(question)

Prompts the user with a question and expects a 'y' or 'n' answer.

ask_user_options(question, options)

Prompt a question to the user, display options with meanings,

is_folder_and_not_occult(path)

is_folder_or_zip_and_not_occult(path)

is_nii(filename)

get_modality_nii_acq(nii_file)

get_modality_nii_map(nii_file)

get_acq(filename)

get_nifti_filenames(sourcedata_dir, study, acq)

rename_associated_files(nifti_filename)

create_readme(output_dir)

Module Contents

resomapper.core.utils.select_directory()[source]

Allows selection of root directory showing a file explorer window.

Returns:

full path to the selected directory.

Return type:

Path

resomapper.core.utils.select_file()[source]

Allows selection of a file showing a file explorer window.

Returns:

full path to the selected file.

Return type:

Path

resomapper.core.utils.select_modalities_to_process()[source]

Select from a checklist those modalities to be processed.

Returns:

list of str with the selected modalities.

Return type:

list

resomapper.core.utils.close_window(root)[source]
resomapper.core.utils.ask_user_parameters(parameter_dict)[source]

Select values for different parameters in an emergent window. If a new value is selected it has to be of the same class as the predetermined value.

Parameters:

parameter_dict (dict) – Dictionary containing the name of the different parameters as keys, along with a list containing the predetermined value for each one and a brief description.

Returns:

Dictionary containing the selected values for each parameter name.

Return type:

dict

resomapper.core.utils.ask_user(question)[source]

Prompts the user with a question and expects a ‘y’ or ‘n’ answer.

Parameters:

question (str) – The question to be displayed to the user.

Returns:

True if the user answers ‘y’, False if the user answers ‘n’.

Return type:

bool

resomapper.core.utils.ask_user_options(question, options)[source]

Prompt a question to the user, display options with meanings, and return the selected option.

Parameters:
  • question (str) – The question to ask the user.

  • options (dict) – A dictionary containing the available options as keys and their meanings as values.

Returns:

The selected option.

Return type:

str

resomapper.core.utils.is_folder_and_not_occult(path)[source]
resomapper.core.utils.is_folder_or_zip_and_not_occult(path)[source]
resomapper.core.utils.is_nii(filename)[source]
resomapper.core.utils.get_modality_nii_acq(nii_file)[source]
resomapper.core.utils.get_modality_nii_map(nii_file)[source]
resomapper.core.utils.get_acq(filename)[source]
resomapper.core.utils.get_nifti_filenames(sourcedata_dir, study, acq)[source]
resomapper.core.utils.rename_associated_files(nifti_filename)[source]
resomapper.core.utils.create_readme(output_dir)[source]