PyVisualFields 2.0.7__py3-none-any.whl → 2.0.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -395,12 +395,29 @@ def HAP2_part2_severity(row):
395
395
  return ""
396
396
 
397
397
 
398
+ # def Fn_HAP2_part2(df):
399
+ # df
400
+ # out = df.copy()
401
+ # severity = out.apply(HAP2_part2_severity, axis=1)
402
+ # return pd.concat([out, severity.rename("severity(HAP2_part2)")], axis=1).copy()
403
+
404
+
398
405
  def Fn_HAP2_part2(df):
399
- df
400
406
  out = df.copy()
401
- severity = out.apply(HAP2_part2_severity, axis=1)
402
- return pd.concat([out, severity.rename("severity(HAP2_part2)")], axis=1).copy()
403
407
 
408
+ severity = pd.Series("", index=out.index, dtype=object)
409
+
410
+ mask = out["HAP2_clf"] == "GL"
411
+
412
+ severity.loc[mask] = out.loc[mask].apply(
413
+ HAP2_part2_severity,
414
+ axis=1
415
+ )
416
+
417
+ return pd.concat(
418
+ [out, severity.rename("severity(HAP2_part2)")],
419
+ axis=1
420
+ ).copy()
404
421
 
405
422
 
406
423
  ########################################################
@@ -1 +1 @@
1
- __version__ = "2.0.7"
1
+ __version__ = "2.0.9"
PyVisualFields/utils.py CHANGED
@@ -297,10 +297,14 @@ def investigate_vf_df(df):
297
297
 
298
298
  # ---------- Global indices ----------
299
299
  global_indices = [
300
- "md", "mdprob", "psd", "psdprob", "ght", "vfi",
301
- "msens", "ssens",
302
- "tmd", "tsd",
303
- "pmd", "gh"
300
+ "md", "mdprob", "psd", "psdprob", "ght",
301
+ "vfi","vfiprob",
302
+ "msens", "msensprob"
303
+ "ssens",
304
+ "tmd", "tmdprob"
305
+ "tsd",
306
+ "pmd", "pmdprob"
307
+ "gh", "ghprob"
304
308
  ]
305
309
 
