Closed rb643 closed 1 year ago
It is possible to generate the static collages that you would like, but visualqc for Freesurfer is most useful in an interactive way.. esp with the option to toggle the contours of white and pial surfaces.
Would you mind elaborating on the need for this use case, other than lack of graphics capability on clusters?
its mainly the lack of graphics on clusters, but exacerbated by the fact that I want to generate screenshots for around 50k datasets. Is the plotting option based on tkmedit or does it handle it differrently?
I see the need : 50K is a very large number for interactive QC. What will you do with the generated static screenshots?
external surface visualizations (top row) are generated via tksurfer, if Freesurfer tools are in path. The rest are all native using : mrivis and visualqc helpers
hi, were you able to find a solution? Let me know how I can help.
we are thinking of using something akin to braindr to do a fact visual qc on output images. so far I've not een able to find a tkmedit independent solution that doesn't involved a lot of data reformatting. basic solution so far has been using the ribbon in volumetric space as an overlay as an indirect proxy
I see where you are coming from. i know what needs to be done and I am happy to help - can we perhaps do a short phone/video call to discuss the best way to achieve this? I am generally available with few hours of notice.
Hi, is there any update to this? We're in a similar situation and would find it useful.
Not yet - but I might be able to push one through quickly depending on the specific use case. What exactly are you looking for @l-espana (specific QC module, data type, specific visualizations, how will it be used for QC etc) ?
Looking mostly at FreeSurfer data, so slices for white/pial surfaces and segmentations, as well as subcortical regions. I'm hoping to use screenshots in some sort of dashboard setting for QC of FreeSurfer and eventually other data (diffusion, rest, cbf, etc.) for large datasets. Is that enough info?
Apologies for totally missing this thread...
In the end we ended up creating screenshots with freeview by simulating a graphics server that runs on our cluster:
Something like:
xvfb-run -a --server-args="-screen 0 1024x768x24" freeview -cmd /workdir/freeviewconfig_multi.txt
Where the the txt config file is generated in a loop to pick a set of random coordinates and orientations.
Then for the actual labelling of the resulting png's we wrote a custom browser app. This is still in development and being tested, but are hopefully able to release it soon. Though I imagine that once you have a set of PNG's, visualqc can be configured in the same way fairly straightforwardly as a stripped down version of the current amazing existing toolbox?
thanks Lezlie -- what sort of dashboard are you referring to? if you are going to use another GUI/app of the screenshots, why not use visualqc? or maybe i am missing your specific need or requirements?
thanks Richard, can i see some example scripts that you use for freeview and the corresponding txt/config files?
This is the rough flow
cd ${workdir}
echo freeview -v ${subjectdir}/mri/brain.mgz -f ${subjectdir}/surf/lh.pial:edgecolor=red:edgethickness=1 -f ${subjectdir}/surf/rh.pial:edgecolor=red:edgethickness=1 -f ${subjectdir}/surf/lh.white:edgecolor=blue:edgethickness=1 -f ${subjectdir}/surf/rh.white:edgecolor=blue:edgethickness=1 > freeviewconfig_multi.txt
echo -viewport coronal -slice 102 128 100 -ss ${sub}_cor1_surfaces.png 2 1 -noquit >> freeviewconfig_multi.txt
echo -viewport coronal -slice 102 128 128 -ss ${sub}_cor2_surfaces.png 2 1 -noquit >> freeviewconfig_multi.txt
echo -viewport coronal -slice 102 128 152 -ss ${sub}_cor3_surfaces.png 2 1 -noquit >> freeviewconfig_multi.txt
echo -viewport sagittal -slice 82 128 128 -ss ${sub}_sag1_surfaces.png 2 1 -noquit >> freeviewconfig_multi.txt
echo -viewport sagittal -slice 102 128 128 -ss ${sub}_sag2_surfaces.png 2 1 -noquit >> freeviewconfig_multi.txt
echo -viewport sagittal -slice 152 128 128 -ss ${sub}_sag3_surfaces.png 2 1 -noquit >> freeviewconfig_multi.txt
echo -viewport sagittal -slice 172 128 128 -ss ${sub}_sag4_surfaces.png 2 1 -noquit >> freeviewconfig_multi.txt
echo -viewport axial -slice 102 100 128 -ss ${sub}_ax1_surfaces.png 2 1 -noquit >> freeviewconfig_multi.txt
echo -viewport axial -slice 102 120 128 -ss ${sub}_ax2_surfaces.png 2 1 -noquit >> freeviewconfig_multi.txt
echo -viewport axial -slice 102 140 128 -ss ${sub}_ax3_surfaces.png 2 1 -quit >> freeviewconfig_multi.txt
echo "creating QC image for" ${sub}
xvfb-run -a --server-args="-screen 0 1024x768x24" freeview -cmd ${workdir}/freeviewshot_multi.txt
Where the exact coordinated going into the config file can also be assigned randomly within a given range of course.
At least this has proven to be SLURMable for large dataset on a HPC where we can't open graphical windows.
Cool, that's what I expected. Can I see an example output?
I'm slowly working on developing a web/R app for some of our larger projects that have multiple sites so we can track data over time and do QC in real time as subjects come in, etc. So pulling from multiple types of scan data and trying to get things in a usable and easily accessible interface for multiple people. I'm also having some issues running visualqc over ssh on our system so viewing through that for other projects is causing some issues - although I haven't looked into this too much yet.
Cool - I was thinking of the full interface that would utilize these slice-wise overlays, but I now realize you would focus on just one slice at a time right? The reason I hadn't done this (despite Anisha suggesting it when she was building braindr) is I don't think it's a sufficient approach for Freesurfer QC. braindr is great for some QC tasks, but not for complex QC tasks involving many types of data and diverse visualizations etc. I strongly believe a more integrated approach such as visualqc is necessary! you might want to take a look at our preprint showing its reliability and other stats: https://www.biorxiv.org/content/10.1101/2020.09.07.286807v5
My boss sent me your paper, I think it's great and that you're totally right that individual slices aren't sufficient for full QC. We sometimes just need an initial QC to get an idea of the quality of the data as it comes in and see if there were any major errors, etc. so we can catch any changes that need to be made earlier on in the pipeline or even the scan protocol, so we take some screenshots. I should look into incorporating an actual interface like visualqc though...I can look into it.
not sure you realize it, but this is HUGE project, i mean GIGANTIC project :): "a web/R app for some of our larger projects that have multiple sites so we can track data over time and do QC in real time as subjects come in, etc. So pulling from multiple types of scan data and trying to get things in a usable and easily accessible interface for multiple people"
that almost sounds like the full-blown BrainCODE platform which took big teams 5+ years to develop: "Brain-CODE: A Secure Neuroinformatics Platform for Management, Federation, Sharing and Analysis of Multi-Dimensional Neuroscience Data", | Frontiers in Neuroinformatics https://www.frontiersin.org/articles/10.3389/fninf.2018.00028/full
I may not be explaining things well...not nearly as big as the BrainCODE thing! It's just an idea I've had and wanted to work on, so exploring different tools. We also work a lot with FreeSurfer, so I think tools like yours are always nice to keep up with.
I would normally agree, but we are generating about 10-15 images per subject and doing this on a 150.000 subject dataset, I think having more or fine-grained images is just not workable. 1.5-2m images is plenty to get through as is :) Though we will do some cross-validation with other metrics on a subset (and hopefully release any QC scores so no one else will have to do this again)
Hey sorry guys, I haven't gotten to this yet, but FYI v0.6 from #57 adds a number of improvements and fixes you might like.
i'd be working on this batch generation of screenshots soon
Thanks for the update! I have a semi-related question for you as well - have you found any other ways to view talairach registrations for qc? ( https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/Talairach_freeview ) It's another visualization we want to keep in our process since it can affect total brain volume, etc. Tkregister2 doesn't support screenshots that I'm aware of, and tbh, it doesn't seem like a major concern for a lot of researchers (not sure why).
not sure if I fully understand your issue, but visualqc already offers a way to check alignment/registration accuracy with vqcalign
or visualqc_alignment
- see examples here:
https://raamana.github.io/visualqc/gallery_registration_unimodal.html
Usage is noted here and let me know if you have difficulties in using it.
Hi @rb643 @l-espana, I've gotten to working on this and am able to develop the feature quickly. It's available in the https://github.com/raamana/visualqc/tree/screenshots_batch_generation branch, and I'd much appreciate if you can give it a try and test it with a few different options
all you need to do is
git checkout screenshots_batch_generation
pip install -e .
and run of the modules (like Freesurfer) with the --screenshot_only
option
e.g.,
vqcfs -f <<freesurfer root dir>> --screenshot_only
you can also try it with volumetric labels:
vqcfs -f <<freesurfer root dir>> -v labels_contour --labels 10 11 12 13 -w 1 -s 12 -r 4 --screenshot_only
I think it should work on display-less HPC environments too but I'd appreciate it if you can try it there and let me know your experience. Thanks.
this works for all modules now btw!
officially released in v0.6.5
today.
2b828ad fixes #72 #37
for future reference, collages can easily be generated for an entire dataset, with mrivis:
from mrivis import Collage, Carpet, SlicePicker
collage = Collage()
for subject_id, image in get_images():
collage.attach(image)
collage.save(output_path=out_dir/f'vis_{subject_id}.png')
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.