def test_STICA(): ds = ImagingDataset.load(example_data()) method = segment.STICA(components=5) method.append(segment.SparseROIsFromMasks(min_size=50)) method.append(segment.SmoothROIBoundaries(radius=3)) method.append(segment.MergeOverlapping(0.5)) ds.segment(method)
def test_STICA(): ds = ImagingDataset.load(example_data()) method = segment.STICA(components=5) method.append(segment.SparseROIsFromMasks(min_size=50)) method.append(segment.SmoothROIBoundaries(tolerance=1, min_verts=8)) method.append(segment.MergeOverlapping(0.5)) ds.segment(method)
def test_hmm_tmp(self): # TODO: remove when displacements.pkl is updated global tmp_dir frames = Sequence.create('TIFF', example_tiff()) with warnings.catch_warnings(): warnings.filterwarnings("ignore", category=DeprecationWarning) corrected = self.hm2d.correct( [frames], os.path.join(tmp_dir, 'test_hmm_2.sima')) with open(misc.example_data() + '/displacements.pkl', 'rb') as fh: displacements = [d.reshape((20, 1, 128, 2)) for d in pickle.load(fh)] displacements_ = [seq.displacements for seq in corrected] assert_(abs(displacements_[0] - displacements[0]).max() <= 1)
def test_hmm(self): global tmp_dir frames = Sequence.create('TIFF', example_tiff()) with warnings.catch_warnings(): warnings.filterwarnings("ignore", category=DeprecationWarning) corrected = self.hm2d.correct( [frames], os.path.join(tmp_dir, 'test_hmm.sima')) with open(misc.example_data() + '/displacements.pkl', 'rb') as fh: displacements = [d.reshape((20, 1, 128, 2)) for d in pickle.load(fh)] displacements_ = [seq.displacements for seq in corrected] assert_almost_equal(displacements_, displacements)
def test_hmm_tmp(self): # TODO: remove when displacements.pkl is updated global tmp_dir frames = Sequence.create('TIFF', example_tiff()) with warnings.catch_warnings(): warnings.filterwarnings("ignore", category=DeprecationWarning) corrected = self.hm2d.correct( [frames], os.path.join(tmp_dir, 'test_hmm_2.sima')) with open(misc.example_data() + '/displacements.pkl', 'rb') as fh: displacements = [d.reshape((20, 1, 128, 2)) for d in pickle.load(fh)] displacements_ = [seq.displacements for seq in corrected] diffs = displacements_[0] - displacements[0] assert_( ((diffs - diffs.mean(axis=2).mean(axis=1).mean(axis=0)) > 1).mean() <= 0.001)
def test_PlaneCA1PC(): ds = ImagingDataset.load(example_data())[:, :, :, :50, :50] method = segment.PlaneCA1PC(num_pcs=5) ds.segment(method)
def test_PlaneNormalizedCuts(): ds = ImagingDataset.load(example_data())[:, :, :, :50, :50] affinty_method = segment.BasicAffinityMatrix(num_pcs=5) method = segment.PlaneWiseSegmentation( segment.PlaneNormalizedCuts(affinty_method)) ds.segment(method)
def test_STICA(): ds = ImagingDataset.load(example_data()) method = segment.STICA(components=5) ds.segment(method)
def test_PlaneSTICA(): ds = ImagingDataset.load(example_data()) method = segment.PlaneSTICA(components=5) ds.segment(method)