Newer
Older
import os
import sys

Christopher Randolph Rhodes
committed
from ij import IJ
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# add directory of current script to search path
scripts_dir = os.path.dirname(sys.argv[0])
sys.path.append(scripts_dir)
from ilastik_obmaps import ilastik_map_objects_simple
CHANNEL_TO_ILASTIK = 1 # i.e. index of color channel from confocal stack
OBJECT_CLASS_FOR_PHOTOACTIVATION = 1
ROOT = 'c:/Users/rhodes/projects/proj0004-marine-photoactivation/data/exp0021/'
PIXEL_CLASSIFIER_PATH = ROOT + 'ilastik/px-01.ilp'
OBJECT_CLASSIFIER_PATH = ROOT + 'ilastik/obj-04.ilp'
DEBUG = True
#obmap = ilastik_map_objects_simple(
# IJ.getImage(),
# PIXEL_CLASSIFIER_PATH,
# OBJECT_CLASSIFIER_PATH,
# CHANNEL_TO_ILASTIK
#)
# pipeline: remove any existing overlay
IJ.run("Remove Overlay")
resp = hit_endpoint(
'GET',
'/ilastik/pixel_then_object_classification/infer',
{
'px_model_id': id_px_mod,
'ob_model_id': id_ob_mod,
'input_filename': basename(abspath),
'channel': channel,
}
)
imp_czi = IJ.getImage()
#czi_fn = imp_czi.getTitle()
#czi_desc = czi_fn.split('.')[0]
#imp_czi.setDisplayMode(IJ.GRAYSCALE)
IJ.run("Make Subset...", "channels=" + str(CHANNEL_TO_ILASTIK))
imp_to_ilastik = IJ.getImage()
#obmap = ilastik_map_objects_simple(
# imp_to_ilastik,
# PIXEL_CLASSIFIER_PATH,
# OBJECT_CLASSIFIER_PATH,
# CHANNEL_TO_ILASTIK
#)