-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle sform errors in sMRI files + PSD plot fix + installation instr…
…uctions (#267)
- Loading branch information
Showing
7 changed files
with
74 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
Installation | ||
============ | ||
|
||
First, make sure you have conda (or miniconda) installed: https://docs.conda.io/en/latest. Then oslpy can be installed from source using the following: | ||
We recommend installing OSL within a virtual environment. You can do this with `Anaconda <https://docs.anaconda.com/free/anaconda/install/index.html>`_ (or `miniconda <https://docs.conda.io/projects/miniconda/en/latest/miniconda-install.html>`_). | ||
|
||
:: | ||
git clone https://github.com/OHBA-analysis/oslpy.git | ||
cd oslpy | ||
Linux | ||
----- | ||
|
||
1. Install FSL using the instructions `here <https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FslInstallation/Linux>`_. | ||
|
||
2. Install OSL either via pip using:: | ||
|
||
pip install osl | ||
|
||
or from source (in editable mode) using:: | ||
|
||
git clone https://github.com/OHBA-analysis/osl.git | ||
cd osl | ||
conda env create -f envs/linux.yml | ||
conda activate osl | ||
pip install -e . | ||
|
||
Windows | ||
------- | ||
|
||
If you're using a Windows machine, we recommend you install FSL within a `Ubuntu <https://ubuntu.com/wsl>`_ (linux) subsystem following the instructions `here <https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FslInstallation/Windows>`_. | ||
|
||
Then install OSL using the instructions above. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""Fix sform code of structurals. | ||
This script uses FSL to set the sform code of any structural | ||
whose sform code is not 1 or 4 to make sure it is compatible | ||
with OSL. | ||
Warning: this script will permanently change the SMRI file. | ||
""" | ||
|
||
import nibabel as nib | ||
|
||
from osl import source_recon | ||
|
||
source_recon.setup_fsl("/path/to/fsl") | ||
|
||
# Paths to files to fix | ||
files = [ | ||
"smri/sub-001.nii.gz", | ||
"smri/sub-002.nii.gz", | ||
] | ||
|
||
for file in files: | ||
smri = nib.load(file) | ||
sformcode = smri.header.get_sform(coded=True)[-1] | ||
if sformcode not in [1, 4]: | ||
cmd = f"fslorient -setsformcode 1 {file}" | ||
source_recon.rhino.utils.system_call(cmd) | ||
|
||
print("Done”) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters