Git Product home page Git Product logo

raamana / visualqc Goto Github PK

View Code? Open in Web Editor NEW
72.0 72.0 13.0 106.08 MB

VisualQC : assistive tool to ease the quality control workflow of neuroimaging data.

Home Page: https://raamana.github.io/visualqc/

License: Apache License 2.0

Python 99.18% Shell 0.08% MATLAB 0.74%
alignment anatomical-mri cortex fmri freesurfer medical-imaging mri-images neuroimaging neuroscience outlier-detection outlier-removal qc quality-control registration

visualqc's Introduction

Hi there πŸ‘‹

visualqc's People

Contributors

dependabot[bot] avatar raamana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

visualqc's Issues

MatplotlibDeprecationWarning: The keymap.all_axes

/Users/lab/opt/anaconda3/lib/python3.9/site-packages/visualqc/interfaces.py:39: MatplotlibDeprecationWarning:
The keymap.all_axes rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
plt.rcParams[key] = ''

ENH: Freesurfer QC Interface

  • ideal sequence: start with external surface visualizations only (perhaps 2 rows of 3 panels large size), then cross-sectional internal view, and then a rating

or

a keyboard shortcut to zoom in all the surface visualizations into 2 rows of 3 large panels

ENH: refactor the UI to avoid repetitive creation

Right now, the figure is close and whole UI is recreated from scratch!.

This is entirely unnecessary, so long as you clear the data/viz subplots, and reset/unselect ratings for the next subject.

This will be faster and smoother.

Type Error: an integer is required (got type bytes) when just test on visualqc_freesurfer -h

  • visualqc version: 0.5
  • Python version: 3.8.5
  • Operating System: Linux 5.4.0-1039-aws

Description and What I did

I installed VisualQC on my AWS EC2.

When I tried to test it in terminal by using command line: visualqc_freesurfer -h, got error saying Type Error: an integer is required (got type bytes)

Below is the detailed error information.

/home/Xin/miniconda3/lib/python3.8/site-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py:47: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
Traceback (most recent call last):
File "/home/Xin/miniconda3/bin/visualqc_freesurfer", line 33, in
sys.exit(load_entry_point('visualqc==0.5+1.g8e386c1', 'console_scripts', 'visualqc_freesurfer')())
File "/home/Xin/miniconda3/bin/visualqc_freesurfer", line 25, in importlib_load_entry_point
return next(matches).load()
File "/home/Xin/miniconda3/lib/python3.8/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/home/Xin/miniconda3/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 961, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 783, in exec_module
File "", line 219, in _call_with_frames_removed
File "/home/Xin/miniconda3/lib/python3.8/site-packages/visualqc/init.py", line 16, in
from visualqc.outliers import outlier_advisory
File "/home/Xin/miniconda3/lib/python3.8/site-packages/visualqc/outliers.py", line 14, in
from sklearn.ensemble import IsolationForest
File "/home/Xin/miniconda3/lib/python3.8/site-packages/sklearn/init.py", line 64, in
from .base import clone
File "/home/Xin/miniconda3/lib/python3.8/site-packages/sklearn/base.py", line 13, in
from .utils.fixes import signature
File "/home/Xin/miniconda3/lib/python3.8/site-packages/sklearn/utils/init.py", line 13, in
from .validation import (as_float_array,
File "/home/Xin/miniconda3/lib/python3.8/site-packages/sklearn/utils/validation.py", line 27, in
from ..utils._joblib import Memory
File "/home/Xin/miniconda3/lib/python3.8/site-packages/sklearn/utils/_joblib.py", line 18, in
from ..externals.joblib import all # noqa
File "/home/Xin/miniconda3/lib/python3.8/site-packages/sklearn/externals/joblib/init.py", line 119, in
from .parallel import Parallel
File "/home/Xin/miniconda3/lib/python3.8/site-packages/sklearn/externals/joblib/parallel.py", line 32, in
from .externals.cloudpickle import dumps, loads
File "/home/Xin/miniconda3/lib/python3.8/site-packages/sklearn/externals/joblib/externals/cloudpickle/init.py", line 3, in
from .cloudpickle import *
File "/home/Xin/miniconda3/lib/python3.8/site-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py", line 151, in
_cell_set_template_code = _make_cell_set_template_code()
File "/home/Xin/miniconda3/lib/python3.8/site-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py", line 132, in _make_cell_set_template_code
return types.CodeType(
TypeError: an integer is required (got type bytes)

List Pillow image library as a dependency

  • visualqc version: 0.3.6
  • Python version: 3.7
  • Operating System: Windows

Description

visualqc fails to start up as Pillow module does not exist

What I Did

List Pillow image library as a dependency

issue on using -g flag to specifies the name of segmentation image, such as aseg.mgz

  • visualqc version:
  • Python version: 3.6 --- (here I use the conda activate python=3.6 to setup its python environment)
  • Operating System: Linux

Description

I would like to only visualize segmentation images (volumetric) of aseg.mgz to be overlaid on the MRI.

What I Did

Within the conda activated visualqc enviroment

There is no issue to run the command as visualqc_freesurfer -i listImageID.txt -f . -o .
Because I only want to visualize subcortical segmentations, so I add a flag as below
visualqc_freesurfer -i listImageID.txt -f . -o . -g aseg.mgz

But got error saying that "segmentation image for ADNI-xxx-T1w-001 does not contain requested label set!" .

The aseg.mgz is inside the same mri folder as the aparc+aseg.mgz.

Please help me on this issue. Looking forward to your reply. Thank you so much.
Xin

ENH: visualizing freesurfer cortical parcellation natively

  • current solution based on tksurfer works
  • however could be slightly inconvenient while it flashes its window while rendering the parcellations
  • fully native implementation would be ideal
  • or a way to hide Tc/Tk windows from within python

MatplotlibDeprecationWarning: set_window_title function

/Users/lab/opt/anaconda3/lib/python3.9/site-packages/visualqc/freesurfer.py:395: MatplotlibDeprecationWarning:
The set_window_title function was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use manager.set_window_title or GUI-specific methods instead.

Python package bids required in setup.py

  • corticalqa version:
  • Python version: 3.6.4
  • Operating System: macOS 10.13.4

Description

Running visualqc_func_mri on test data from OpenNeuro

What I Did

visualqc_func_mri -b test
ModuleNotFoundError: No module named 'bids'

ValueError: Supplied images do not match

  • visualqc version: 0.4.8
  • Python version: 3.6.8
  • Operating System: Red Hat Linux

Description

This is related to #31, where I'm getting the following error:

ValueError: Supplied images do match in size. This image has dimensions: (208, 106, 128) They must all have: [208 120 128]

I used nibabel to ensure that the original and defaced images contain the same shape & dimensions, so I'm unsure how to work around this issue.

Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.

What I Did

visualqc_defacing --user_dir /N/slate/dlevitas/dan_test/sub-OpenSciJan22/anat/defaced_test --defaced_name defaced.nii.gz --mri_name orig.nii.gz --render_name rendered.png -o $PWD/visualqc --id_list /N/slate/dlevitas/dan_test/sub-OpenSciJan22/anat/defaced_test/subject_ids.txt

ENH: new class to store the input, layout and output info

Right now, too many variables are being passed as arguments to 3 key methods. It works for now, but this could be made more elegant by encapsulating all the relevant variables in a class, and passing a single class.

Need to ensure there is no data leakage (or stale graphics) between subjects!

ValueError: Invalid fraction of outliers: must be more than 1/n (to enable detection of atleast 1)

  • visualqc version:
    visualqc-0.4.1-py3-none-any

  • Python version:
    Python 3.6.9

  • Operating System:
    Ubuntu 18

Description

When I try to launch visualqc_freesurfer I ran into the following error message.

hayashis@haswell:~/Downloads 1 visualqc_freesurfer --fs_dir fsdir
/home/hayashis/.local/lib/python3.6/site-packages/visualqc/utils.py:615: UserWarning: The following subjects do NOT have all the required files or some are empty - skipping them!
  'The following subjects do NOT have all the required files or some are empty - skipping them!')
visualqc


The following files do not exist or empty: 
 /home/hayashis/Downloads/fsdir/visualqc/mri/orig.mgz
/home/hayashis/Downloads/fsdir/visualqc/mri/aparc+aseg.mgz 


1 subjects are usable for review.
Traceback (most recent call last):
  File "/home/hayashis/.local/bin/visualqc_freesurfer", line 11, in <module>
    sys.exit(main())
  File "/home/hayashis/.local/lib/python3.6/site-packages/visualqc/__freesurfer__.py", line 11, in main
    freesurfer.cli_run()
  File "/home/hayashis/.local/lib/python3.6/site-packages/visualqc/freesurfer.py", line 1070, in cli_run
    wf = make_workflow_from_user_options()
  File "/home/hayashis/.local/lib/python3.6/site-packages/visualqc/freesurfer.py", line 1042, in make_workflow_from_user_options
    id_list, vis_type, source_of_features)
  File "/home/hayashis/.local/lib/python3.6/site-packages/visualqc/utils.py", line 783, in check_outlier_params
    raise ValueError('Invalid fraction of outliers: '
ValueError: Invalid fraction of outliers: must be more than 1/n (to enable detection of atleast 1)

What I Did

visualqc_freesurfer --fs_dir fsdir

How to view again things

  • visualqc version: 0.3.3.3
  • Python version: 3.5.5
  • Operating System: linux

Description

I'm not sure whether this is something lacking on your documentation or I just didn't pay enough attention.

So, I processed "my" brains with the following command:
visualqc_freesurfer --fs_dir People/

So far so good, but now I want to have a look again to those where I selected too tired or review later or simply some in particular again. The problem here is that I don't understand how to do this.

If I run the same command obviously it says no subjects to review. I tried this:
visualqc_freesurfer --fs_dir Peopl/ --id_list ids.txt

Where ids.txt has the IDs I want, but I just receive a
ValueError: Invalid fraction of outliers: must be more than 1/n (to enable detection of atleast 1)

What am I doing wrong here? I think at least for those brains where I selected I'm tired or review later it should exist some automatic way.

VisualQC Outlier Detection Error

Hi @raamana,

I was testing the outlier detection module in VisualQC (latest version) and I see the same error as above. Please can assist in how to resolve this error:

$ visualqc_freesurfer --fs_dir '/mnt/fsx/Screening_3DT1w_FSResults' -i '/home/ubuntu/Desktop/visualqc_sub_list.txt' -olt subcortical

visualqc version 0.5.1+25.g1d9d10c for Freesurfer QC
Time stamp : 2022-03-02 20:18:52

10 subjects are usable for review.
Input folder: /mnt/fsx/fsx/nbg/e2609/g000_301_Screening_3DT1w_Recommend_FSResults_NEW
Output folder: /mnt/fsx/fsx/nbg/e2609/g000_301_Screening_3DT1w_Recommend_FSResults_NEW/visualqc
Preprocessing data - please wait ..
(or contemplate the vastness of universe! )
Extracting feature type: subcortical
Traceback (most recent call last):
File "/home/ubuntu/anaconda3/lib/python3.8/site-packages/visualqc-0.5.1+25.g1d9d10c-py3.8.egg/visualqc/workflows.py", line 368, in extract_features
self.feature_paths[feat_type] = self.feature_extractor(self, feat_type)
File "/home/ubuntu/anaconda3/lib/python3.8/site-packages/visualqc-0.5.1+25.g1d9d10c-py3.8.egg/visualqc/readers.py", line 176, in gather_freesurfer_data
features = np.vstack([read_aseg_stats(qcw.fs_dir, id) for id in qcw.id_list])
File "/home/ubuntu/anaconda3/lib/python3.8/site-packages/visualqc-0.5.1+25.g1d9d10c-py3.8.egg/visualqc/readers.py", line 176, in
features = np.vstack([read_aseg_stats(qcw.fs_dir, id) for id in qcw.id_list])
AttributeError: 'FreesurferRatingWorkflow' object has no attribute 'fs_dir'
Unable to extract subcortical features! skipping..
Features required for outlier detection are not available - skipping it.

Attempting to generate the surface visualizations of parcellation ...

Thank you,
Leema

Originally posted by @Leema-Krishna-Murali in #23 (comment)

Failure to run visualqc due (presumably) to mrivis change

  • visualqa version: 0.3+68.gb01c5de.dirty
  • Python version: 3.6.4
  • Operating System: Ubuntu 16.04

Description

Package version mismatch with mrivis causes failure to load mrivis.base.

What I Did

Installed visualqc using setup.py and attempt to run visualqc_t1_mri

./visualqc_t1_mri 
/axiom2/projects/software/arch/linux-xenial-xerus/python-modules/20180122/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Traceback (most recent call last):
  File "./visualqc_t1_mri", line 11, in <module>
    load_entry_point('visualqc==0.3+68.gb01c5de.dirty', 'console_scripts', 'visualqc_t1_mri')()
  File "/axiom2/projects/software/arch/linux-xenial-xerus/python-setuptools/20180327/lib/python3.6/site-packages/setuptools-39.0.1-py3.6.egg/pkg_resources/__init__.py", line 480, in load_entry_point
  File "/axiom2/projects/software/arch/linux-xenial-xerus/python-setuptools/20180327/lib/python3.6/site-packages/setuptools-39.0.1-py3.6.egg/pkg_resources/__init__.py", line 2693, in load_entry_point
  File "/axiom2/projects/software/arch/linux-xenial-xerus/python-setuptools/20180327/lib/python3.6/site-packages/setuptools-39.0.1-py3.6.egg/pkg_resources/__init__.py", line 2324, in load
  File "/axiom2/projects/software/arch/linux-xenial-xerus/python-setuptools/20180327/lib/python3.6/site-packages/setuptools-39.0.1-py3.6.egg/pkg_resources/__init__.py", line 2330, in resolve
  File "/axiom2/projects/software/arch/linux-xenial-xerus/visualqc/0.3/lib/python3.6/site-packages/visualqc-0.3+68.gb01c5de.dirty-py3.6.egg/visualqc/__t1_mri__.py", line 4, in <module>
    from visualqc import t1_mri
  File "/axiom2/projects/software/arch/linux-xenial-xerus/visualqc/0.3/lib/python3.6/site-packages/visualqc-0.3+68.gb01c5de.dirty-py3.6.egg/visualqc/t1_mri.py", line 17, in <module>
    from mrivis.base import Collage
ModuleNotFoundError: No module named 'mrivis.base'

Checking mrivis location:

In [1]: import mrivis
/axiom2/projects/software/arch/linux-xenial-xerus/python-modules/20180122/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters

In [2]: mrivis.__file__
Out[2]: '/axiom2/projects/software/arch/linux-xenial-xerus/src/visualqc/.eggs/mrivis-0.2.8-py3.6.egg/mrivis/__init__.py'

So it's picking up the version that got installed by visualqc, mrivis-0.2.8

Update

Fixed by installing mrivis from github, so it looks like you just need to bump the pypi version to be compatible with visualqc HEAD

Feature Requests for VisualQC/Bug with Notes Feature

  • visualqc version: 0.3.3.3
  • Python version: 3.5.2
  • Operating System: Ubuntu 16.04 Guest on Windows 7

Feature Request

  1. A previous button would be useful to go back and fix ratings when notes were forgotten or the wrong rating option was selected when hitting Next.
  2. Having some sort of shortcut key (like arrow keys) to cycle through available slices in the zoomed in view.
  3. Having the option to dynamically add slices within visualqc to verify ratings in subjects that have borderline errors.

Notes Bug

Sometimes typing in the Notes section triggers the shortcut keys in the rest of the visualqc (e.g. typing g switches to the rating 'good', typing t turns on/off the aseg layer)

ENH: option to color all ROIs with a visible color on gray images

On some MRI scans, some light colors such as blue etc are very difficult to resolve, making it difficult to judge the accuracy of the parcellation. An option, such as a keyboard shortcut c, to change all colors in a given slice to a high-contrast-on-gray-image color (perhaps red?) would be useful.

Script to create tar or zip of only the files needed for visualqc

Often Freesurfer processing is done on a HPC or another remote system, which may not have a display attached to it. So we can't run visualqc directly. And copying the entire FS output is not only quite a hassle (huge size, slow transfer, not enough space locally etc), but also not necessary. So a simple bash script that can create an tar or zip of the just the files needed, would help making that processing by saving time and disk space.

script to summarize accurate ROIs in a dataset

just because one ROI was erroneous (in few vertices or more) in a particular subject's parcellation doesn;t mean we need to discard the entire parcellation.. Hence, after a dataset or subset of it QCed, we could analyze the ratings giles and summarize which ROIs within the dataset are deemed to be accurate for further analyses upon manual/visual inspection!

new feature: outlier detection

  • to flag subjects based on various sets of features
  • user should be able to choose which features determine outliers
  • visualqc must inform the user that this subject has been flagged

vqcdeface unable to read files

  • visualqc version: 0.4
  • Python version: 3.6.4
  • Operating System: Windows 7

Description

So I tried running some test data with vqcdeface using this command

vqcdeface -u C:\Users\atheyers\Documents\defacertest -d defaced.nii.gz -m orig.nii.gz -r defaced

and got this error:

Traceback (most recent call last):
  File "c:\users\atheyers\appdata\local\programs\python\python36-32\lib\site-pac
kages\visualqc\defacing.py", line 399, in load_unit
    self.render_img_list.append(imread(rimg_path))
  File "C:\Users\atheyers\AppData\Roaming\Python\Python36\site-packages\matplotl
ib\image.py", line 1410, in imread
    with Image.open(fname) as image:
  File "c:\users\atheyers\appdata\local\programs\python\python36-32\lib\site-pac
kages\PIL\Image.py", line 2818, in open
    raise IOError("cannot identify image file %r" % (filename if filename else f
p))
OSError: cannot identify image file 'C:\\Users\\atheyers\\Documents\\defacertest
\\test_001\\defaced.nii.gz'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\atheyers\appdata\local\programs\python\python36-32\lib\runpy.py
", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\atheyers\appdata\local\programs\python\python36-32\lib\runpy.py
", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\atheyers\AppData\Local\Programs\Python\Python36-32\Scripts\vqcd
eface.exe\__main__.py", line 9, in <module>
  File "c:\users\atheyers\appdata\local\programs\python\python36-32\lib\site-pac
kages\visualqc\__defacing__.py", line 17, in main
    defacing.cli_run()
  File "c:\users\atheyers\appdata\local\programs\python\python36-32\lib\site-pac
kages\visualqc\defacing.py", line 650, in cli_run
    wf.run()
  File "c:\users\atheyers\appdata\local\programs\python\python36-32\lib\site-pac
kages\visualqc\workflows.py", line 78, in run
    self.loop_through_units()
  File "c:\users\atheyers\appdata\local\programs\python\python36-32\lib\site-pac
kages\visualqc\workflows.py", line 182, in loop_through_units
    skip_subject = self.load_unit(unit_id)
  File "c:\users\atheyers\appdata\local\programs\python\python36-32\lib\site-pac
kages\visualqc\defacing.py", line 402, in load_unit
    ''.format(rimg_path))
OSError: Unable to read the 3D rendered image @
 C:\Users\atheyers\Documents\defacertest\test_001\defaced.nii.gz

This was working before with a different dataset and I've tried re-running that set and it still works perfectly fine. I tried it on a third dataset and that one failed too. As far as I can tell, there is no difference between the file types that I'm using in the three sets (in fact, the working set is a subset of the third one that failed)

batch generation of screenshots without interactive rating

Ideally I want to use this wonderful toolbox to generate the overview plots given in the interactive window but do the actual marking of these images externally.

Is there an option to generate individual plots without the interactive window (and preferably without the need for tkmedit) as I would like to run this as a batch job on our cluster and that wouldn't allow any graphical windows.

Feature Request: Simple visualqc_t1_mri

Maybe I'm just missing it, but it seems challenging to use visualqc_t1_mri with an arbitrary list of T1s.

For example, I wanted to look at some bet segmentations I just ran and thought I'd try visualqc

visualqc_t1_mri \
  -i <(find -cmin -5000 | grep "anat\.nii" | cut -f 2 -d / | cut -f1 -d. | sed "s|_anat||") \
  --user_dir .

This fails saying my subject directories are empty (seems to think I want to use freesurfer outputs) alternatively, keeping the full path files

visualqc_t1_mri \
  -i <(find -cmin -5000 | grep "anat\.nii"") \
  --user_dir .

similarly fails.

It would be nice to have a simple mode where you pass a list of T1 files.

visualqc_func_mri errors with the latest version of pybids

  • visualqc version: 0.4.3
  • Python version: 3.76
  • Operating System: CentOS

What I Did

I tried to run

visualqc_func_mri -b SmallData/

and got:

  File "/home/me/miniconda3/lib/python3.7/site-packages/visualqc/functional_mri.py", line 344, in init_getters
    from bids.layers import BIDSLayout
ModuleNotFoundError: No module named 'bids.grabbids'

I noticed that in the version 0.7.0 from Jan 2019 they changed this grabbids submodule to layout:
https://github.com/bids-standard/pybids/blob/master/CHANGELOG.md#version-070-january-10-2019

Unfortunately, the fix wasn't as easy as replacing import in 344 of functional_mri.py:

from bids.layout import BIDSLayout

After doing that I got instead

 File "/home/me/miniconda3/lib/python3.7/site-packages/bids/layout/layout.py", line 969, in get
    raise ValueError(msg + "If you're sure you want to impose "
ValueError: 'extensions' is not a recognized entity. Did you mean ['extension']? If you're sure you want to impose this constraint, set invalid_filters='allow'.

Maybe temporary fix would be to specify pybids version in requirements?

visualqc_t1_mri error to detect outlier

  • visualqc version: 0.4.1
  • Python version: 3.7
  • Operating System: ubuntu 16.04lts

Description

Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.

Run through visualqc_t1_mri

What I Did

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

visualqc_t1_mri -u . -i subjects -m t1.nii.gz

12 subjects are usable for review.
Input folder: .
Output folder: ./visualqc
Preprocessing data - please wait ..
(or contemplate the vastness of universe! )
Extracting feature type: histogram_whole_scan
200107_09_04319814 : 1/12
200107_15_51129205 : 2/12
200108_00_72128082 : 3/12
200108_01_82273425 : 4/12
200108_01_83887227 : 5/12
200108_06_06131380 : 6/12
200114_04_66523086 : 7/12
200114_04_91957295 : 8/12
200114_07_18910654 : 9/12
200115_00_27419385 : 10/12
200115_02_77379437 : 11/12
200115_05_12357443 : 12/12
Traceback (most recent call last):
File "/home/shengwei/anaconda3/bin/visualqc_t1_mri", line 8, in
sys.exit(main())
File "/home/shengwei/anaconda3/lib/python3.7/site-packages/visualqc/t1_mri.py", line 11, in main
t1_mri.cli_run()
File "/home/shengwei/anaconda3/lib/python3.7/site-packages/visualqc/t1_mri.py", line 777, in cli_run
wf.run()
File "/home/shengwei/anaconda3/lib/python3.7/site-packages/visualqc/workflows.py", line 75, in run
self.preprocess()
File "/home/shengwei/anaconda3/lib/python3.7/site-packages/visualqc/t1_mri.py", line 314, in preprocess
self.detect_outliers()
File "/home/shengwei/anaconda3/lib/python3.7/site-packages/visualqc/workflows.py", line 387, in detect_outliers
features = gather_data(self.feature_paths[feature_type], self.id_list)
File "/home/shengwei/anaconda3/lib/python3.7/site-packages/visualqc/readers.py", line 225, in gather_data
features = np.vstack([np.genfromtxt(path_list[sid]) for sid in id_list])
File "/home/shengwei/anaconda3/lib/python3.7/site-packages/visualqc/readers.py", line 225, in
features = np.vstack([np.genfromtxt(path_list[sid]) for sid in id_list])
KeyError: '200107_09_04319814'

Warning Message When Loading VisualQC

  • visualqc version: 0.3.3.3
  • Python version: 3.5.2
  • Operating System: Ubuntu 16.04 Guest on Windows 7

Description

VisualQC loads but I get this warning message every time:

Extracting feature type: cortical
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/visualqc/workflows.py", line 345, in extract_features
self.feature_paths[feat_type] = self.feature_extractor(self, feat_type)
File "/usr/local/lib/python3.5/dist-packages/visualqc/readers.py", line 166, in gather_freesurfer_data
[read_aparc_stats_wholebrain(qcw.in_dir, id) for id in qcw.id_list])
File "/usr/local/lib/python3.5/dist-packages/visualqc/readers.py", line 166, in
[read_aparc_stats_wholebrain(qcw.in_dir, id) for id in qcw.id_list])
File "/usr/local/lib/python3.5/dist-packages/visualqc/readers.py", line 75, in read_aparc_stats_wholebrain
hm_data = read_aparc_stats_in_hemi(stats_path, subset)
File "/usr/local/lib/python3.5/dist-packages/visualqc/readers.py", line 121, in read_aparc_stats_in_hemi
roi_stats_values[idx, :] = [stat[feat] for feat in subset]
TypeError: 'NoneType' object is not iterable
Unable to extract cortical features - skipping them.
Extracting feature type: subcortical
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/visualqc/workflows.py", line 345, in extract_features
self.feature_paths[feat_type] = self.feature_extractor(self, feat_type)
File "/usr/local/lib/python3.5/dist-packages/visualqc/readers.py", line 168, in gather_freesurfer_data
features = np.vstack([read_aseg_stats(qcw.fs_dir, id) for id in qcw.id_list])
File "/usr/local/lib/python3.5/dist-packages/visualqc/readers.py", line 168, in
features = np.vstack([read_aseg_stats(qcw.fs_dir, id) for id in qcw.id_list])
AttributeError: 'FreesurferRatingWorkflow' object has no attribute 'fs_dir'
Unable to extract subcortical features - skipping them.
Features required for outlier detection are not available - skipping it.

