Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
tractatus committed Apr 11, 2024
1 parent 4de36d2 commit 7496b81
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 21 deletions.
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,29 @@

Quarto shortcode extension to display micrographs in revealjs presentations

_TODO_: Add a short description of your extension.

## Installing

_TODO_: Replace the `<github-organization>` with your GitHub organization.

```bash
quarto add <github-organization>/micrograph
quarto add furthlab/micrograph
```

This will install the extension under the `_extensions` subdirectory.
If you're using version control, you will want to check in this directory.

## Using

_TODO_: Describe how to use your extension.
- First argument is path to file.
- Second argument is name of the blue channel (default `DAPI`).
- Third argument is name of the green channel (default `Phalloidin`).
- Fourth argument is name of the red channel (default `anti-FLAG`).
- Optional arguments are:
- `width = "255"` default is 255px.

```
{{< micrograph ./img/GFP.jpg DAPI Phalloidin GFP width="255" >}}
```

## Example

Here is the source code for a minimal example: [example.qmd](example.qmd).
Check our the source code for a minimal example using revealjs for the presentation: [example.qmd](example.qmd).

31 changes: 19 additions & 12 deletions _extensions/micrograph/micrograph.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
function micrograph(args, kwargs, meta)
cmt = meta['show_comments']
local src = args[1] or ''
local imgWidth = args[2] or '255' -- Default size is 255x255
local channelOne = args[3] or 'DAPI'
local channelTwo = args[4] or 'Phalloidin'
local channelThree = args[5] or 'Alexa647'
local channelOne = args[2] or 'DAPI'
local channelTwo = args[3] or 'Phalloidin'
local channelThree = args[4] or 'Alexa647'
local imgWidth = pandoc.utils.stringify(kwargs["width"]) or '255'
local imgHeight = pandoc.utils.stringify(kwargs["height"]) or '100%'

local html = [[
<div class='container-wrapper'>
<div class='canvas-container'>
<h6 style="color: blue">]] .. channelOne .. [[</h6>
<canvas id='redCanvas' width=']] .. imgWidth .. [[' height=']] .. imgWidth .. [['></canvas>
<div class='slider-container'>
<canvas id='redCanvas' width=']] .. imgWidth .. [[' height=']] .. imgHeight .. [['></canvas>
<div class='slider-container channelOne-sliders'>
<label for='redMax'>Max:</label>
<input type='range' id='redMax' min='0' max='255' value='255'>
<label for='redMin'>Min:</label>
Expand All @@ -23,8 +25,8 @@ function micrograph(args, kwargs, meta)
</div>
<div class='canvas-container'>
<h6 style="color: green">]] .. channelTwo .. [[</h6>
<canvas id='greenCanvas' width=']] .. imgWidth .. [[' height=']] .. imgWidth .. [['></canvas>
<div class='slider-container'>
<canvas id='greenCanvas' width=']] .. imgWidth .. [[' height=']] .. imgHeight .. [['></canvas>
<div class='slider-container channelTwo-sliders'>
<label for='greenMax'>Max:</label>
<input type='range' id='greenMax' min='0' max='255' value='255'>
<label for='greenMin'>Min:</label>
Expand All @@ -37,8 +39,8 @@ function micrograph(args, kwargs, meta)
</div>
<div class='canvas-container'>
<h6 style="color: red">]] .. channelThree .. [[</h6>
<canvas id='blueCanvas' width=']] .. imgWidth .. [[' height=']] .. imgWidth .. [['></canvas>
<div class='slider-container'>
<canvas id='blueCanvas' width=']] .. imgWidth .. [[' height=']] .. imgHeight .. [['></canvas>
<div class='slider-container channelThree-sliders'>
<label for='blueMax'>Max:</label>
<input type='range' id='blueMax' min='0' max='255' value='255'>
<label for='blueMin'>Min:</label>
Expand All @@ -51,7 +53,7 @@ function micrograph(args, kwargs, meta)
</div>
<div class='canvas-container' style='vertical-align: top;'>
<h6>Merge</h6>
<canvas id='originalCanvas' width='200' height='200'></canvas>
<canvas id='originalCanvas' width=']] .. imgWidth .. [[' height=']] .. imgHeight .. [['></canvas>
</div>
</div>
Expand All @@ -67,8 +69,9 @@ function micrograph(args, kwargs, meta)
.canvas-container canvas {
max-width: 100%;
height: auto;
border-radius: 10px;
}
.slider-container {
display: block;
line-height: 0.5;
Expand All @@ -87,6 +90,10 @@ function micrograph(args, kwargs, meta)
margin-bottom: 5px; /* Adjust vertical spacing between input and label */
}
/* Adjust the color of the slider thumb for green sliders */
.channelOne-sliders::-webkit-slider-thumb {
background-color: blue; /* Change the color as desired */
}
</style>
<script src="https://docs.opencv.org/master/opencv.js"></script>
Expand Down
6 changes: 4 additions & 2 deletions example.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ author: "John Doe"
format: revealjs
---

## Microscope slide
## Micrograph result

{{< micrograph ./resources/MAX_240329_PC3_Rab_Anti_FlagTag_647_E300_I300_Phallodin_594_E100_I500_DAPI_E300_I300_1_MMStack_Pos0.ome.jpg 255 DAPI Phalloidin anti-FLAG >}}
{{< micrograph ./resources/MAX_240329_PC3_Rab_Anti_FlagTag_647_E300_I300_Phallodin_594_E100_I500_DAPI_E300_I300_1_MMStack_Pos0.ome.jpg DAPI Phalloidin anti-FLAG width="255" >}}

- **Primary antibody:** 1:1000 overnight
- **Secondary antibody:** 1:1000 for 1h

0 comments on commit 7496b81

Please sign in to comment.