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

Consolidating RoiSet test data into base test configuration

parent 0a3039fa
No related branches found
No related tags found
No related merge requests found
......@@ -59,5 +59,23 @@ ilastik_classifiers = {
'seg_to_obj': root / 'ilastik' / 'demo_obj_seg.ilp',
}
roiset_test_data = {
'multichannel_zstack': {
'path': root / 'zmask-test-stack-chlorophyl.tif',
'w': 512,
'h': 512,
'c': 5,
'z': 7,
'mask_path': root / 'zmask-test-stack-mask.tif',
},
'pipeline_params': {
'segmentation_channel': 0,
'patches_channel': 4,
'pxmap_channel': 0,
'pxmap_threshold': 0.6,
},
'pixel_classifier': root / 'zmask' / 'AF405-bodies_boundaries.ilp',
}
output_path = root / 'testing_output'
output_path.mkdir(parents=True, exist_ok=True)
\ No newline at end of file
from pathlib import Path
root = Path.home() / 'model_server'
multichannel_zstack = {
'path': root / 'testing' / 'zmask-test-stack-chlorophyl.tif',
'w': 512,
'h': 512,
'c': 5,
'z': 7,
'mask_path': root / 'testing' / 'zmask-test-stack-mask.tif',
}
pixel_classifier = {
'path': root / 'testing' / 'zmask' / 'AF405-bodies_boundaries.ilp'
}
pipeline_params = {
'segmentation_channel': 0,
'patches_channel': 4,
'pxmap_channel': 0,
'pxmap_threshold': 0.6,
}
output_path = root / 'testing' / 'output' / 'chaeo'
output_path.mkdir(parents=True, exist_ok=True)
\ No newline at end of file
......@@ -2,24 +2,20 @@ import unittest
from model_server.base.models import DummyInstanceSegmentationModel
from model_server.base.roiset import RoiSetMetaParams, RoiSetExportParams
from model_server.conf.testing import output_path
from model_server.extensions.chaeo.conf.testing import multichannel_zstack, pipeline_params
from model_server.conf.testing import output_path, roiset_test_data
from model_server.extensions.chaeo.workflows import infer_object_map_from_zstack
from model_server.extensions.ilastik.models import IlastikPixelClassifierModel
from tests.test_roiset import BaseTestRoiSetMonoProducts
class TestRoiSetWorkflow(BaseTestRoiSetMonoProducts, unittest.TestCase):
def test_object_map_workflow(self):
pp = pipeline_params
models = [
self.pxmodel,
DummyInstanceSegmentationModel(),
]
pp = roiset_test_data['pipeline_params']
models = {
'pixel_classifier': {
'model': self.pxmodel,
'model': IlastikPixelClassifierModel(params={'project_file': roiset_test_data['pixel_classifier']}),
'params': {
'px_class': 0,
'px_prob_threshold': 0.6,
......@@ -61,7 +57,7 @@ class TestRoiSetWorkflow(BaseTestRoiSetMonoProducts, unittest.TestCase):
})
infer_object_map_from_zstack(
multichannel_zstack['path'],
roiset_test_data['multichannel_zstack']['path'],
output_path / 'roiset' / 'workflow',
models,
segmentation_channel=pp['segmentation_channel'],
......
......@@ -268,4 +268,6 @@ class TestIlastikOverApi(TestServerBaseClass):
)
self.assertEqual(resp_infer.status_code, 200, resp_infer.content.decode())
# TODO: test IlastikObjectClassifierFromSegmentationModel when a test model is complete
\ No newline at end of file
class TestIlastikObjectClassification(unittest.TestCase):
def setUp(self):
pass
......@@ -3,22 +3,21 @@ import unittest
import numpy as np
from pathlib import Path
from model_server.conf.testing import output_path
from model_server.conf.testing import output_path, roiset_test_data
from model_server.extensions.chaeo.conf.testing import multichannel_zstack, pixel_classifier, pipeline_params
from model_server.base.roiset import RoiSetMetaParams
from model_server.base.roiset import _get_label_ids, RoiSet
from model_server.base.accessors import generate_file_accessor, InMemoryDataAccessor, write_accessor_data_to_file
from model_server.extensions.ilastik.models import IlastikPixelClassifierModel
from model_server.base.models import DummyInstanceSegmentationModel
class BaseTestRoiSetMonoProducts(object):
def setUp(self) -> None:
# set up test raw data and segmentation from file
self.stack = generate_file_accessor(multichannel_zstack['path'])
self.stack_ch_pa = self.stack.get_one_channel_data(pipeline_params['patches_channel'])
self.seg_mask = generate_file_accessor(multichannel_zstack['mask_path'])
self.stack = generate_file_accessor(roiset_test_data['multichannel_zstack']['path'])
self.stack_ch_pa = self.stack.get_one_channel_data(roiset_test_data['pipeline_params']['patches_channel'])
self.seg_mask = generate_file_accessor(roiset_test_data['multichannel_zstack']['mask_path'])
class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
......
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