File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed
src/faim_wako_searchfirst Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ dependencies = [
3131 " confuse" ,
3232 " rich" ,
3333 " scikit-image" ,
34+ " scyjava" ,
3435 " tqdm" ,
3536 " typer"
3637]
Original file line number Diff line number Diff line change @@ -72,3 +72,25 @@ def cellpose(
7272 ** kwargs ,
7373 )
7474 return mask
75+
76+
77+ def weka_classifier (
78+ img ,
79+ classifier_path : Path ,
80+ logger = logging ,
81+ ):
82+ """Apply a classifier.model file.
83+
84+ Use Trainable Weka Segmentation (via pyimagej)
85+ to apply a trained classifier to the input image.
86+ """
87+ # initialize imagej
88+ import imagej
89+
90+ ij = imagej .init ("sc.fiji:fiji:2.15.0" )
91+ assert ij is not None
92+ # convert img to_java
93+ # call WekaSegmentation API
94+ # get result imp
95+ # convert imp from_java
96+ return ij .getVersion ()
Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: 2024 Friedrich Miescher Institute for Biomedical Research (FMI), Basel (Switzerland)
2+ #
3+ # SPDX-License-Identifier: MIT
4+ """Test segment.weka_classifier functionality."""
5+ from faim_wako_searchfirst .segment import weka_classifier
6+
7+
8+ def test_weka_classifier ():
9+ """Directly call weka_classifier."""
10+ version = weka_classifier (None , None )
11+ assert version == "2.15.0/1.54f"
You can’t perform that action at this time.
0 commit comments