Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Synb0-DISCO for TOPUP and eddy #38

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Use Synb0-DISCO for TOPUP and eddy #38

wants to merge 8 commits into from

Conversation

tombresser
Copy link
Member

Modification:
If acqpFile exists and has the required dimensions, it can directly be used in the preprocessing steps.
Otherwise acqpFile is created according to the original code.

Problem:
Some Topup cases require a specific acqpFile. Tool such as SynB0-DISCO can synthesize a b0 image for diffusion distortion correction. When running Topup, the acqpFile should contain two rows in the same direction (see example below).
CATO currently auto generates an acqpFile and overwrites existing files in the location.

$ cat acqparams.txt 
0 1 0 0.062
0 1 0 0.000

Only generate the acqpFile if it does not exists.
If cqpFile exists, read the file and check if it has the required 4 columns.
@koenhelwegen koenhelwegen self-assigned this Feb 16, 2024
Issue:
Default topup_eddy script used a combined dwi file (including the reverse encoded b0). Because the undistorted b0 from synb0 is not a 'reverse encoded' scan, this caused an error when running eddy.

Solution
This preprocessing script
- expects the synb0-DISCO output usually b0_all (fslmerge -t b0_all.nii.gz b0_d_smooth.nii.gz b0_u.nii.gz)
- expects correct index and acqp file
- does NOT use the synb0 file in the eddy step (as recommended by synb0-DISCO)
- the 'extract b0-scans' step was removed as the synb0File already contains the b0 files.
Issue
Trying to incorporate synb0-DISCO in the CATO workflow it was not compatible. When setting the reverseB0Scan to the synb0 disco, it caused errors due to autogenerated index and acqp, and merging of dwi files.

Solution
A new preprocessing script was added. Structural_preprocessing.m now recognizes the synb0File setting in configParams. When detected the following steps are taken:
- check dimensions of input data, these should be even due to topup config
- uses indexFile and acqpFile as INPUT. The echo time of the synthesized b0 image should be zero
- if indexFile and acqpFile are not located in outputDir a copy is made to keep track of used files.
- errors following checks were added
@tombresser tombresser changed the title Use existing acqpFile Use Synb0-DISCO for TOPUP and eddy Feb 27, 2024
@tombresser
Copy link
Member Author

First commit was insufficient to make CATO compatible with synb0-DISCO undistorted b0 images.

Issue:
CATO expects reverse encoded scans when preparing+running TOPUP and eddy. Synb0-DISCO is a toolbox to estimate undistorted b0 images based on the distorted b0 and a T1 scan. The distorted+undistorted b0 images can be used to run TOPUP and eddy to correct for distortions. However, the undistorted image is not a reverse encoded scan. Hence it is important to provide an acqp.txt with the correct directions and totalreadout times.

Modifications:

  • synb0File prameter added to configFile
  • preprocess_topup_eddy_synb0.sh added
    • uses synb0Fila to run TOPUP
    • runs eddy on the original dwi file (does not contain the undistorted b0)
  • Added "Case 4: SynB0-DISCO output is available.." to structural_preprocessing.m
    • reads acqpFile and indexFile when synb0File is present
    • basic checks + error messages
    • store copy of acqp and index in CATO output dir
    • checks if dwiFile and synb0File have even dimensions (required for TOPUP)
  • added synb0File to structuralParameterProperties.xlsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants