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

ilastik prereqs run now

parent fa63053b
No related branches found
No related tags found
No related merge requests found
......@@ -13,3 +13,10 @@ multichannel_zstack = {
pixel_classifier = {
'path': root / 'ilastik' / 'AF405-bodies_boundaries.ilp'
}
pipeline_params = {
'threshold': 0.6,
}
output_path = root / 'testing_output' / 'chaeo'
output_path.mkdir(parents=True, exist_ok=True)
\ No newline at end of file
import unittest
from extensions.chaeo.conf.testing import multichannel_zstack, pixel_classifier
from conf.testing import output_path
from extensions.chaeo.conf.testing import multichannel_zstack, pixel_classifier, pipeline_params
from extensions.chaeo.zstack import build_stack_mask
from model_server.accessors import generate_file_accessor, InMemoryDataAccessor
from model_server.accessors import generate_file_accessor, InMemoryDataAccessor, write_accessor_data_to_file
from extensions.ilastik.models import IlastikObjectClassifierModel, IlastikPixelClassifierModel
class TestZStackDerivedDataProducts(unittest.TestCase):
......@@ -12,11 +14,14 @@ class TestZStackDerivedDataProducts(unittest.TestCase):
self.zstack = generate_file_accessor(multichannel_zstack['path'])
pxmodel = IlastikPixelClassifierModel(
project_file=pixel_classifier['path']
{'project_file': pixel_classifier['path']},
)
self.pxmap = None
self.obmap = None
self.stack = None
mip = InMemoryDataAccessor(self.zstack.get_one_channel_data(channel=0).data.max(axis=-1, keepdims=True))
self.pxmap, result = pxmodel.infer(mip)
write_accessor_data_to_file(output_path / 'pxmap.tif', self.pxmap)
self.obmap = InMemoryDataAccessor((self.pxmap.data > pipeline_params['threshold']).astype('uint8'))
write_accessor_data_to_file(output_path / 'obmap.tif', self.obmap)
def test_zmask_makes_correct_boxes(self):
zmask, meta = build_stack_mask(
......
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