generated from snakemake-workflows/snakemake-workflow-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add qc report generation into the workflow (#40)
- Provides an html page for each subject containing before and after flat-field correction, whole slice, and volume rendered images - All images and image data is stored locally within the qc directory - Can customize the number of slices and colour maps from config file - Additionally includes a script to create small test datasets from an existing dataset
- Loading branch information
Showing
20 changed files
with
1,148 additions
and
3 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,19 @@ | ||
# How to view QC reports | ||
|
||
### 1: Run the workflow with personalized report generation configurations | ||
|
||
### 2: Navigate to qc directory: | ||
|
||
```bash | ||
cd ./qc | ||
``` | ||
### 3: Create a Python web server: | ||
|
||
```bash | ||
python -m http.server | ||
``` | ||
### 4: Open the link generated in a browser and open qc_report.html | ||
|
||
|
||
### Note: | ||
Can view the whole slice images and the flatfield corrections without running the web server. However, to view the volume rendered brain, the web server is required. |
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,120 @@ | ||
<!DOCTYPE html> | ||
<head> | ||
<title>FlatField Correction Check</title> | ||
<style> | ||
img { | ||
height: auto; | ||
width:200px; | ||
z-index: 0; | ||
position: relative; | ||
} | ||
|
||
table { | ||
margin-left: auto; | ||
margin-right: auto; | ||
} | ||
|
||
.expand-options { | ||
float: right; | ||
} | ||
|
||
#expand_scale { | ||
display: none; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<a href="./subject.html">Back</a> | ||
<label class="expand-options"> | ||
Expand Images on Click | ||
<input type="checkbox" id="expand"> | ||
<input type="number" id="expand_scale" value="2"> | ||
</label> | ||
<table id="table"> | ||
<tbody> | ||
{%- for chunk in chunks %} | ||
{%- set chunk_num = loop.index0 %} | ||
{%- for channel in chunk %} | ||
<tr> | ||
<td colspan={{ numColumns }}> | ||
<h2>Chunk - {{ chunk_num }} Channel - {{ loop.index0 }}</h2> | ||
</td> | ||
</tr> | ||
<tr> | ||
{%- for image in channel %} | ||
<td> | ||
<img src="{{ image.img_corr }}"></img> | ||
<h3>Corrected</h3> | ||
<p>Slice-{{ image.slice }}</p> | ||
</td> | ||
<td> | ||
<img src="{{ image.img_uncorr }}"></img> | ||
<h3>Uncorrected</h3> | ||
<p>Slice-{{ image.slice }}</p> | ||
</td> | ||
{%- endfor %} | ||
</tr> | ||
{%- endfor %} | ||
{%- endfor %} | ||
</tbody> | ||
<script> | ||
// get every image, expandButtonToggle and the expand factor | ||
const images = document.querySelectorAll('img'); | ||
const expandButton = document.getElementById("expand") | ||
const expand_factor = document.getElementById("expand_scale") | ||
let expansion_scale = 1 | ||
let expanded = false; | ||
|
||
// create a function to expand images when clicked on | ||
function handleImageClick(event){ | ||
// get target image and the scaling factor | ||
const image = event.target | ||
expansion_scale = expand_factor.value; | ||
|
||
// expand image by the scaling factor if not already expanded | ||
if(!expanded){ | ||
image.style.transform = `scale(${expansion_scale})` | ||
image.style.zIndex = 1 | ||
|
||
// if it is going to expand off screen shift to the right | ||
const leftDistance = image.getBoundingClientRect().left; | ||
if(leftDistance < 0){ | ||
image.style.transform = `translateX(${Math.abs(leftDistance)+10}px) scale(${expansion_scale})`; | ||
} | ||
|
||
expanded=true | ||
|
||
} else { | ||
// scale images back to original size | ||
image.style.transform = "scale(1)" | ||
image.style.position = 'relative' | ||
image.style.zIndex=0 | ||
expanded=false | ||
} | ||
} | ||
|
||
// Enables or disables the ability to expand images on click | ||
expandButton.addEventListener('change', ()=>{ | ||
|
||
// add listener to enable expansion | ||
if(expandButton.checked){ | ||
images.forEach(image => { | ||
image.addEventListener('click', handleImageClick) | ||
}) | ||
|
||
// ensure images expand properly | ||
expand_factor.style.display='inline'; | ||
|
||
} else { | ||
|
||
//remove listener to disable expansion | ||
images.forEach(image => { | ||
image.removeEventListener('click', handleImageClick) | ||
image.style.transform = 'scale(1)' | ||
}) | ||
|
||
expand_factor.style.display = 'none' | ||
} | ||
}) | ||
</script> | ||
</body> |
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,6 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>QC Reports</title> | ||
</head> | ||
<body> |
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,13 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>{{ subject }} - {{ sample }} - {{ acq }}</title> | ||
</head> | ||
<body> | ||
<a href="{{ back_link }}">Back</a><br> | ||
<a href="{{ ffhtml }}">Flatfield Correction QC</a><br> | ||
<a href="{{ wshtml }}">Whole Slice QC</a> | ||
<br> | ||
<a href="{{ volhtml }}">Volume Rendered Image</a> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,22 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>3D Brain</title> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> | ||
<script type="importmap"> | ||
{ | ||
"imports": { | ||
"three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js", | ||
"three/addons/": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/" | ||
} | ||
} | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<a href="./subject.html">Back</a> | ||
<div id="inset"></div> | ||
<script src="./volume_resources/volRenderScript.js" type="module"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.