more keyboard shortcuts

Implement keyboard shortcuts to bring these up as necessary,

  • Alt+E for erroneous ROIs,
  • Alt+O ROIs with outlying values...
  • also ability to show neighbouring slices with arrow keys to help improve confidence on the accuracy of current slice

(IndexError) Cannot execute visualqc_freesurfer in newer versions

  • visualqc version: 0.3.5 (installed through pip)
  • Python version: 3.7
  • Operating System: Linux

Description

I just tried to run a normal visualqc_freesurfer command, but without success as the output in the following section shows. This happened when I tried to use a new environment with recent python and visualqc versions

I don't have any problem in the same folder in a previous version that I had configured (python 3.5 and
visualqc 0.3.3.3).

What I Did

(env-new) user@server$ visualqc_freesurfer --fs_dir .
/home/user/miniconda/envs/env-new/lib/python3.7/site-packages/visualqc/utils.py:610: UserWarning: The following subjects do NOT have all the required files or some are empty - skipping them!
  'The following subjects do NOT have all the required files or some are empty - skipping them!')
1611420080917


The following files do not exist or empty: 
 /folder_server/1611420080917/mri/aparc+aseg.mgz 


14 subjects are usable for review.
Input folder: .
Output folder: ./visualqc
Preprocessing data - please wait .. 
        (or contemplate the vastness of universe! )
