Commit 1d3f039
✨ Add Support for
Adds support to importing objects from QuPath (and other applications) easier.
If you export some objects in .geojson from some versions of QuPath, and they have measurements, all the measurements are in a 'measurements' property in the geojson. This means, when these are imported into annotation store, it will import fine but the properties dict will look something like:
`properties = {a couple other props, "measurements": [{'name': 'propA', 'value': valA}, {'name': 'propB', 'value': valB}, etc]}`
Which is awkward for many downstream things with the nested data structure, and doesn't really mesh with how annotations are intended to be represented in the store (usually a flat dict of properties unless there's a very good reason for nesting).
This commit adds an option to provide a transform to deal with any application-specific formatting, which for example can be used to unpack measurements when importing from QuPath to give instead in a properties dict with the measurement properties unpacked:
`properties = {a couple other props, 'propA': valA, 'propB': valB, etc}`
Importing from QuPath is probably one of the main use-cases for this, and an example is provided in the docstring for this case, but the additional flexibility means it can be used for other use-cases too.
---------
Co-authored-by: Shan E Ahmed Raza <[email protected]>QuPath Annotation Imports (#721)1 parent 890e5a3 commit 1d3f039
File tree
2 files changed
+110
-5
lines changed- tests
- tiatoolbox/annotation
2 files changed
+110
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2823 | 2823 | | |
2824 | 2824 | | |
2825 | 2825 | | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
| 2852 | + | |
| 2853 | + | |
| 2854 | + | |
| 2855 | + | |
| 2856 | + | |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1724 | 1724 | | |
1725 | 1725 | | |
1726 | 1726 | | |
| 1727 | + | |
1727 | 1728 | | |
1728 | 1729 | | |
1729 | 1730 | | |
| |||
1736 | 1737 | | |
1737 | 1738 | | |
1738 | 1739 | | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
1739 | 1745 | | |
1740 | 1746 | | |
1741 | 1747 | | |
1742 | 1748 | | |
1743 | 1749 | | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
1744 | 1768 | | |
1745 | 1769 | | |
1746 | | - | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
1747 | 1782 | | |
1748 | 1783 | | |
1749 | 1784 | | |
1750 | 1785 | | |
1751 | 1786 | | |
1752 | 1787 | | |
1753 | 1788 | | |
| 1789 | + | |
1754 | 1790 | | |
1755 | 1791 | | |
1756 | 1792 | | |
| |||
1765 | 1801 | | |
1766 | 1802 | | |
1767 | 1803 | | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
1768 | 1809 | | |
1769 | 1810 | | |
1770 | 1811 | | |
| |||
1789 | 1830 | | |
1790 | 1831 | | |
1791 | 1832 | | |
1792 | | - | |
1793 | | - | |
1794 | | - | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
1795 | 1839 | | |
1796 | | - | |
1797 | 1840 | | |
1798 | 1841 | | |
1799 | 1842 | | |
| |||
0 commit comments