Commit fa085838 authored by Christoph Sommer's avatar Christoph Sommer
Browse files

update docu

parent 7f3bf1fb
......@@ -5,33 +5,35 @@
Morse and Watson (Jonas group, unpublished)
### 1. Convert .ims to .h5 for pixel classification in ilastik
Use the ImageJ macro `ims2h5.ijm` to convert .ims files to ilastik .h5 files. Note,
### 1. Convert your images (.ims; or other) to .h5 for pixel classification in ilastik
Use the ImageJ macro `img2h5.ijm` to convert .ims files to ilastik .h5 files. Note,
that the `ilastik` update site needs to be enabled in Fiji.
Choose a folder with .ims files and a resolution level (default 2; down scaling by factor of 2).
Choose a folder with images and a filetype (e. g. .ims). If your data is stored in
multi-resolution, choose a resolution level (1: original resolution; 2 (default): down scaling by factor of 2).
### 2. Use ilastik pixel classificaiton
Use `Pixel Classification` workflow.
* Choose dendrite class as first class in training (yellow color)
* Make sure probability maps are exported as uint8 and renormalized to 0-255
Note, if the Pixel Classification workflow is not working with your data, try
the `Autocontext` workflow.
### 3. Convert probability maps to dendrite objects and save as .swc for import in Imaris
Command line tool:
#### Command line tool:
Trace dendrite and spine from ilastik dendrite probability maps and output .swc file for import into Imaris
Extract the dentritic spine skeletons graph from ilastik probability maps and export to .swc for import in Imaris
```
usage: ilastik2dendrite.py [-h] [-ms MIN_SIZE] [-rl RESOLUTION_LEVEL]
[-s SMOOTH_SIGMA SMOOTH_SIGMA SMOOTH_SIGMA]
[-t THRESHOLD]
ilastik_h5 [ilastik_h5 ...]
usage: seg2dendrite.py [-h] [-ms MIN_SIZE] [-rl RESOLUTION_LEVEL] [-s SMOOTH_SIGMA SMOOTH_SIGMA SMOOTH_SIGMA]
[-t THRESHOLD]
ilastik_h5 [ilastik_h5 ...]
Extract skeletons from ilastik dendrite probability maps and export to .swc
for import in Imaris
Extract the dentritic spine skeletons graph from ilastik probability maps and export to .swc for import in Imaris
positional arguments:
ilastik_h5 ilastik probability map (single channel) in 8-bit
ilastik_h5 ilastik probability map(s), if not single channel the 1st channel is used. Data type must be
8-bit
optional arguments:
-h, --help show this help message and exit
......@@ -40,11 +42,16 @@ optional arguments:
-rl RESOLUTION_LEVEL, --resolution_level RESOLUTION_LEVEL
Resolution level used
-s SMOOTH_SIGMA SMOOTH_SIGMA SMOOTH_SIGMA, --smooth_sigma SMOOTH_SIGMA SMOOTH_SIGMA SMOOTH_SIGMA
Smooth prob. map before thresholding. Gaussian sigma
in px for ZYX
Smooth probability maps before thresholding. Gaussian sigma in px for ZYX
-t THRESHOLD, --threshold THRESHOLD
Probability map threshold
Probability map threshold in range [0,1].
```
#### Jupyter:
See Jupyter notebook file
### 4. Import results to Imaris
####
Install the [.swc importer](./imaris_swc_impex) as a Imaris Python extension.
#### Example:
After pixel classification with ilastik on resolution level 2, which created a probability map volume_Probabilities.h5, use
......@@ -53,7 +60,7 @@ After pixel classification with ilastik on resolution level 2, which created a p
python ilastik2dendrite.py volume_Probabilities.h5 --smooth 0.5 1 1 --threshold 0.5 -min_sizes 12000 --resolution_level 2
```
it will smooth the probability map with sigma ZYX of 0.5 x 1 x 1 and threshold at probability 0.5, filter dendrite objects for minimum size of 12000.
it will smooth the probability map with sigma ZYX of 0.5 x 1 x 1 and threshold at probability 0.5, filter dendrite objects for minimum size of 12000px.
### ilastik2dendrite.py requires pip installable packages:
Python >3.6
......
......@@ -240,7 +240,7 @@ def run(ilastik_seg_fn, min_size, rl, sigma, thresh):
def get_args():
description = """Extract skeletons from ilastik dendrite probability maps and export to .swc for import in Imaris"""
description = """Extract the dentritic spine skeletons graph from ilastik probability maps and export to .swc for import in Imaris"""
parser = argparse.ArgumentParser(description=description)
......@@ -248,7 +248,7 @@ def get_args():
"ilastik_h5",
nargs="+",
type=str,
help="ilastik probability map (single channel) in 8-bit",
help="ilastik probability map(s), if not single channel the 1st channel is used. Data type must be 8-bit",
)
parser.add_argument(
"-ms",
......@@ -266,11 +266,15 @@ def get_args():
type=float,
nargs=3,
default=(0.5, 0.5, 0.5),
help="Smooth prob. map before thresholding. Gaussian sigma in px for ZYX",
help="Smooth probability maps before thresholding. Gaussian sigma in px for ZYX",
)
parser.add_argument(
"-t", "--threshold", type=float, default=0.5, help="Probability map threshold",
"-t",
"--threshold",
type=float,
default=0.5,
help="Probability map threshold in range [0,1].",
)
args = parser.parse_args()
......
Supports Markdown
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