<s> from ilastik . core . projectClass import Project <EOL> from ilastik . core . testThread import TestHelperFunctions <EOL> from ilastik . modules . automatic_segmentation . core . automaticSegmentationMgr import AutomaticSegmentationModuleMgr <EOL> import unittest <EOL> from ilastik . core import dataImpex <EOL> from ilastik . core import jobMachine <EOL> from ilastik import __path__ as ilastikpath <EOL> from ilastik . core . testThread import setUp , tearDown <EOL> class AutomaticSegmentationTestProject ( object ) : <EOL> def __init__ ( self , image_filename , borderOverlay_filename , groundtruth_filename ) : <EOL> self . image_filename = image_filename <EOL> self . borderOverlay_filename = borderOverlay_filename <EOL> self . groundtruth_filename = groundtruth_filename <EOL> self . testdir = ilastikpath [ <NUM_LIT:0> ] + "<STR_LIT>" <EOL> from ilastik . core . randomSeed import RandomSeed <EOL> RandomSeed . setRandomSeed ( <NUM_LIT> ) <EOL> self . project = Project ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . dataMgr = self . project . dataMgr <EOL> path = str ( self . testdir + self . image_filename ) <EOL> fileList = [ ] <EOL> fileList . append ( path ) <EOL> self . project . addFile ( fileList ) <EOL> self . automaticSegmentationMgr = AutomaticSegmentationModuleMgr ( self . dataMgr ) <EOL> self . inputOverlays = [ ] <EOL> self . inputOverlays . append ( self . dataMgr [ self . dataMgr . _activeImageNumber ] . overlayMgr [ "<STR_LIT>" ] ) <EOL> self . border_indicator_ov = dataImpex . DataImpex . importOverlay ( self . dataMgr [ self . dataMgr . _activeImageNumber ] , str ( self . testdir + borderOverlay_filename ) , "<STR_LIT>" ) <EOL> self . input = self . border_indicator_ov . _data [ <NUM_LIT:0> , : , : , : , <NUM_LIT:0> ] <EOL> self . input = self . automaticSegmentationMgr . normalizePotential ( self . input ) <EOL> self . input = self . automaticSegmentationMgr . invertPotential ( self . input ) <EOL> self . input = self . automaticSegmentationMgr . invertPotential ( self . input ) <EOL> self . listOfResultOverlays = [ ] <EOL> self . listOfFilenames = [ ] <EOL> self . listOfResultOverlays . append ( "<STR_LIT>" ) <EOL> self . listOfFilenames . append ( self . testdir + self . groundtruth_filename ) <EOL> class TestWholeModuleNormal2D ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . testProject = AutomaticSegmentationTestProject ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> def test_WholeModule ( self ) : <EOL> self . testProject . automaticSegmentationMgr . computeResults ( self . testProject . input ) <EOL> self . testProject . automaticSegmentationMgr . finalizeResults ( ) <EOL> equalOverlays = TestHelperFunctions . compareResultsWithFile ( self . testProject . automaticSegmentationMgr , self . testProject . listOfResultOverlays , self . testProject . listOfFilenames ) <EOL> self . assertEqual ( equalOverlays , True ) <EOL> class TestWholeModuleInverted2D ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . testProject = AutomaticSegmentationTestProject ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> def test_WholeModule ( self ) : <EOL> self . testProject . automaticSegmentationMgr . computeResults ( self . testProject . input ) <EOL> self . testProject . automaticSegmentationMgr . finalizeResults ( ) <EOL> equalOverlays = TestHelperFunctions . compareResultsWithFile ( self . testProject . automaticSegmentationMgr , self . testProject . listOfResultOverlays , self . testProject . listOfFilenames ) <EOL> self . assertEqual ( equalOverlays , True ) <EOL> class TestWholeModuleNormal3D ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . testProject = AutomaticSegmentationTestProject ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> def test_WholeModule ( self ) : <EOL> self . testProject . automaticSegmentationMgr . computeResults ( self . testProject . input ) <EOL> self . testProject . automaticSegmentationMgr . finalizeResults ( ) <EOL> equalOverlays = TestHelperFunctions . compareResultsWithFile ( self . testProject . automaticSegmentationMgr , self . testProject . listOfResultOverlays , self . testProject . listOfFilenames ) <EOL> self . assertEqual ( equalOverlays , True ) <EOL> class TestWholeModuleInverted3D ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . testProject = AutomaticSegmentationTestProject ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> def test_WholeModule ( self ) : <EOL> self . testProject . automaticSegmentationMgr . computeResults ( self . testProject . input ) <EOL> self . testProject . automaticSegmentationMgr . finalizeResults ( ) <EOL> equalOverlays = TestHelperFunctions . compareResultsWithFile ( self . testProject . automaticSegmentationMgr , self . testProject . listOfResultOverlays , self . testProject . listOfFilenames ) <EOL> self . assertEqual ( equalOverlays , True ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
