From dee63f0886c05c2c3d264033493b9a13beb18c3d Mon Sep 17 00:00:00 2001 From: diersk Date: Tue, 24 Oct 2023 17:54:45 +0200 Subject: [PATCH 1/6] Fixed hires issue for SNR computation --- fsqc/checkSNR.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fsqc/checkSNR.py b/fsqc/checkSNR.py index 78acb76..6def1eb 100644 --- a/fsqc/checkSNR.py +++ b/fsqc/checkSNR.py @@ -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] @@ -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] From a7de9d176f03e16ea73366f657722e4ad311acd6 Mon Sep 17 00:00:00 2001 From: diersk Date: Tue, 24 Oct 2023 17:55:33 +0200 Subject: [PATCH 2/6] Fixed hires issues for Fornix evaluation --- README.md | 5 ----- fsqc/evaluateFornixSegmentation.py | 10 ++++++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7a3b92c..c4eca28 100644 --- a/README.md +++ b/README.md @@ -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. ___ diff --git a/fsqc/evaluateFornixSegmentation.py b/fsqc/evaluateFornixSegmentation.py index 34adb4e..2c437a4 100644 --- a/fsqc/evaluateFornixSegmentation.py +++ b/fsqc/evaluateFornixSegmentation.py @@ -59,6 +59,7 @@ def evaluateFornixSegmentation( import os import warnings + import nibabel as nb import numpy as np from fsqc.createScreenshots import createScreenshots @@ -142,14 +143,15 @@ 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")], From 2f587540e479f0fff69d05009d56f75d9fc7e429 Mon Sep 17 00:00:00 2001 From: diersk Date: Tue, 24 Oct 2023 17:56:24 +0200 Subject: [PATCH 3/6] Updated version --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 227cea2..38f77a6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.0 +2.0.1 From 25f0536fc789894b4a4269f80d09eb523461362e Mon Sep 17 00:00:00 2001 From: diersk Date: Wed, 25 Oct 2023 10:01:43 +0200 Subject: [PATCH 4/6] Formatting --- fsqc/evaluateFornixSegmentation.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fsqc/evaluateFornixSegmentation.py b/fsqc/evaluateFornixSegmentation.py index 2c437a4..0fe2ee5 100644 --- a/fsqc/evaluateFornixSegmentation.py +++ b/fsqc/evaluateFornixSegmentation.py @@ -143,15 +143,16 @@ def evaluateFornixSegmentation( # create screenshot if CREATE_SCREENSHOT is True: - 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] + 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", x_coord-1), ("x", x_coord), ("x", x_coord+1)], + 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")], From ccda1d7b35b90b835aa804ffac6ce3188869c379 Mon Sep 17 00:00:00 2001 From: diersk Date: Wed, 25 Oct 2023 10:06:17 +0200 Subject: [PATCH 5/6] Updated list of changes --- CHANGES.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 7e6103f..fc43f2c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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. @@ -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. From 2398212ce91965f7e342d90fc0414a70f2710bb8 Mon Sep 17 00:00:00 2001 From: diersk Date: Wed, 25 Oct 2023 10:06:29 +0200 Subject: [PATCH 6/6] Typo --- fsqc/evaluateFornixSegmentation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsqc/evaluateFornixSegmentation.py b/fsqc/evaluateFornixSegmentation.py index 0fe2ee5..6e3b5db 100644 --- a/fsqc/evaluateFornixSegmentation.py +++ b/fsqc/evaluateFornixSegmentation.py @@ -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.