Commit 4f440925 authored by Christian Tischer's avatar Christian Tischer

Merge branch 'protocol-binarisation-jython' into 'master'

Protocol binarisation jython

See merge request grp-bio-it/image-analysis-training-resources!13
parents 96da473e 457df17e
Pipeline #9766 passed with stages
in 1 minute and 5 seconds
...@@ -40,17 +40,12 @@ shift [fontcolor=white,color=white]; ...@@ -40,17 +40,12 @@ shift [fontcolor=white,color=white];
![binarization_figure_00](/figures/binarization_concept_example.png) ![binarization_figure_00](/figures/binarization_concept_example.png)
## Activity ## Activity
<details open>
<summary>Jython script</summary>
<br>
```python
from ij import IJ, ImagePlus
from ij.plugin import Thresholder
Open an image and binarize it by applying a threshold. Open an image and binarize it by applying a threshold.
<details> <details>
<summary>ImageJ user interface</summary> <summary>ImageJ user interface</summary>
- `Open...` - `Open...`
- "/image-analysis-training-resources/image_data/xy_8bit__two_cells.tif"; - "/image-analysis-training-resources/image_data/xy_8bit__two_cells.tif";
- `Threshold...` - `Threshold...`
...@@ -58,6 +53,7 @@ Open an image and binarize it by applying a threshold. ...@@ -58,6 +53,7 @@ Open an image and binarize it by applying a threshold.
<details> <details>
<summary>ImageJ macro</summary> <summary>ImageJ macro</summary>
open("/image-analysis-training-resources/image_data/xy_8bit__two_cells.tif"); open("/image-analysis-training-resources/image_data/xy_8bit__two_cells.tif");
setThreshold(30, 255); setThreshold(30, 255);
setOption("BlackBackground", true); setOption("BlackBackground", true);
...@@ -65,16 +61,22 @@ Open an image and binarize it by applying a threshold. ...@@ -65,16 +61,22 @@ Open an image and binarize it by applying a threshold.
</details> </details>
<details>
<summary>Jython script</summary>
```
from ij import IJ, ImagePlus
from ij.plugin import Thresholder
inputImage=IJ.getImage() inputImage=IJ.getImage()
IJ.setRawThreshold(inputImage, 60, 255, None) IJ.setRawThreshold(inputImage, 60, 255, None)
binaryImage=ImagePlus('Binary image',Thresholder.createMask(inputImage)) binaryImage=ImagePlus('Binary image',Thresholder.createMask(inputImage))
binaryImage.show() binaryImage.show()
``` ```
</details> </details>
## Formative assessment ## Formative assessment
...@@ -87,5 +89,4 @@ Quizz or something ...@@ -87,5 +89,4 @@ Quizz or something
## Learn more ## Learn more
External links... External links...
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment