Skip to content

Commit

Permalink
Merge pull request #49 from Deep-MI/dev
Browse files Browse the repository at this point in the history
Minor fix for SNR and fornix hires issues
  • Loading branch information
kdiers authored Oct 25, 2023
2 parents 0a431ae + 2398212 commit 4518d4b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
6 changes: 5 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This is a document summarizing the changes that are associated with (major) updates and releases. Priority is given to changes that are relevant to the user, and those that introduce new features or break compatibility with prior versions.

## Version 2.0.1

- This fix addresses two minor issues where output was omitted for the SNR computation and the fornix evaluation whenever hires inputs were used.

## Version 2.0.0

- Name changes for the toolbox, repository, package, and scripts: the toolbox has been renamed to "fsqc tools", the python package name "qatoolspython" has been changed to "fsqc", and the "qatools.py" script has been renamed to "run_fsqc". The github repository is now located at "https://github.com/Deep-MI/fsqc", but requests to the old "https://github.com/Deep-MI/qatools-python" repository will be redirected.
Expand All @@ -12,6 +16,6 @@ This is a document summarizing the changes that are associated with (major) upda
- Addition of skullstrip, surfaces, hippocampus and hypothalamus modules.
- Improved logging, error handling, and testing frameworks.
- Enhanced containerization support (docker, singularity, dockerhub).
- Updated requirements, easier installation of the packaage and its dependencies, availability of the package on [pypi.org](https://pypi.org).
- Updated requirements, easier installation of the package and its dependencies, availability of the package on [pypi.org](https://pypi.org).
- FreeSurfer is no longer required as a dependency (except for the optional 'shape analysis' module, which relies on the brainprint package).
- We do not preserve compatibility with earlier versions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,6 @@ ___
logfiles, and may fail or return erroneous results if the logfile is
appended by multiple restarts of recon-all runs. Ideally, the logfile should
therefore consist of just a single, successful recon-all run.
- High-resolution data: Prior to update v1.4, the screenshots and fornix module
did not work well with high-resolution data that was processed using the
-cm flag in recon-all. With update v1.4 this has been fixed for the
screenhots module, but the fornix module is still experimental for
high-resolution data.

___

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.0
2.0.1
4 changes: 2 additions & 2 deletions fsqc/checkSNR.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def checkSNR(
# Process white matter image

# Create 3D binary data where the white matter locations are encoded with 1, all the others with zero
b_wm_data = np.zeros((256, 256, 256))
b_wm_data = np.zeros(norm.shape)

# The following keys represent the white matter labels in the aparc+aseg image
wm_labels = [2, 41, 7, 46, 251, 252, 253, 254, 255, 77, 78, 79]
Expand All @@ -120,7 +120,7 @@ def checkSNR(
# Process gray matter image

# Create 3D binary data where the gray matter locations are encoded with 1, all the others with zero
b_gm_data = np.zeros((256, 256, 256))
b_gm_data = np.zeros(norm.shape)

# The following keys represent the gray matter labels in the aseg image
gm_labels = [3, 42]
Expand Down
13 changes: 8 additions & 5 deletions fsqc/evaluateFornixSegmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def evaluateFornixSegmentation(
This script evaluates potential missegmentation of the fornix, which may
erroneously be attached to the 'corpus collosum' label.
It will appply the cc_up.lta transform to the norm.mgz and the aseg files,
It will apply the cc_up.lta transform to the norm.mgz and the aseg files,
and create a binary corpus callosum mask and surface. Resulting files are
saved to subject-specific directories within the 'fornix' subdirectory of
the output directory.
Expand Down Expand Up @@ -59,6 +59,7 @@ def evaluateFornixSegmentation(
import os
import warnings

import nibabel as nb
import numpy as np

from fsqc.createScreenshots import createScreenshots
Expand Down Expand Up @@ -142,14 +143,16 @@ def evaluateFornixSegmentation(
# create screenshot

if CREATE_SCREENSHOT is True:
# Note: SURF = [os.path.join(OUTPUT_DIR,"cc.surf")] is no longer possible
# unless using FreeSurfer's mri_binarize function (or creating the fornix
# surface otherwise)
hdr = nb.load(os.path.join(OUTPUT_DIR, "asegCCup.mgz"))
x_coord = np.matmul(
hdr.header.get_vox2ras_tkr(), np.array((128, 128, 128, 1))[:, np.newaxis]
)[0]

createScreenshots(
SUBJECT=SUBJECT,
SUBJECTS_DIR=SUBJECTS_DIR,
INTERACTIVE=False,
VIEWS=[("x", -2), ("x", 0), ("x", 2)],
VIEWS=[("x", x_coord - 1), ("x", x_coord), ("x", x_coord + 1)],
LAYOUT=(1, 3),
BASE=[os.path.join(OUTPUT_DIR, "normCCup.mgz")],
OVERLAY=[os.path.join(OUTPUT_DIR, "cc.mgz")],
Expand Down

0 comments on commit 4518d4b

Please sign in to comment.