Skip to content

This code is used to optimize single or multiple shell uniform sampling schemes in diffusion MRI via continuous optimization and discrete optimization.

License

Notifications You must be signed in to change notification settings

DiffusionMRITool/spherical_uniform_sampling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

This code is used to optimize single or multiple shell uniform sampling schemes in diffusion MRI via continuous optimization and discrete optimization.

  • Continuous optimization: generate a single or multiple shell uniform sampling scheme in the continuous sphere $\mathbb{S}^2$ with the antipodal symmetry constraint.
  • Discrete optimization includes:
    • Polarity optimization (P-P) : optimize the polarity of an existing single or multiple shell sampling scheme by flipping some samples, such that the flipped scheme is uniform in the sphere without the antipodal symmetry constraint. It is useful for reducing eddy current in dMRI.
    • Ordering optimization (P-O): optimize the ordering of an existing single or multiple shell sampling scheme, such that every partial scanned sample set is nearly uniform.
    • Uniform subsampling optimization: extract a subsampling subset from an existing single or multiple shell sampling scheme, such that the subsampled single or multiple shell scheme is nearly uniform.

Install

  1. Clone this repository
git clone https://github.com/DiffusionMRITool/spherical_uniform_sampling.git
  1. Install dependencies
pip install -r requirements.txt

Note that you will need to acquire a license to use GUROBI for solving discrete problems here. For more information, please see:

  1. Install package
pip install .

Quick-start tutorial

You can check CLI program with option -h for help message.

Generate a single shell sampling scheme

For an example of generating a single shell uniform sampling, we will first generate a scheme with 30 points using continuous optimization and then apply polarity optimization and order optimization to it.

This can be done by simply invoke:

direction_generation.py --output grad_flipped_ordered.txt -n 30

Alternately, it is equivalent to following step-by-step instructions.

  1. Generate a sampling scheme via continuous optimization.
direction_continous_optimization.py --output grad.txt -n 30
  1. Optimize the polarity of the resulting scheme.
direction_flip.py --input grad.txt --output grad_flipped.txt
  1. Optimize the ordering of the resulting scheme
direction_order.py grad_flipped.txt --output grad_flipped_ordered.txt

You can check grad_flipped_ordered.txt for the final result.

Generate a multiple shell sampling scheme

For an example of a multiple shell sampling pipeline, we will first generate a scheme with $30\times 3$ points using continuous optimization and then apply polarity optimization and order optimization to it.

This can be done by simply invoke:

direction_generation.py --output grad_flipped_ordered.txt -n 30,30,30 --bval 1000,2000,3000

Alternately, it is equivalent to following step-by-step instructions

  1. Generate a multiple shell sampling scheme
direction_continous_optimization.py --output grad.txt -n 30,30,30
  1. Optimize the polarity of the resulting schemes
direction_flip.py --input grad_shell0.txt,grad_shell1.txt,grad_shell2.txt --output grad_flipped.txt 
  1. Optimize the polarity of the resulting schemes We need to concatenate 3 shells to make a bvec file.
combine_bvec_bval.py grad_flipped_shell0.txt,grad_flipped_shell1.txt,grad_flipped_shell2.txt 1000,2000,3000 --output grad_combine.txt

Finally we run our ordering script.

direction_order.py grad_combine_bvec.txt grad_combine_bval.txt --output grad_flipped_ordered.txt

Subsample example

Single subset from single set problem (P-D-SS): if you already have a single shell sampling scheme grad.txt (or you may generate one using methods above), you can uniformly extract a single subset of points from it.

direction_subsample.py --input grad.txt --output grad_subsample.txt -n 30

Multiple subsets from single set problem (P-D-MS): you can uniformly extract multiple subsets of points from a single shell scheme.

direction_subsample.py --input grad.txt --output grad_subsample.txt -n 10,10,10

Multiple subsets from multiple sets problem (P-D-MM): given a multiple shell sampling scheme, e.g. the HCP scheme, you can uniformly extract multiple subsets of points from it.

direction_subsample.py --input grad_b1000.txt,grad_b2000.txt,grad_b3000.txt --output grad_subsample.txt -n 30,30,30

License

This project is licensed under the LICENSE.

About

This code is used to optimize single or multiple shell uniform sampling schemes in diffusion MRI via continuous optimization and discrete optimization.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages