Package: cvasl
cvaslis an open source collaborative python library for analysis
of brain MRIs. Many functions relate to arterial spin labeled sequences.This library
supports the ongoing research at University of Amsterdam Medical Center on brain ageing, but
is being buit for the entire community of radiology researchers across all university and academic medical centers and beyond.Program filesThe main program in this repository (made of the modules in the cvasl folder) contains functions for analysis of MRIs.Folders and NotebooksTo look around keep in mind the following distinction on folders:researcher_interface:This folder will be added in the future for
a growing series of interactive notebooks that allow
researchers to investigate questions about their own MRI dataopen_work:This folder contains experimental work by core members of the cvasl
team (including Dr. Candace Makeda Moore, Dr. Dani Bodor, Dr. Henk Mutsaerts)harmonization_paper:This folder contains experimental work for a forthcoming paper by core members of the cvasl
team (including Dr. Candace Makeda Moore, Dr. Dani Bodor, Dr. Henk Mutsaerts,
and Mathijs Dijsselhof) which deals with radiological image harmonization.lab_datasets:This folder contains notebooks which show how image datasets were assembled in notebooks.Please keep in mind that at present you will only be able to scroll images
in the notebooks with a browser based approach i.e. run Jupyter in a browser but
not in VSCode or another IDE to scroll the brain MRIs.Data setsThe notebooks are configured to run on various datasets.  Contact
Dr. Candace Makeda Moore( 📫c.moore@esciencecenter.nl) to discuss any
questions on data configuration for your datasets. In terms of
derived value datasets (which use measurements instead of images)
You will need tsv and/or csv file
datasets arranged in a particular format as specified inseperated_values_specifications.mdConfiguring (to work with your data)In order to preprocess and/or to train  models the code needs to be
able to locate the raw data you want it to work with.There are several ways to specify the location of the following
directories:bids:Special directory.  The rest of the directory layout can
be derived from its location.You can store this information persistently in several locations.In the same directory where you run the script (or the notebook).
e.g../config.json.In home directory, e.g.~/.cvasl/config.json.In global directory, e.g./etc/cvasl/config.json.However, we highly recommend you use the home directory.
This file can have this or similar contents:{

    "bids": "/mnt/source_data",
    "raw_data": "/mnt/source_data/raw_data",
    "derivatives": "/mnt/source_data/derivates/",
    "explore_asl": "/mnt/source_data/derivates/explore_asl",
    "cvage": "/mnt/source_data/derivates/cvage",
    "cvage_inputs": "/mnt/source_data/derivates/cvage/cvage_inputs",
    "cvage_outputs": "/mnt/source_data/derivates/cvage/cvage_outputs",

}The file is read as follows: if the file only specifiesbidsdirectory, then the derivative missing entries are assumed to be
relative to the root in a BIDS compliant format order You don't need
to specify all entries.  If you do, you can overwrite the ALS-BIDS
format order but this is not reccomended.When working from command line, it may be useful to experiment with
different directory layouts or to quickly override the existing
options.  To do so, you can invoke the program like this:python-mcvasl-Craw_data:/path/to/data<otheroptions>The snippet above allows using existingconfig.jsonbut overrides
the location ofraw_datadirectory.python-mcvasl-Cbids:/path/to/data-n<otheroptions>The snippet above ignores any existingconfig.jsonfiles and sets
the BIDS directory to/path/to/data(the rest will be derived from
it).python-mcvasl\-Craw_data:/path/to/data\-Cderivatives:/path/to/derivatives\-c/custom/config/location\<otheroptions>The snippet above looks for configuration file in the alternative
location:/custom/config/locationwhile overriding the locations ofraw_dataaand ofderivativesdirectories.If you aren't sure where the data would be read or stored, you can run:python-mcvasl<someoptions>dump_configThe above will print the effective configuration that will be used by
the program.Test dataYou can get test data by contacting the cvage team. Please email Dr. Moore atc.moore@esciencecenter.nlGetting startedHow to get the notebooks running?  Assuming the raw data set and
metadata is available.Assuming you are using conda for package management:Make sure you are in no environment:condadeactivate(optional repeat if you are in the base environment)You should be in no environment or the base environment nowOption A: Fastest option:
In a base-like environment with mamba installed, you can install all Python packages required, usingmambaand theenvironment.ymlfile.If you do not have mamba installed you can follow instructions (here)[https://anaconda.org/conda-forge/mamba]The command for Windows/Anaconda/Mamba users can be something like:mambaenvcreate-fenvironment.ymlOption B: To work with the most current versions with the possibility for development:
Install all Python packages required, usingcondaand theenvironment.ymlfile.The command for Windows/Anaconda users can be something like:condaenvcreate-fenvironment.ymlCurrently, you will then need to clone the repository to run the cvasl from repo.
We will soon have an option to create the entire environment at once from conda.Option C:
* Linux users can create their own environment by hand (use
  install_dev as in setup).If you want to work with command-line, you can do so in your terminal, but
if you would like to run our pre-made notebooks, then you can start them by enteringjupyter labinto the terminalDocumentation:You can look at ouronline documentationor build it by hand
(see the setup file, the workflows, and it may be clear)TestingThe project doesn't include testing data yet.Command-Line InterfaceYou will eventually be be able to preprocess, train and use models, and perform other functions using command-line interface. As of now (April 2023) this module is still being built.Below is an example of how to look at the help for that in general:python -m cvasl --helpAnd here is an example for a specific function:python -m cvasl hash_over --helpAnd here are examples of a working commands (file names can be changed):
to hash over files (assuming no config file):python -m cvasl -n -C raw_data:test_data hash_over --extension tsv --output some_ignored_folderto run a debiasing algorithm over files:python -m cvasl -n -C raw_data:image_data debias_over --preprocessing N4_debias_sitk --output ignrd_flderto recode sex on csv files in a folder:python -m cvasl -n sex_recode_over -i folder_w_files_to_be_recodedto log columns 'gm_vol' and 'wm_vol' in csvs in a folder:python -m cvasl -n log_recode_over -i loged1 -l gm_vol -l wm_volAll long options have short aliases.✨Copyright 2023 Netherlands eScience Center and U. Amsterdam Medical Center
Licensed under  See LICENSE for details.✨