Extracting feature type: cortical
Extracting feature type: subcortical
Traceback (most recent call last):
  File "/home/user/miniconda/envs/env-new/lib/python3.7/site-packages/visualqc/workflows.py", line 346, in extract_features
    self.feature_paths[feat_type] = self.feature_extractor(self, feat_type)
  File "/home/user/miniconda/envs/env-new/lib/python3.7/site-packages/visualqc/readers.py", line 169, in gather_freesurfer_data
    features = np.vstack([read_aseg_stats(qcw.fs_dir, id) for id in qcw.id_list])
  File "/home/user/miniconda/envs/env-new/lib/python3.7/site-packages/visualqc/readers.py", line 169, in <listcomp>
    features = np.vstack([read_aseg_stats(qcw.fs_dir, id) for id in qcw.id_list])
AttributeError: 'FreesurferRatingWorkflow' object has no attribute 'fs_dir'
Unable to extract subcortical features - skipping them.
Traceback (most recent call last):
  File "/home/user/miniconda/envs/env-new/bin/visualqc_freesurfer", line 11, in <module>
    sys.exit(main())
  File "/home/user/miniconda/envs/env-new/lib/python3.7/site-packages/visualqc/__freesurfer__.py", line 11, in main
    freesurfer.cli_run()
  File "/home/user/miniconda/envs/env-new/lib/python3.7/site-packages/visualqc/freesurfer.py", line 1066, in cli_run
    wf.run()
  File "/home/user/miniconda/envs/env-new/lib/python3.7/site-packages/visualqc/workflows.py", line 68, in run
    self.preprocess()
  File "/home/user/miniconda/envs/env-new/lib/python3.7/site-packages/visualqc/freesurfer.py", line 318, in preprocess
    self.detect_outliers()
  File "/home/user/miniconda/envs/env-new/lib/python3.7/site-packages/visualqc/workflows.py", line 371, in detect_outliers
    features = gather_data(self.feature_paths[feature_type], self.id_list)
  File "/home/user/miniconda/envs/env-new/lib/python3.7/site-packages/visualqc/readers.py", line 225, in gather_data
    features = np.vstack([np.genfromtxt(path_list[sid]) for sid in id_list])
  File "/home/user/miniconda/envs/env-new/lib/python3.7/site-packages/visualqc/readers.py", line 225, in <listcomp>
    features = np.vstack([np.genfromtxt(path_list[sid]) for sid in id_list])
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

