Skip to content

Commit

Permalink
fixing mid sagittal
Browse files Browse the repository at this point in the history
  • Loading branch information
muschellij2 committed Feb 6, 2025
1 parent 0c21621 commit 132194e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
19 changes: 9 additions & 10 deletions R/mid_sagittal_align.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ mid_sagittal_align = function(
flipped = flip_lr(img)

omat = tempfile(fileext = ".mat")
tfile = tempfile(fileext = ".nii.gz")
flirt(infile = img,
reffile = flipped,
omat = omat, dof = 6,
omat = omat,
dof = 6,
opts = opts,
retimg = FALSE,
outfile = tfile,
outfile = outfile,
verbose = verbose)

parsed = fsl_avscale(file = omat, parsed = TRUE)
Expand All @@ -84,14 +84,14 @@ mid_sagittal_align = function(
initmat = new_omat,
verbose = verbose,
retimg = FALSE,
outfile = tfile)
outfile = outfile)
if (force_rpi) {
centered = reverse_rpi_orient_file(
file = tfile,
file = outfile,
orientation = rp$orientation,
convention = rp$convention)
} else {
centered = tfile
centered = outfile
}
if (retimg) {
centered = readnii(centered)
Expand Down Expand Up @@ -132,22 +132,21 @@ apply_mid_sagittal_align = function(

flipped = flip_lr(img)

tfile = tempfile(fileext = ".nii.gz")
flirt_apply(
infile = img,
reffile = flipped,
initmat = file_mat,
verbose = verbose,
opts = apply_opts,
retimg = FALSE,
outfile = tfile)
outfile = outfile)
if (force_rpi) {
centered = reverse_rpi_orient_file(
file = tfile,
file = outfile,
orientation = rp$orientation,
convention = rp$convention)
} else {
centered = tfile
centered = outfile
}
if (retimg) {
centered = readnii(centered)
Expand Down
2 changes: 1 addition & 1 deletion man/mid_sagittal_align.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 132194e

Please sign in to comment.