Beispiel #1
0
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)
Beispiel #2
0
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)
Beispiel #3
0
 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)
Beispiel #4
0
    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)
Beispiel #5
0
 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)
Beispiel #6
0
    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)
Beispiel #7
0
def test_PlaneCA1PC():
    ds = ImagingDataset.load(example_data())[:, :, :, :50, :50]
    method = segment.PlaneCA1PC(num_pcs=5)
    ds.segment(method)
Beispiel #8
0
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)
Beispiel #9
0
def test_PlaneCA1PC():
    ds = ImagingDataset.load(example_data())[:, :, :, :50, :50]
    method = segment.PlaneCA1PC(num_pcs=5)
    ds.segment(method)
Beispiel #10
0
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)
Beispiel #11
0
def test_STICA():
    ds = ImagingDataset.load(example_data())
    method = segment.STICA(components=5)
    ds.segment(method)
Beispiel #12
0
def test_PlaneSTICA():
    ds = ImagingDataset.load(example_data())
    method = segment.PlaneSTICA(components=5)
    ds.segment(method)