diff --git a/clients/__init__.py b/clients/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/clients/imagej/.idea/.gitignore b/clients/imagej/.idea/.gitignore deleted file mode 100644 index 26d33521af10bcc7fd8cea344038eaaeb78d0ef5..0000000000000000000000000000000000000000 --- a/clients/imagej/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/clients/imagej/.idea/imagej.iml b/clients/imagej/.idea/imagej.iml deleted file mode 100644 index d0876a78d06ac03b5d78c8dcdb95570281c6f1d6..0000000000000000000000000000000000000000 --- a/clients/imagej/.idea/imagej.iml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module type="PYTHON_MODULE" version="4"> - <component name="NewModuleRootManager"> - <content url="file://$MODULE_DIR$" /> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - </component> -</module> \ No newline at end of file diff --git a/clients/imagej/.idea/inspectionProfiles/Project_Default.xml b/clients/imagej/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 4b7439eb893169c8d26bba41b6b1722e5c8fe1a3..0000000000000000000000000000000000000000 --- a/clients/imagej/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,12 +0,0 @@ -<component name="InspectionProjectProfileManager"> - <profile version="1.0"> - <option name="myName" value="Project Default" /> - <inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true"> - <option name="ignoredIdentifiers"> - <list> - <option value="requests.models.Response.__getitem__" /> - </list> - </option> - </inspection_tool> - </profile> -</component> \ No newline at end of file diff --git a/clients/imagej/.idea/inspectionProfiles/profiles_settings.xml b/clients/imagej/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2da2d6447d11dfe32bfb846c3d5b199fc99..0000000000000000000000000000000000000000 --- a/clients/imagej/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ -<component name="InspectionProjectProfileManager"> - <settings> - <option name="USE_PROJECT_PROFILE" value="false" /> - <version value="1.0" /> - </settings> -</component> \ No newline at end of file diff --git a/clients/imagej/.idea/misc.xml b/clients/imagej/.idea/misc.xml deleted file mode 100644 index 42a3a57d4ad17e847fa7223b338beb87f991ad62..0000000000000000000000000000000000000000 --- a/clients/imagej/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="ProjectRootManager" version="2" project-jdk-name="Python 2.7 (2)" project-jdk-type="Python SDK" /> -</project> \ No newline at end of file diff --git a/clients/imagej/.idea/modules.xml b/clients/imagej/.idea/modules.xml deleted file mode 100644 index f95153e75e8fc539d4eda20668ee4ddc6221cf6b..0000000000000000000000000000000000000000 --- a/clients/imagej/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="ProjectModuleManager"> - <modules> - <module fileurl="file://$PROJECT_DIR$/.idea/imagej.iml" filepath="$PROJECT_DIR$/.idea/imagej.iml" /> - </modules> - </component> -</project> \ No newline at end of file diff --git a/clients/imagej/.idea/vcs.xml b/clients/imagej/.idea/vcs.xml deleted file mode 100644 index b2bdec2d71b6a5ce4ae49efc37516809c50e4d5e..0000000000000000000000000000000000000000 --- a/clients/imagej/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="VcsDirectoryMappings"> - <mapping directory="$PROJECT_DIR$/../.." vcs="Git" /> - </component> -</project> \ No newline at end of file diff --git a/clients/imagej/__init__.py b/clients/imagej/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/clients/imagej/client.py b/clients/imagej/client.py deleted file mode 100644 index cd8636beb3316067e358405927ac7544b6f7378b..0000000000000000000000000000000000000000 --- a/clients/imagej/client.py +++ /dev/null @@ -1,26 +0,0 @@ -import httplib -import json -import urllib - -import sys -print(sys.version) - -HOST = '127.0.0.1' -PORT = 8000 -uri = 'http://{}:{}/'.format(HOST, PORT) - -def hit_endpoint(method, endpoint, params=None, verbose=False): - connection = httplib.HTTPConnection(HOST, PORT) - if not method in ['GET', 'PUT']: - raise Exception('Can only handle GET and PUT requests') - if params: - url = endpoint + '?' + urllib.urlencode(params) - else: - url = endpoint - connection.request(method, url) - resp = connection.getresponse() - resp_str = resp.read() - if verbose: - print(method + ' ' + url + ', status ' + str(resp.status) + ':\n' + resp_str) - return json.loads(resp_str) - diff --git a/clients/imagej/example.py b/clients/imagej/example.py deleted file mode 100644 index 67a50e33f06c2ddaf497d5708b0dfbf4690a5bfe..0000000000000000000000000000000000000000 --- a/clients/imagej/example.py +++ /dev/null @@ -1,53 +0,0 @@ -import os -import sys - -from ij import IJ - -# 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 -#) diff --git a/clients/imagej/ilastik_obmaps.py b/clients/imagej/ilastik_obmaps.py deleted file mode 100644 index e74102d78283e57005bf551d4002ee1b9474bb3c..0000000000000000000000000000000000000000 --- a/clients/imagej/ilastik_obmaps.py +++ /dev/null @@ -1,121 +0,0 @@ -from client import hit_endpoint -from os.path import basename, dirname - -from ij import IJ -from ij import ImagePlus - -def setup(where, px_ilp): - # configure input and output paths - resp = hit_endpoint( - 'PUT', - '/paths/watch_input', - { - 'path': where, - } - ) - assert resp.status_code == 200, 'Error setting up image directory' - resp = hit_endpoint( - 'PUT', - '/paths/watch_output', - { - 'path': where, - } - ) - assert resp.status_code == 200, 'Error setting up image directory' - - # load pixel classifier - resp = hit_endpoint( - 'PUT', - '/ilastik/pixel_classification/load/', - { - 'project_file': px_ilp, - 'duplicate': False, - }, - ) - assert resp.status_code == 200, 'Error loading pixel classifier: ' + {px_ilp} - return resp['model_id'] - - -def ilastik_map_objects_simple(imp, px_ilp, ob_ilp, channel): - """ - - :param pixel_classifier: (str) - :param object_classifier: (str) - :return: ImagePlus - """ - # get info from input ImagePlus - abspath = imp.getProp('Location') - - # assert imp is not z-stack - id_px_mod = setup(dirname(abspath), px_ilp) - - # load object classifier - resp = hit_endpoint( - 'PUT', '/ilastik/pxmap_to_obj/load/', - { - 'project_file': ob_ilp, - 'duplicate': False, - }, - ) - assert resp.status_code == 200, 'Error loading object classifier: ' + {ob_ilp} - id_ob_mod = resp['model_id'] - - # run inference - resp = hit_endpoint( - 'PUT', - '/ilastik/pixel_then_object_classification/infer', - { - 'px_model_id': id_px_mod, - 'ob_model_id': id_ob_mod, - 'input_filename': basename(abspath), - 'channel': channel, - } - ) - assert resp.status_code == 200, 'Error calling workfow' - obmap = resp.json()['object_map_filepath'] - - return obmap # obviously need imp - -def ilastik_map_objects_with_zmask(imp, px_ilp, ob_ilp, pxmap_threshold, pxmap_foreground_channel, segmentation_channel, patches_channel, zmask_filters): - """ - - :param pixel_classifier: (str) - :param object_classifier: (str) - :return: ImagePlus - """ - # get info from input ImagePlus - abspath = imp.getProp('Location') - - # assert imp is not z-stack - id_px_mod = setup(dirname(abspath), px_ilp) - - # load object classifier - resp = hit_endpoint( - 'PUT', '/ilastik/seg_to_obj/load/', - { - 'project_file': ob_ilp, - 'duplicate': False, - }, - ) - assert resp.status_code == 200, 'Error loading object classifier: ' + {ob_ilp} - id_ob_mod = resp['model_id'] - - # run inference - resp = hit_endpoint( - 'PUT', - '/chaeo/classify_zstack/infer', - { - 'px_model_id': id_px_mod, - 'ob_model_id': id_ob_mod, - 'input_filename': basename(abspath), - 'pxmap_threshold': pxmap_threshold, - 'pxmap_foreground_channel': pxmap_foreground_channel, - 'segmentation_channel': segmentation_channel, - 'patches_channel': patches_channel, - 'zmask_filters': zmask_filters, - } - ) - assert resp.status_code == 200, 'Error calling workfow' - obmap = resp.json()['output_path'] - - return obmap # obviously need imp diff --git a/clients/readme.md b/clients/readme.md deleted file mode 100644 index 2c49d8f57339dc141633b62fe67fcc7ffd6f9d6f..0000000000000000000000000000000000000000 --- a/clients/readme.md +++ /dev/null @@ -1,2 +0,0 @@ -The clients.imagej package tracks client scripts and their dependencies, which are intended to run inside ImageJ's -Jython interpreter. \ No newline at end of file