initializer
tit.project_init.initializer ¶
BIDS-compliant project structure initializer.
Creates directory scaffolding, dataset description files, README, and project status metadata for a new TI-Toolbox project.
This module is the single source of truth for project_status.json.
All other modules must use :func:load_project_status and
:func:update_project_status rather than reading/writing the file directly.
has_project_data_or_markers ¶
Return True if project_dir contains any project data or marker files.
Parameters¶
project_dir : Path Root directory of the project.
Returns¶
bool
True when initialization markers, subject folders, source data,
derivatives, or loose NIfTI files are detected.
Source code in tit/project_init/initializer.py
is_new_project ¶
Return True if project_dir exists and contains no project data.
Parameters¶
project_dir : Path Root directory of the project.
Returns¶
bool
True when the directory is empty of project data and markers.
Source code in tit/project_init/initializer.py
initialize_readme ¶
initialize_readme(project_dir: Path) -> None
Create a top-level README in project_dir if it does not exist.
Source code in tit/project_init/initializer.py
initialize_dataset_description ¶
initialize_dataset_description(project_dir: Path) -> None
Write a BIDS dataset_description.json at the project root.
Source code in tit/project_init/initializer.py
initialize_derivative_dataset_description ¶
Write a BIDS derivative dataset_description.json for derivative_name.
Source code in tit/project_init/initializer.py
load_project_status ¶
Read project_status.json and return its contents.
Returns an empty dict when the file is missing or unreadable. This function never writes to disk.
Parameters¶
project_dir : Path Root directory of the project.
Source code in tit/project_init/initializer.py
update_project_status ¶
Merge updates into project_status.json and write back.
Performs a recursive (deep) merge so that nested keys such as
user_preferences.show_welcome can be updated without clobbering
sibling keys. Automatically sets last_updated.
If the file does not yet exist a warning is logged and the function
returns False — the file should have been created by
:func:initialize_project_status.
Parameters¶
project_dir : Path Root directory of the project. updates : dict Fields to merge into the existing status.
Returns¶
bool
True on success.
Source code in tit/project_init/initializer.py
initialize_project_status ¶
initialize_project_status(project_dir: Path) -> None
Create project_status.json only if it does not already exist.
This is the sole place in the codebase that creates the file.
Subsequent mutations must go through :func:update_project_status.
Source code in tit/project_init/initializer.py
initialize_project_structure ¶
initialize_project_structure(project_dir: Path) -> None
Scaffold a full BIDS-compliant directory structure for a new project.
Parameters¶
project_dir : Path Root directory of the new project. Directories, metadata files, README, and an initialization marker are created idempotently.
Source code in tit/project_init/initializer.py
setup_example_data ¶
Copy bundled example data into project_dir.
Parameters¶
toolbox_root : Path Root of the TI-Toolbox installation (contains example data). project_dir : Path Target project directory.
Returns¶
bool
True on success, False on failure.