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 ¶
Create a top-level README in project_dir. Returns True when it wrote one.
Source code in tit/project_init/initializer.py
initialize_dataset_description ¶
Write a BIDS dataset_description.json at the project root.
Returns True when it wrote one, False when the file was already there.
Source code in tit/project_init/initializer.py
initialize_derivative_dataset_description ¶
Write a BIDS derivative dataset_description.json for derivative_name.
Returns True when it wrote one, False when the file was already there.
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 ¶
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.
Returns True when it wrote the file.
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 project_dir.
Idempotent, and honest about it: the "New project detected" banner and the per-item
✓ … created lines are printed only for work this call actually did. An established
project -- one :func:has_project_data_or_markers recognises -- gets a single
Project structure verified line, because that is all that happened. (Before
2026-09-15 the banner and every ✓ printed unconditionally, so asking an established
project for anything that re-ran this looked like it was being re-initialised.)
Parameters¶
project_dir : Path Root directory of the project.