MCPcopy
hub / github.com/mne-tools/mne-python / test_split_label

Function test_split_label

mne/tests/test_label.py:739–833  ·  view source on GitHub ↗

Test splitting labels.

()

Source from the content-addressed store, hash-verified

737
738@testing.requires_testing_data
739def test_split_label():
740 """Test splitting labels."""
741 pytest.importorskip("nibabel")
742 pytest.importorskip("sklearn")
743 aparc = read_labels_from_annot(
744 "fsaverage", "aparc", "lh", regexp="lingual", subjects_dir=subjects_dir
745 )
746 lingual = aparc[0]
747
748 # Test input error
749 pytest.raises(ValueError, lingual.split, "bad_input_string")
750
751 # split with names
752 parts = ("lingual_post", "lingual_ant")
753 post, ant = split_label(lingual, parts, subjects_dir=subjects_dir)
754
755 # check output names
756 assert_equal(post.name, parts[0])
757 assert_equal(ant.name, parts[1])
758
759 # check vertices add up
760 lingual_reconst = post + ant
761 lingual_reconst.name = lingual.name
762 lingual_reconst.comment = lingual.comment
763 lingual_reconst.color = lingual.color
764 assert_labels_equal(lingual_reconst, lingual)
765
766 # compare output of Label.split() method
767 post1, ant1 = lingual.split(parts, subjects_dir=subjects_dir)
768 assert_labels_equal(post1, post)
769 assert_labels_equal(ant1, ant)
770
771 # compare fs_like split with freesurfer split
772 antmost = split_label(lingual, 40, None, subjects_dir, True)[-1]
773 fs_vert = [
774 210,
775 4401,
776 7405,
777 12079,
778 16276,
779 18956,
780 26356,
781 32713,
782 32716,
783 32719,
784 36047,
785 36050,
786 42797,
787 42798,
788 42799,
789 59281,
790 59282,
791 59283,
792 71864,
793 71865,
794 71866,
795 71874,
796 71883,

Callers

nothing calls this directly

Calls 5

read_labels_from_annotFunction · 0.90
split_labelFunction · 0.90
read_labelFunction · 0.90
assert_labels_equalFunction · 0.85
splitMethod · 0.80

Tested by

no test coverage detected