306
310
  info["global_indices"] = {
@@ -1,242 +1,375 @@
1
- Metadata-Version: 2.4
2
- Name: PyVisualFields
3
- Version: 2.0.7
4
- Summary: A python toolkit for visual field analysis
5
- Home-page: https://github.com/mohaEs/PyVisualField
6
- Author: Mohammad Eslami, Bharath Erusalagandi, Mousa Moradi
7
- Author-email: Mohammad_eslami@meei.harvard.edu
8
- License: BSD-3-Clause
9
- Project-URL: Bug Tracker, https://github.com/mohaEs/PyVisualField/issues
10
- Project-URL: Demo Normalization, https://github.com/mohaEs/PyVisualField/blob/main/demo_2_Deviation_Analysis.ipynb
11
- Project-URL: Demo Plotting, https://github.com/mohaEs/PyVisualField/blob/main/demo_3_Plotting.ipynb
12
- Project-URL: Demo Progression Analysis, https://github.com/mohaEs/PyVisualField/blob/main/demo_4_ProgressionAnalysis.ipynb
13
- Project-URL: Demo Data, https://github.com/mohaEs/PyVisualField/blob/main/demo_1_Data.ipynb
14
- Project-URL: Demo Glaucoma Detection, https://github.com/mohaEs/PyVisualField/blob/main/demo5_PyGlaucoMetrics.ipynb
15
- Project-URL: Harvard Ophthalmology AI LAB, https://ophai.hms.harvard.edu/
16
- Classifier: Programming Language :: Python :: 3
17
- Classifier: License :: OSI Approved :: BSD License
18
- Classifier: Operating System :: OS Independent
19
- Requires-Python: >=3.6
20
- Description-Content-Type: text/markdown
21
- License-File: LICENSE
22
- Requires-Dist: numpy
23
- Requires-Dist: pandas
24
- Requires-Dist: scipy
25
- Requires-Dist: matplotlib
26
- Requires-Dist: PyMuPDF
27
- Dynamic: author
28
- Dynamic: author-email
29
- Dynamic: classifier
30
- Dynamic: description
31
- Dynamic: description-content-type
32
- Dynamic: home-page
33
- Dynamic: license
34
- Dynamic: license-file
35
- Dynamic: project-url
36
- Dynamic: requires-dist
37
- Dynamic: requires-python
38
- Dynamic: summary
39
-
40
- # PyVisualFields
41
-
42
- ## A python tool collection for analyzing visual fields
43
-
44
- This packages includes functions for visuald field analysis and display.
45
-
46
- https://pypi.org/project/PyVisualFields/
47
-
48
- Version 2 is R-independent while maintaining the original module organization. The modules are inspired by vfprogression (Elze et al. [1]) and visualFields (Marin-Franch et al. [2]).
49
- Additionally, pyGlaucoMetric has been integrated to enable glaucoma classification based on visual field patterns.
50
-
51
- These functions are implemented in Python, and their functionalities are demonstrated across four primary categories:
52
- - Data Presentation
53
- - Plotting
54
- - Scoring and Progression Analysis
55
- - Normalization Analysis
56
- - Glaucoma Detection
57
-
58
- For each category, we provide comprehensive Jupyter notebooks containing practical examples, detailed function descriptions, required inputs/dependencies, and expected outputs.
59
-
60
- ## Citation
61
- If you found this package impactful for your research, please cite the following article:
62
- - PyVisualFields v2
63
- - Mohammad Eslami, Saber Kazeminasab, Vishal Sharma, Yangjiani Li, Mojtaba Fazli, Mengyu Wang, Nazlee Zebardast, Tobias Elze; PyVisualFields: A Python Package for Visual Field Analysis. Trans. Vis. Sci. Tech. 2023;12(2):6. https://doi.org/10.1167/tvst.12.2.6.
64
-
65
- and of course the corresponding sub-package:
66
- - vfprogression (by Elze et al. [1])
67
- - visualFields (by Marin-Granch et al. [2])
68
- - pyGlaucoMetrics (by Moradi et al. [3])
69
-
70
- ## Installation:
71
-
72
- > pip install PyVisualFields
73
-
74
- ## Demo jupyter notebooks
75
-
76
- The list and description of all functions are available at [All_Functions](#list-of-functions). They are all examined and introduced with examples in 4 different notebooks categorized: </br>
77
- - Data [demo_1_Data.ipynb](demo_1_Data.ipynb)
78
- - Normalization and deviation analysis [demo_2_Deviation_Analysis.ipynb](demo_2_Deviation_Analysis.ipynb)
79
- - Plotting [demo_3_Plotting.ipynb](demo_3_Plotting.ipynb)
80
- - Progression Analysis [demo_4_Analysis.ipynb](demo_4_Analysis.ipynb)
81
- - Glaucoma Detection [demo5_PyGlaucoMetrics.ipynb](demo5_PyGlaucoMetrics.ipynb) </br>
82
-
83
- __Notice:__ PyGlaucoMetric is also available as a seperatre PyPI package and GitHub repository (built upon PyVisualFields), which includes a graphical user interface (GUI) for progression analysis and glaucoma detection. Indeed PyVisualFields is designed as a developer-facing package library, while pyGlaucoMetric serves as an accessible GUI application implementing selected visual field analysis components.
84
- https://github.com/Mousamoradi/PyGlaucoMetrics
85
-
86
-
87
- ## references:
88
- [1] PyVisualFields v2
89
- [2] Mohammad Eslami, Saber Kazeminasab, Vishal Sharma, Yangjiani Li, Mojtaba Fazli, Mengyu Wang, Nazlee Zebardast, Tobias Elze; PyVisualFields: A Python Package for Visual Field Analysis. Trans. Vis. Sci. Tech. 2023;12(2):6. https://doi.org/10.1167/tvst.12.2.6.
90
- [3] https://cran.r-project.org/web/packages/vfprogression/index.html </br>
91
- [4] https://cran.r-project.org/web/packages/visualFields/index.html </br>
92
- [5] Moradi, Mousa, Saber Kazeminasab Hashemabad, Daniel M. Vu, Allison R. Soneru, Asahi Fujita, Mengyu Wang, Tobias Elze, Mohammad Eslami, and Nazlee Zebardast. 2025. "PyGlaucoMetrics: A Stacked Weight-Based Machine Learning Approach for Glaucoma Detection Using Visual Field Data" Medicina 61, no. 3: 541. https://doi.org/10.3390/medicina61030541
93
- </br>
94
-
95
-
96
- ## list of functions
97
- The list and description of all functions are as follow. They are all examined and introduced with examples in 4 different notebooks. It is important to mention that, based on the background modules, the input VF dataframe needs to have columns with special column names. Make sure, to consider the data notebook. If further information is required, see the corresponding references: _vfprogression[1]_, _visualFields[2]_ </br>
98
- - Data [demo_1_Data.ipynb](demo_1_Data.ipynb)
99
- - Normalization and deviation analysis [demo_2_Deviation_Analysis.ipynb](demo_2_Deviation_Analysis.ipynb)
100
- - Plotting [demo_3_Plotting.ipynb](demo_3_Plotting.ipynb)
101
- - Progression Analysis [demo_4_ProgressionAnalysis.ipynb](demo_4_ProgressionAnalysis.ipynb)
102
- - Glaucoma Detection [demo5_PyGlaucoMetrics.ipynb](demo5_PyGlaucoMetrics.ipynb)
103
- </br>
104
-
105
- ### Notice:
106
- Version 2 has been validated exclusively for the 24-2 format. Additionally, the system assumes all visual field measurements are provided in right eye (OD) format.
107
-
108
- Functions based on _vfprogression_ package accept 24-2 or 30-2 visual field measurement while functions based on _visualFields_ also accept 10-2.
109
-
110
-
111
- # Function Reference
112
-
113
- <details>
114
- <summary><b>Data Utilities </b></summary>
115
- ## Data Utilities
116
-
117
- | Function | Description | Reference |
118
- |----------|-------------|--------|
119
- | `utils.canonicalize_vf_df()` | Canonicalize VF data to PyVisualFields format | PyVisualFieldsV2 |
120
- | `utils.canonicalize_vf_df(, sort_byDateAge=True)` | Canonicalize and sort VFs by date/age within each patient | PyVisualFieldsV2 |
121
- | `utils.print_vf_summary()` | Print a summary of available VF information | PyVisualFieldsV2 |
122
- | `utils.investigate_vf_df()` | Return a summary of available VF information | PyVisualFieldsV2 |
123
- | `utils.vf_blocks()` | Identify available VF blocks (`s`, `td`, `pd`, `tdp`, `pdp`) | PyVisualFieldsV2 |
124
- | `utils.missing_blocks()` | Identify missing VF blocks | PyVisualFieldsV2 |
125
- | `utils.compute_missing_blocks()` | Compute missing blocks using current normative setting NV | PyVisualFieldsV2 |
126
- </details>
127
-
128
-
129
- <details>
130
- <summary><b>Example Datasets</b></summary>
131
- ## Example Datasets
132
-
133
- | Function | Description | Reference |
134
- |----------|-------------|--------|
135
- | `visualFields.data_vfpwgRetest24d2()` | Humphrey 24-2 retest dataset | visualFields |
136
- | `visualFields.data_vfctrSunyiu24d2()` | SUNY-IU control dataset | visualFields |
137
- | `visualFields.data_vfpwgSunyiu24d2()` | SUNY-IU glaucoma dataset | visualFields |
138
- | `visualFields.data_vfctrSunyiu10d2()` | SUNY-IU 10-2 control dataset | visualFields |
139
- | `visualFields.data_vfctrIowaPC26()` | Iowa PC26 dataset | visualFields |
140
- | `visualFields.data_vfctrIowaPeri()` | Iowa Peri dataset | visualFields |
141
- | `vfprogression.data_vfseries()` | Longitudinal VF series dataset | vfprogression |
142
- | `vfprogression.data_vfi()` | VFI dataset | vfprogression |
143
- | `vfprogression.data_cigts()` | CIGTS dataset | vfprogression |
144
- | `vfprogression.data_plrnouri2012()` | | vfprogression |
145
- | `vfprogression.data_schell2014()` | | vfprogression |
146
- </details>
147
-
148
-
149
- <details>
150
- <summary><b>Deviation Analysis </b></summary>
151
- ## Deviation Analysis
152
-
153
- | Function | Description | Reference |
154
- |----------|-------------|--------|
155
- | `visualFields.getnv()` | Get current normative environment/setting | visualFields |
156
- | `visualFields.setnv()` | change/set normalization environment based on a predefined NV | visualFields |
157
- | `visualFields.get_info_normvals()` | all avialbale predefined normalization environments/settings | visualFields |
158
- | `visualFields.nvgenerate()` |generate a normalization environment based new data | visualFields |
159
- | `utils.compute_missing_blocks()` | Compute missing blocks ( `td`, `pd`, `tdp`, `pdp`) using current normative setting NV | PyVisualFieldsV2 |
160
- | `visualFields.gettd()` | compute td using current normative setting NV | visualFields |
161
- | `visualFields.gettdp()` | compute tdp using current normative setting NV | visualFields |
162
- | `visualFields.getpd()` | compute pd using current normative setting NV | visualFields |
163
- | `visualFields.getpdp()` | compute pdp using current normative setting NV | visualFields |
164
- | `visualFields.getgh()` | compute general heigh using current normative setting NV | visualFields |
165
- | `visualFields.getgl()` | compute gl (global incices, e.g. msens (MS), tmd (i.e. MD, but weighted mean of TD values), pmd (i.e. weighted mean of PD values) psd, vfi, gh ) using current normative setting NV | visualFields |
166
- | `visualFields.getglp()` | compute gl's probabilities (e.g. mdprob, psdprob) using current normative setting NV | visualFields |
167
- </details>
168
-
169
- <details>
170
- <summary><b>Progression Analysis </b></summary>
171
- ## Progression Analysis
172
-
173
- | Function | Description |Reference |
174
- |----------|-------------|--------|
175
- | `vfprogression.get_score_AGIS()` | Compute AGIS score | vfprogression |
176
- | `vfprogression.get_score_CIGTS()` | Compute CIGTS score | vfprogression |
177
- | `vfprogression.progression_agis()` | AGIS progression analysis | vfprogression |
178
- | `vfprogression.progression_cigts()` | CIGTS progression analysis | vfprogression |
179
- | `vfprogression.progression_vfi()` | VFI progression analysis | vfprogression |
180
- | `vfprogression.progression_plrnouri2012()` | Nouri et al. progression analysis | vfprogression |
181
- | `vfprogression.progression_schell2014()` | Schell et al. progression analysis | vfprogression |
182
- | `visualFields.glr()` | Linear regression with global indices | visualFields |
183
- | `visualFields.plr()` | Pointwise linear regression (PLR) | visualFields |
184
- | `visualFields.poplr()` | PoPLR regression analysis | visualFields |
185
- </details>
186
-
187
-
188
- <details>
189
- <summary><b>Glaucoma Diagnostic</b></summary>
190
-
191
- ## Glaucoma Diagnostic Criteria (PyGlaucoMetrics)
192
-
193
- | Function | Description | Reference |
194
- |----------|-------------|-----------|
195
- | `PyGlaucoMetrics.Fn_HAP2()` | HAP2 glaucoma diagnosis | PyGlaucoMetrics[1,5] |
196
- | `PyGlaucoMetrics.Fn_HAP2_part2()` | HAP2 severity classification | PyGlaucoMetrics[1,5] |
197
- | `PyGlaucoMetrics.Fn_UKGTS()` | UKGTS criteria |PyGlaucoMetrics[1,5] |
198
- | `PyGlaucoMetrics.Fn_LoGTS()` | LoGTS criteria |PyGlaucoMetrics[1,5] |
199
- | `PyGlaucoMetrics.Fn_Foster()` | Foster criteria |PyGlaucoMetrics[1,5] |
200
- | `PyGlaucoMetrics.Fn_Kangs()` | Kang's criteria |PyGlaucoMetrics[1,5] |
201
-
202
- </details>
203
-
204
-
205
- <details>
206
- <summary><b>Visualization Functions</b></summary>
207
- ## Visualization
208
-
209
- | Function | Description |
210
- |----------|-------------|
211
- | `vfprogression.plotValues()` | Plot sensitivity, TD, or PD values |
212
- | `vfprogression.plotProbabilities()` | Plot TDP or PDP probability maps |
213
- | `visualFields.vfplot()` | Generic VF plotting function |
214
- | `visualFields.vfplot_s()` | Sensitivity plot |
215
- | `visualFields.vfplot_td()` | Total deviation plot |
216
- | `visualFields.vfplot_pd()` | Pattern deviation plot |
217
- | `visualFields.vfplotsparklines()` | Sparkline visualization |
218
- | `visualFields.vflegoplot()` | Lego plot visualization |
219
- | `visualFields.plotProbColormap()` | Probability colormap legend |
220
- | `visualFields.vfplotplr()` | |
221
- | `utils.Fn_report()` | Make a report of an eye | PyVisualFieldsV2 |
222
- </details>
223
-
224
-
225
-
226
-
227
- ## Snapshots
228
-
229
- [See Github Repository](https://github.com/mohaEs/PyVisualField)
230
-
231
- <img src="./imgs/1_(12).png" width="50%">
232
- <img src="./imgs/1_(13).png" width="50%">
233
- <img src="./imgs/1_(1).png" width="50%">
234
- <img src="./imgs/1_(2).png" width="50%">
235
- <img src="./imgs/1_(3).png" width="50%">
236
- <img src="./imgs/1_(4).png" width="50%">
237
- <img src="./imgs/1_(5).png" width="50%">
238
- <img src="./imgs/1_(6).png" width="50%">
239
- <img src="./imgs/1_(8).png" width="50%">
240
- <img src="./imgs/1_(7).png" width="50%">
241
- <img src="./imgs/1_(9).png" width="50%">
242
- <img src="./imgs/1_(10).png" width="50%">
1
+ Metadata-Version: 2.4
2
+ Name: PyVisualFields
3
+ Version: 2.0.9
4
+ Summary: A python toolkit for visual field analysis
5
+ Home-page: https://github.com/mohaEs/PyVisualField
6
+ Author: Mohammad Eslami, Bharath Erusalagandi, Mousa Moradi
7
+ Author-email: Mohammad_eslami@meei.harvard.edu
8
+ License: BSD-3-Clause
9
+ Project-URL: Bug Tracker, https://github.com/mohaEs/PyVisualField/issues
10
+ Project-URL: Demo Normalization, https://github.com/mohaEs/PyVisualField/blob/main/demo_2_Deviation_Analysis.ipynb
11
+ Project-URL: Demo Plotting, https://github.com/mohaEs/PyVisualField/blob/main/demo_3_Plotting.ipynb
12
+ Project-URL: Demo Progression Analysis, https://github.com/mohaEs/PyVisualField/blob/main/demo_4_ProgressionAnalysis.ipynb
13
+ Project-URL: Demo Data, https://github.com/mohaEs/PyVisualField/blob/main/demo_1_Data.ipynb
14
+ Project-URL: Demo Glaucoma Detection, https://github.com/mohaEs/PyVisualField/blob/main/demo5_PyGlaucoMetrics.ipynb
15
+ Project-URL: Harvard Ophthalmology AI LAB, https://ophai.hms.harvard.edu/
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: License :: OSI Approved :: BSD License
18
+ Classifier: Operating System :: OS Independent
19
+ Requires-Python: >=3.6
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: numpy
23
+ Requires-Dist: pandas
24
+ Requires-Dist: scipy
25
+ Requires-Dist: matplotlib
26
+ Requires-Dist: PyMuPDF
27
+ Dynamic: author
28
+ Dynamic: author-email
29
+ Dynamic: classifier
30
+ Dynamic: description
31
+ Dynamic: description-content-type
32
+ Dynamic: home-page
33
+ Dynamic: license
34
+ Dynamic: license-file
35
+ Dynamic: project-url
36
+ Dynamic: requires-dist
37
+ Dynamic: requires-python
38
+ Dynamic: summary
39
+
40
+ # PyVisualFields
41
+
42
+ ## A python tool collection for analyzing visual fields
43
+
44
+ This packages includes functions for visuald field analysis and display.
45
+
46
+ https://pypi.org/project/PyVisualFields/
47
+
48
+ Version 2 is R-independent while maintaining the original module organization. The modules are inspired by vfprogression (Elze et al. [3]) and visualFields (Marin-Franch et al. [4]).
49
+ Additionally, PyGlaucoMetric[5] has been integrated to enable glaucoma classification based on visual field patterns.
50
+
51
+ These functions are implemented in Python, and their functionalities are demonstrated across four primary categories:
52
+ - Data Presentation
53
+ - Plotting
54
+ - Scoring and Progression Analysis
55
+ - Normalization Analysis
56
+ - Glaucoma Detection
57
+
58
+ For each category, we provide comprehensive Jupyter notebooks containing practical examples, detailed function descriptions, required inputs/dependencies, and expected outputs.
59
+
60
+ ## Citation
61
+ If you found this package impactful for your research, please cite the following article:
62
+ - PyVisualFields v2
63
+ - Mohammad Eslami, Saber Kazeminasab, Vishal Sharma, Yangjiani Li, Mojtaba Fazli, Mengyu Wang, Nazlee Zebardast, Tobias Elze; PyVisualFields: A Python Package for Visual Field Analysis. Trans. Vis. Sci. Tech. 2023;12(2):6. https://doi.org/10.1167/tvst.12.2.6.
64
+
65
+ and of course the corresponding sub-package:
66
+ - vfprogression (by Elze et al. [3])
67
+ - visualFields (by Marin-Granch et al. [4])
68
+ - PyGlaucoMetrics (by Moradi et al. [5])
69
+
70
+ ## Installation:
71
+
72
+ > pip install PyVisualFields
73
+
74
+ ## Demo jupyter notebooks
75
+
76
+ The list and description of all functions are available at [All_Functions](#list-of-functions). They are all examined and introduced with examples in 4 different notebooks categorized: </br>
77
+ - Data [demo_1_Data.ipynb](demo_1_Data.ipynb)
78
+ - Normalization and deviation analysis [demo_2_Deviation_Analysis.ipynb](demo_2_Deviation_Analysis.ipynb)
79
+ - Plotting [demo_3_Plotting.ipynb](demo_3_Plotting.ipynb)
80
+ - Progression Analysis [demo_4_ProgressionAnalysis.ipynb](demo_4_ProgressionAnalysis.ipynb)
81
+ - Glaucoma Detection [demo5_PyGlaucoMetrics.ipynb](demo5_PyGlaucoMetrics.ipynb) </br>
82
+
83
+ __Notice:__ PyGlaucoMetric is also available as a seperatre PyPI package and GitHub repository (built upon PyVisualFields), which includes a graphical user interface (GUI) for progression analysis and glaucoma detection. Indeed PyVisualFields is designed as a developer-facing package library, while PyGlaucoMetric serves as an accessible GUI application implementing selected visual field analysis components.
84
+ https://github.com/Mousamoradi/PyGlaucoMetrics
85
+
86
+
87
+ ## references:
88
+ [1] PyVisualFields v2
89
+ [2] Mohammad Eslami, Saber Kazeminasab, Vishal Sharma, Yangjiani Li, Mojtaba Fazli, Mengyu Wang, Nazlee Zebardast, Tobias Elze; PyVisualFields: A Python Package for Visual Field Analysis. Trans. Vis. Sci. Tech. 2023;12(2):6. https://doi.org/10.1167/tvst.12.2.6.
90
+ [3] https://cran.r-project.org/web/packages/vfprogression/index.html </br>
91
+ [4] https://cran.r-project.org/web/packages/visualFields/index.html </br>
92
+ [5] Moradi, Mousa, Saber Kazeminasab Hashemabad, Daniel M. Vu, Allison R. Soneru, Asahi Fujita, Mengyu Wang, Tobias Elze, Mohammad Eslami, and Nazlee Zebardast. 2025. "PyGlaucoMetrics: A Stacked Weight-Based Machine Learning Approach for Glaucoma Detection Using Visual Field Data" Medicina 61, no. 3: 541. https://doi.org/10.3390/medicina61030541
93
+ </br>
94
+
95
+
96
+ ## list of functions
97
+ The list and description of all functions are as follow. They are all examined and introduced with examples in 4 different notebooks. It is important to mention that, based on the background modules, the input VF dataframe needs to have columns with special column names. Make sure, to consider the data notebook. If further information is required, see the corresponding references: _vfprogression[1]_, _visualFields[2]_ </br>
98
+ - Data [demo_1_Data.ipynb](demo_1_Data.ipynb)
99
+ - Normalization and deviation analysis [demo_2_Deviation_Analysis.ipynb](demo_2_Deviation_Analysis.ipynb)
100
+ - Plotting [demo_3_Plotting.ipynb](demo_3_Plotting.ipynb)
101
+ - Progression Analysis [demo_4_ProgressionAnalysis.ipynb](demo_4_ProgressionAnalysis.ipynb)
102
+ - Glaucoma Detection [demo5_PyGlaucoMetrics.ipynb](demo5_PyGlaucoMetrics.ipynb)
103
+ </br>
104
+
105
+ ### Notice:
106
+ Version 2 has been validated exclusively for the 24-2 format. Additionally, the system assumes all visual field measurements are provided in right eye (OD) format.
107
+
108
+ Functions based on _vfprogression_ package accept 24-2 or 30-2 visual field measurement while functions based on _visualFields_ also accept 10-2.
109
+
110
+
111
+ # Function Reference
112
+
113
+ <details>
114
+ <summary><b>Data Utilities </b></summary>
115
+ ## Data Utilities
116
+
117
+ | Function | Description | Reference |
118
+ |----------|-------------|--------|
119
+ | `utils.canonicalize_vf_df()` | Canonicalize VF data to PyVisualFields format | PyVisualFieldsV2 |
120
+ | `utils.canonicalize_vf_df(, sort_byDateAge=True)` | Canonicalize and sort VFs by date/age within each patient | PyVisualFieldsV2 |
121
+ | `utils.print_vf_summary()` | Print a summary of available VF information | PyVisualFieldsV2 |
122
+ | `utils.investigate_vf_df()` | Return a summary of available VF information | PyVisualFieldsV2 |
123
+ | `utils.vf_blocks()` | Identify available VF blocks (`s`, `td`, `pd`, `tdp`, `pdp`) | PyVisualFieldsV2 |
124
+ | `utils.missing_blocks()` | Identify missing VF blocks | PyVisualFieldsV2 |
125
+ | `utils.compute_missing_blocks()` | Compute missing blocks using current normative setting NV | PyVisualFieldsV2 |
126
+ </details>
127
+
128
+
129
+ <details>
130
+ <summary><b>Data Structures and Canonicalization </b></summary>
131
+ ## Data Structures and Canonicalization
132
+
133
+ ## Data Canonicalization
134
+
135
+ PyVisualFields provides two helper functions:
136
+
137
+ ```python
138
+ canonicalize_vf_df()
139
+ canonicalize_vf_row()
140
+ ```
141
+
142
+ to standardize visual field data into a unified format compatible with all package functions.
143
+
144
+ The canonicalization functions standardize recognized visual field and metadata columns while preserving all other columns unchanged, allowing user-specific variables and auxiliary information to be retained throughout the analysis pipeline.
145
+
146
+ ### Supported Pointwise Data
147
+
148
+ The following pointwise aliases are automatically recognized:
149
+
150
+ ```python
151
+ POINT_ALIASES = {
152
+ "sens": ["l", "s", "sen", "sens", "sensitivity"],
153
+ "td": ["td"],
154
+ "pd": ["pd"],
155
+ "tdp": ["tdp"],
156
+ "pdp": ["pdp"],
157
+ }
158
+ ```
159
+
160
+ The parser automatically handles:
161
+
162
+ * Different prefixes (e.g., `s`, `sen`, `sens`, `sensitivity`)
163
+ * Upper/lower-case variations (e.g., `TD1`, `td1`)
164
+ * Common separators (e.g., `td1`, `td_1`, `td-1`, `td 1`)
165
+
166
+ and converts them into the canonical format:
167
+
168
+ ```text
169
+ l1-l54 Raw sensitivity values
170
+ td1-td54 Total Deviation values
171
+ tdp1-tdp54 Total Deviation probability values
172
+ pd1-pd54 Pattern Deviation values
173
+ pdp1-pdp54 Pattern Deviation probability values
174
+ ```
175
+
176
+ Both 52-point and 54-point visual fields are supported automatically. For 52-point fields, the two blind-spot locations are inserted automatically.
177
+
178
+ ### Supported Metadata
179
+
180
+ Common metadata fields are also standardized when possible, including:
181
+
182
+ ```text
183
+ patientid
184
+ eyeid
185
+ date
186
+ age
187
+ yearsfollowed
188
+ md
189
+ mdprob
190
+ psd
191
+ psdprob
192
+ ght
193
+ vfi
194
+ vfiprob
195
+ msens
196
+ msensprob
197
+ ssens
198
+ ssensprob
199
+ tmd
200
+ tmdprob
201
+ tsd
202
+ tsdprob
203
+ pmd
204
+ pmdprob
205
+ gh
206
+ ghprob
207
+ fpr
208
+ fnr
209
+ fl
210
+ duration
211
+ ```
212
+
213
+ For example:
214
+
215
+ ```text
216
+ patient_id -> patientid
217
+ subjectid -> patientid
218
+ mrn -> patientid
219
+
220
+ eye -> eyeid
221
+ laterality -> eyeid
222
+
223
+ examdate -> date
224
+ testdate -> date
225
+
226
+ mdp -> mdprob
227
+ psdp -> psdprob
228
+ vfip -> vfiprob
229
+ ```
230
+
231
+ After canonicalization, all PyVisualFields functions can assume a consistent schema regardless of the original data source.
232
+
233
+ PyVisualFields supports both device-reported and computed global indices.
234
+
235
+ | Variable | Description |
236
+ | ------------------ | -------------------------------------------------------------------------------------------------------------------- |
237
+ | **s** / **l1-l54** | Raw visual field sensitivities (dB) at each test location. |
238
+ | **msens** | Mean sensitivity (MS) across all visual field locations. |
239
+ | **ssens** | Standard deviation of sensitivity values across locations. |
240
+ | **td1-td54** | Total Deviation values (measured sensitivity − age-expected normal sensitivity). |
241
+ | **tdp1-tdp54** | Total Deviation probability values; statistical significance of each TD location. |
242
+ | **pdp1-pdp54** | Pattern Deviation probability values; statistical significance of each PD location. |
243
+ | **MD** | The Humphrey MD index. |
244
+ | **tmd** | Total Mean Deviation; weighted mean of Total Deviation values. Similar to the Humphrey MD index. |
245
+ | **tsd** | Total Standard Deviation; weighted standard deviation of Total Deviation values. |
246
+ | **pd1-pd54** | Pattern Deviation values (Total Deviation corrected for generalized depression). |
247
+ | **pmd** | Pattern Mean Deviation; weighted mean of Pattern Deviation values. |
248
+ | **psd** | Pattern Standard Deviation; weighted standard deviation of Pattern Deviation values. |
249
+ | **ght** | Glaucoma Hemifield Test result (Within Normal Limits, Borderline, Outside Normal Limits, etc.). |
250
+ | **gh** | General Height (generalized sensitivity adjustment used in Pattern Deviation calculations). |
251
+ | **vfi** | Visual Field Index (%), where 100 indicates a normal visual field and lower values indicate greater functional loss. |
252
+ | **fpr** | False Positive Rate (%). |
253
+ | **fnr** | False Negative Rate (%). |
254
+ | **fl** | Fixation Loss Rate (%). |
255
+ | **duration** | Test duration. |
256
+
257
+
258
+
259
+ </details>
260
+
261
+
262
+ <details>
263
+ <summary><b>Example Datasets</b></summary>
264
+ ## Example Datasets
265
+
266
+ | Function | Description | Reference |
267
+ |----------|-------------|--------|
268
+ | `visualFields.data_vfpwgRetest24d2()` | Humphrey 24-2 retest dataset | visualFields |
269
+ | `visualFields.data_vfctrSunyiu24d2()` | SUNY-IU control dataset | visualFields |
270
+ | `visualFields.data_vfpwgSunyiu24d2()` | SUNY-IU glaucoma dataset | visualFields |
271
+ | `visualFields.data_vfctrSunyiu10d2()` | SUNY-IU 10-2 control dataset | visualFields |
272
+ | `visualFields.data_vfctrIowaPC26()` | Iowa PC26 dataset | visualFields |
273
+ | `visualFields.data_vfctrIowaPeri()` | Iowa Peri dataset | visualFields |
274
+ | `vfprogression.data_vfseries()` | Longitudinal VF series dataset | vfprogression |
275
+ | `vfprogression.data_vfi()` | VFI dataset | vfprogression |
276
+ | `vfprogression.data_cigts()` | CIGTS dataset | vfprogression |
277
+ | `vfprogression.data_plrnouri2012()` | | vfprogression |
278
+ | `vfprogression.data_schell2014()` | | vfprogression |
279
+ </details>
280
+
281
+
282
+ <details>
283
+ <summary><b>Deviation Analysis </b></summary>
284
+ ## Deviation Analysis
285
+
286
+ | Function | Description | Reference |
287
+ |----------|-------------|--------|
288
+ | `visualFields.getnv()` | Get current normative environment/setting | visualFields |
289
+ | `visualFields.setnv()` | change/set normalization environment based on a predefined NV | visualFields |
290
+ | `visualFields.get_info_normvals()` | all avialbale predefined normalization environments/settings | visualFields |
291
+ | `visualFields.nvgenerate()` |generate a normalization environment based new data | visualFields |
292
+ | `utils.compute_missing_blocks()` | Compute missing blocks ( `td`, `pd`, `tdp`, `pdp`) using current normative setting NV | PyVisualFieldsV2 |
293
+ | `visualFields.gettd()` | compute td using current normative setting NV | visualFields |
294
+ | `visualFields.gettdp()` | compute tdp using current normative setting NV | visualFields |
295
+ | `visualFields.getpd()` | compute pd using current normative setting NV | visualFields |
296
+ | `visualFields.getpdp()` | compute pdp using current normative setting NV | visualFields |
297
+ | `visualFields.getgh()` | compute general heigh using current normative setting NV | visualFields |
298
+ | `visualFields.getgl()` | compute gl (global incices, e.g. msens (MS), tmd (i.e. MD, but weighted mean of TD values), pmd (i.e. weighted mean of PD values) psd, vfi, gh ) using current normative setting NV | visualFields |
299
+ | `visualFields.getglp()` | compute gl's probabilities (e.g. mdprob, psdprob) using current normative setting NV | visualFields |
300
+ </details>
301
+
302
+ <details>
303
+ <summary><b>Progression Analysis </b></summary>
304
+ ## Progression Analysis
305
+
306
+ | Function | Description |Reference |
307
+ |----------|-------------|--------|
308
+ | `vfprogression.get_score_AGIS()` | Compute AGIS score | vfprogression |
309
+ | `vfprogression.get_score_CIGTS()` | Compute CIGTS score | vfprogression |
310
+ | `vfprogression.progression_agis()` | AGIS progression analysis | vfprogression |
311
+ | `vfprogression.progression_cigts()` | CIGTS progression analysis | vfprogression |
312
+ | `vfprogression.progression_vfi()` | VFI progression analysis | vfprogression |
313
+ | `vfprogression.progression_plrnouri2012()` | Nouri et al. progression analysis | vfprogression |
314
+ | `vfprogression.progression_schell2014()` | Schell et al. progression analysis | vfprogression |
315
+ | `visualFields.glr()` | Linear regression with global indices | visualFields |
316
+ | `visualFields.plr()` | Pointwise linear regression (PLR) | visualFields |
317
+ | `visualFields.poplr()` | PoPLR regression analysis | visualFields |
318
+ </details>
319
+
320
+
321
+ <details>
322
+ <summary><b>Glaucoma Diagnostic</b></summary>
323
+
324
+ ## Glaucoma Diagnostic Criteria (PyGlaucoMetrics)
325
+
326
+ | Function | Description | Reference |
327
+ |----------|-------------|-----------|
328
+ | `PyGlaucoMetrics.Fn_HAP2()` | HAP2 glaucoma diagnosis | PyGlaucoMetrics[1,5] |
329
+ | `PyGlaucoMetrics.Fn_HAP2_part2()` | HAP2 severity classification | PyGlaucoMetrics[1,5] |
330
+ | `PyGlaucoMetrics.Fn_UKGTS()` | UKGTS criteria |PyGlaucoMetrics[1,5] |
331
+ | `PyGlaucoMetrics.Fn_LoGTS()` | LoGTS criteria |PyGlaucoMetrics[1,5] |
332
+ | `PyGlaucoMetrics.Fn_Foster()` | Foster criteria |PyGlaucoMetrics[1,5] |
333
+ | `PyGlaucoMetrics.Fn_Kangs()` | Kang's criteria |PyGlaucoMetrics[1,5] |
334
+
335
+ </details>
336
+
337
+
338
+ <details>
339
+ <summary><b>Visualization Functions</b></summary>
340
+ ## Visualization
341
+
342
+ | Function | Description |
343
+ |----------|-------------|
344
+ | `vfprogression.plotValues()` | Plot sensitivity, TD, or PD values |
345
+ | `vfprogression.plotProbabilities()` | Plot TDP or PDP probability maps |
346
+ | `visualFields.vfplot()` | Generic VF plotting function |
347
+ | `visualFields.vfplot_s()` | Sensitivity plot |
348
+ | `visualFields.vfplot_td()` | Total deviation plot |
349
+ | `visualFields.vfplot_pd()` | Pattern deviation plot |
350
+ | `visualFields.vfplotsparklines()` | Sparkline visualization |
351
+ | `visualFields.vflegoplot()` | Lego plot visualization |
352
+ | `visualFields.plotProbColormap()` | Probability colormap legend |
353
+ | `visualFields.vfplotplr()` | |
354
+ | `utils.Fn_report()` | Make a report of an eye | PyVisualFieldsV2 |
355
+ </details>
356
+
357
+
358
+
359
+
360
+ ## Snapshots
361
+
362
+ [See Github Repository](https://github.com/mohaEs/PyVisualField)
363
+
364
+ <img src="./imgs/1_(12).png" width="50%">
365
+ <img src="./imgs/1_(13).png" width="50%">
366
+ <img src="./imgs/1_(1).png" width="50%">
367
+ <img src="./imgs/1_(2).png" width="50%">
368
+ <img src="./imgs/1_(3).png" width="50%">
369
+ <img src="./imgs/1_(4).png" width="50%">
370
+ <img src="./imgs/1_(5).png" width="50%">
371
+ <img src="./imgs/1_(6).png" width="50%">
372
+ <img src="./imgs/1_(8).png" width="50%">
373
+ <img src="./imgs/1_(7).png" width="50%">
374
+ <img src="./imgs/1_(9).png" width="50%">
375
+ <img src="./imgs/1_(10).png" width="50%">
@@ -1,7 +1,7 @@
1
1
  PyVisualFields/Deviation_Analysis.py,sha256=KR8m73JMDDYjbj5cDEyxTFbMiyNp0C8Xy5nVTbLXQqw,31152
2
- PyVisualFields/PyGlaucoMetrics.py,sha256=-Uj_pO9yxqY6-H4ZhrSRdE3zbMdnyy68wLo2i_kmvN0,23956
3
- PyVisualFields/__init__.py,sha256=L4aOgvDE9n_eqL_mM_j5bO3bQ73q6ulNpnVuG8OmqWE,22
4
- PyVisualFields/utils.py,sha256=sYZOqnd5kIimbZh8u0sj89pFXx6SYId5rESg_BO6AsA,25219
2
+ PyVisualFields/PyGlaucoMetrics.py,sha256=tideb4f8cmrxkhZIIzNSarDCuMT1lOlPAjx5VJHpXNs,24311
3
+ PyVisualFields/__init__.py,sha256=pZib55qStLeBfZabni1F1OCNxdT02xP-5e34LjIBswQ,22
4
+ PyVisualFields/utils.py,sha256=ub3my1hqCP73IjLNXqz-ismKE-EVwe7pVhBUpZdg6jM,25306
5
5
  PyVisualFields/vfprogression.py,sha256=FjKtVZ3DRcS31CZRcAHMTfDxYYF3UWLTOjcr3YZdCRg,34215
6
6
  PyVisualFields/visualFields.py,sha256=aSZaKE5pc67TyuVtrMLYtKe7lbInzVWKnpP-6ezQwHA,61905
7
7
  PyVisualFields/pkl_files/locmaps.json,sha256=VQ8L0DvBG8GouJD_ZsgQa8O1SteDMFPFTSPaW8TgL7c,1694
@@ -18,8 +18,8 @@ PyVisualFields/pkl_files/vfctrSunyiu24d2.pkl,sha256=e2hspPbpVYWXBDVn6fJ9KRK-JYIH
18
18
  PyVisualFields/pkl_files/vfpwgRetest24d2.pkl,sha256=WyWZ3mHr1JL4TCUVUu0WFpIFdqAiwvNyL_pd51duPKY,106683
19
19
  PyVisualFields/pkl_files/vfpwgSunyiu24d2.pkl,sha256=kYIreVpqaRX-Hkl9ZPZ7agnqJplu8DxFM08X17L_fTg,14598
20
20
  PyVisualFields/pkl_files/vfseries.pkl,sha256=aWkDkByTkgmCKH2nYZrB1hoHt-fi_FxY1gamZ6iqZu0,36363
21
- pyvisualfields-2.0.7.dist-info/licenses/LICENSE,sha256=m3BJDRLy-Xnz1WmgtnVniIpPIlwv0MYil80-tjCetYc,1570
22
- pyvisualfields-2.0.7.dist-info/METADATA,sha256=7G6xPj_WBWENM1XJSfBga1IC3-Jpg29Af5M5FWbpOYQ,12829
23
- pyvisualfields-2.0.7.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
24
- pyvisualfields-2.0.7.dist-info/top_level.txt,sha256=r-Mpr1QBoJaRDJQ-POzcuukSnBCkNasixPj3P2UWWRw,15
25
- pyvisualfields-2.0.7.dist-info/RECORD,,
21
+ pyvisualfields-2.0.9.dist-info/licenses/LICENSE,sha256=m3BJDRLy-Xnz1WmgtnVniIpPIlwv0MYil80-tjCetYc,1570
22
+ pyvisualfields-2.0.9.dist-info/METADATA,sha256=30JCLcuGrqxKCw2OQ-Jg6u2LDjqH5vJBZYjXpLlE6Ms,17713
23
+ pyvisualfields-2.0.9.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
24
+ pyvisualfields-2.0.9.dist-info/top_level.txt,sha256=r-Mpr1QBoJaRDJQ-POzcuukSnBCkNasixPj3P2UWWRw,15
25
+ pyvisualfields-2.0.9.dist-info/RECORD,,