Surface Visualization issue

Hello Raamana,

Currently trying to use the visualQC output for surfaces visualizations. They work for aparc+aseg/
I have freesurfer installed and sourced to terminal, however, this message keeps popping up:

Attempting to generate the surface visualizations of parcellation ...
Freesurfer does not seem to be installed - skipping surface visualizations.

Not sure if this is an issue with running it in terminal or if there's a separate installation procedure needed for visualqc.

ability to focus on "outliers" only

when reviewing a large dataset, it maybe useful under some circumstances, to allow the user to focus on "outlier" candidates only, reducing the size by 90% or so, depending on the outlier fraction they chose.

the key here is to ensure outlier identification method is well validated and useful for the task at hand.

ENH: new button to open tkmedit directly from VQC

  • once the user spots errors, he or she may want to correct it directly in tkmedit
  • having a single button to open all the relevant volumes and surfaces would be great.
  • it may be also smart to create a shell script that will do this later on, one subject at a time.

outlier alerts functionality duplicated

the .add_alerts() and .update_alerts() methods of various workflows are exact duplicates! they can absorbed into the visualqc.base.BaseWorkflow class without any loss of functionality and avoid duplicated code. However, this requires proper testing on datasets where outlier detection module identifies some outliers etc.

Optional mask to be highlighted on FS parcellation

an option to specify a β€œnegative” mask (lesion, pathology, bad FOV etc) would be useful. VisualQC can use such a mask to highlight erroneous areas and parcels during the review, to further expedite the process.

ENH: Automatic recording of erroneous locations/ROIs

It would be very useful to automatic record location (image coordinates) or ROI name (parcel annotation perhaps?) of erroneous areas as users identify them. They can note it in Notes field right now with hemi:roi_code; etc but it is additional work (even if simple/quick) and sometimes users may not know the name or hemispheres.

intelligent slice selection

  • Show slices highlighting ROIs known to be frequently erroneous
  • also, find all ROIs with outlying values (such as 5% zeros, or over 6mm thickness) and show slices on them
  • implement keyboard shortcuts to show bring these up as necessary, Alt+E for erroneous ROIs, Alt+O ROIs with outlying values... also ability to show neighbouring slices with arrow keys to help gain confidence on the accuracy of current slice

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.