Skip to content
Snippets Groups Projects
Commit af869360 authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

Added ImageJ example

parent 9f49ce9e
No related branches found
No related tags found
No related merge requests found
import os
import sys
from ij import IJ
from ij.plugin.filter import ParticleAnalyzer
from ij.plugin.frame import Recorder, RoiManager
sys.path.append(
os.path.join(
os.path.expanduser('~'), 'model_server', 'source', 'model_server', 'clients'
)
)
from imagej.adapter import run_request_sequence
import ilastik_map_objects_simple
from ij import IJ
params = {
'pixel_classifier_path': 'c:/Users/rhodes/projects/proj0011-plankton-seg/exp0019/px-03.ilp',
'object_classifier_path': 'c:/Users/rhodes/projects/proj0011-plankton-seg/exp0019/obj-07.ilp',
'debug': True,
'channel': 4, # zero-index
'object_class': 3
}
IJ.run('Remove Overlay')
imp_czi = IJ.getImage()
imp_obmap = run_request_sequence(
imp_czi,
ilastik_map_objects_simple.main,
params,
)
# transfer objects of specified class to image's overlay
imp_obmap.show()
IJ.run(imp_obmap, "glasbey on dark", "")
IJ.setThreshold(imp_obmap, params['object_class'], params['object_class'])
rm = RoiManager.getRoiManager()
Recorder.setBlackBackground()
imp_obmap.createThresholdMask()
rm.reset()
IJ.run(imp_obmap, "Analyze Particles...", "display exclude clear include add")
rm.run('Show All')
rm.moveRoisToOverlay(imp_czi)
if not params['debug']:
imp_obmap.close()
imp_czi.show()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment