napari-nifti-viewer 0.1.0__tar.gz

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.
@@ -0,0 +1,248 @@
1
+ Metadata-Version: 2.4
2
+ Name: napari-nifti-viewer
3
+ Version: 0.1.0
4
+ Summary: A comprehensive napari plugin for NIfTI file analysis and visualization
5
+ Home-page: https://github.com/yohanchiu/napari-nifti-viewer
6
+ Author: Yohanchiu
7
+ Author-email: Your Name <your.email@example.com>
8
+ Maintainer-email: Your Name <your.email@example.com>
9
+ License: MIT
10
+ Project-URL: Homepage, https://github.com/yohanchiu/napari-nifti-viewer
11
+ Project-URL: Bug Tracker, https://github.com/yohanchiu/napari-nifti-viewer/issues
12
+ Project-URL: Documentation, https://github.com/yohanchiu/napari-nifti-viewer/wiki
13
+ Project-URL: Source Code, https://github.com/yohanchiu/napari-nifti-viewer
14
+ Project-URL: Changelog, https://github.com/yohanchiu/napari-nifti-viewer/blob/main/CHANGELOG.md
15
+ Keywords: napari,nifti,neuroimaging,medical imaging,visualization,plugin
16
+ Classifier: Development Status :: 4 - Beta
17
+ Classifier: Framework :: napari
18
+ Classifier: Intended Audience :: Science/Research
19
+ Classifier: Intended Audience :: Healthcare Industry
20
+ Classifier: License :: OSI Approved :: MIT License
21
+ Classifier: Operating System :: OS Independent
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Programming Language :: Python :: 3.8
24
+ Classifier: Programming Language :: Python :: 3.9
25
+ Classifier: Programming Language :: Python :: 3.10
26
+ Classifier: Programming Language :: Python :: 3.11
27
+ Classifier: Programming Language :: Python :: 3.12
28
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
29
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
30
+ Classifier: Topic :: Scientific/Engineering :: Visualization
31
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
32
+ Requires-Python: >=3.8
33
+ Description-Content-Type: text/markdown
34
+ Requires-Dist: napari>=0.4.18
35
+ Requires-Dist: numpy>=1.21.0
36
+ Requires-Dist: nibabel>=5.2.1
37
+ Requires-Dist: qtpy>=2.0.0
38
+ Requires-Dist: magicgui>=0.7.0
39
+ Provides-Extra: dev
40
+ Requires-Dist: pytest>=7.0; extra == "dev"
41
+ Requires-Dist: pytest-cov; extra == "dev"
42
+ Requires-Dist: black; extra == "dev"
43
+ Requires-Dist: isort; extra == "dev"
44
+ Requires-Dist: flake8; extra == "dev"
45
+ Requires-Dist: pre-commit; extra == "dev"
46
+ Provides-Extra: test
47
+ Requires-Dist: pytest>=7.0; extra == "test"
48
+ Requires-Dist: pytest-cov; extra == "test"
49
+ Dynamic: author
50
+ Dynamic: home-page
51
+ Dynamic: requires-python
52
+
53
+ # napari-nifti-viewer
54
+
55
+ A powerful napari plugin for comprehensive NIfTI file analysis and visualization.
56
+
57
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
58
+ [![Python](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
59
+ [![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/napari-nifti-viewer)](https://napari-hub.org/plugins/napari-nifti-viewer)
60
+
61
+ ## Overview
62
+
63
+ napari-nifti-viewer is a comprehensive napari plugin specifically designed for reading, analyzing, and visualizing NIfTI (.nii/.nii.gz) files. It provides detailed metadata extraction, intelligent label detection, and seamless integration with napari's visualization capabilities.
64
+
65
+ ## Features
66
+
67
+ ### 🔍 **Complete NIfTI Support**
68
+ - Read .nii and .nii.gz format files
69
+ - Support for NIfTI-1 standard
70
+ - Compatible with both image and label data
71
+
72
+ ### 📊 **Comprehensive Metadata Analysis**
73
+ - Extract complete NIfTI header information (40+ fields)
74
+ - Display affine transformation matrices
75
+ - Show coordinate system information
76
+ - Analyze voxel spacing and orientation
77
+
78
+ ### 🏷️ **Intelligent Label Detection**
79
+ - Automatic label image detection
80
+ - Statistical analysis of label distributions
81
+ - Label value counting and percentage calculations
82
+
83
+ ### 📈 **Data Statistics**
84
+ - Complete data shape and type information
85
+ - Statistical measures (min, max, mean, std)
86
+ - Non-zero voxel counting
87
+ - Unique value analysis
88
+
89
+ ### 💾 **Export Capabilities**
90
+ - Export complete metadata as JSON
91
+ - Preserve all numerical precision
92
+ - Human-readable format
93
+
94
+ ### 🎨 **User-Friendly Interface**
95
+ - Clean, organized tabbed interface
96
+ - Real-time data loading
97
+ - Seamless napari integration
98
+
99
+ ## Interface
100
+
101
+ The plugin provides a clean, organized interface with three main tabs:
102
+
103
+ ### 📋 File Overview Tab
104
+ Displays basic file information and data statistics including file size, format, data shape, and statistical measures.
105
+
106
+ ### 📊 Detailed Information Tab
107
+ Shows complete NIfTI header fields and metadata in an organized table format, alongside full JSON metadata export.
108
+
109
+ ### 🏷️ Label Analysis Tab
110
+ Provides intelligent label detection and statistical analysis with automatic identification of label images and distribution analysis.
111
+
112
+ ## Installation
113
+
114
+ ### From PyPI (Recommended)
115
+ ```bash
116
+ pip install napari-nifti-viewer
117
+ ```
118
+
119
+ ### From Source
120
+ ```bash
121
+ git clone https://github.com/yohanchiu/napari-nifti-viewer.git
122
+ cd napari-nifti-viewer
123
+ pip install -e .
124
+ ```
125
+
126
+ ## Quick Start
127
+
128
+ 1. **Launch napari** with the plugin installed
129
+ 2. **Open the plugin** from the Plugins menu → napari-nifti-viewer
130
+ 3. **Load a file** by clicking "Browse..." and selecting a .nii/.nii.gz file
131
+ 4. **Explore the data** across three informative tabs:
132
+ - **File Overview**: Basic information and statistics
133
+ - **Detailed Info**: Complete NIfTI headers and metadata
134
+ - **Label Analysis**: Label detection and analysis
135
+ 5. **Visualize in napari** by clicking "Load to Napari"
136
+
137
+ ## Usage Examples
138
+
139
+ ### Loading a Medical Image
140
+ ```python
141
+ import napari
142
+ from napari_nifti_viewer import NiftiViewerWidget
143
+
144
+ # Create napari viewer
145
+ viewer = napari.Viewer()
146
+
147
+ # The plugin will be available in the Plugins menu
148
+ # Or you can add it programmatically:
149
+ widget = NiftiViewerWidget(viewer)
150
+ viewer.window.add_dock_widget(widget, name="NIfTI Viewer")
151
+ ```
152
+
153
+ ### Exporting Metadata
154
+ The plugin allows you to export complete metadata including:
155
+ - File information (size, format, version)
156
+ - NIfTI header fields (all 40+ standard fields)
157
+ - Data statistics (shape, type, value ranges)
158
+ - Coordinate system information
159
+ - Affine transformation matrices
160
+
161
+ ## Requirements
162
+
163
+ - **napari** >= 0.4.18
164
+ - **nibabel** >= 5.2.1
165
+ - **numpy** >= 1.21.0
166
+ - **qtpy** >= 2.0.0
167
+ - **magicgui** >= 0.7.0
168
+ - **Python** >= 3.8
169
+
170
+ ## Supported File Formats
171
+
172
+ - `.nii` - Uncompressed NIfTI files
173
+ - `.nii.gz` - Compressed NIfTI files
174
+ - Compatible with NIfTI-1 standard
175
+ - Support for both neuroimaging and medical imaging data
176
+
177
+ ## Development
178
+
179
+ ### Setting up Development Environment
180
+
181
+ ```bash
182
+ # Clone the repository
183
+ git clone https://github.com/yohanchiu/napari-nifti-viewer.git
184
+ cd napari-nifti-viewer
185
+
186
+ # Create virtual environment
187
+ python -m venv venv
188
+ source venv/bin/activate # On Windows: venv\Scripts\activate
189
+
190
+ # Install in development mode
191
+ pip install -e ".[dev]"
192
+
193
+ # Run tests
194
+ python -m pytest
195
+ ```
196
+
197
+ ### Running Tests
198
+
199
+ ```bash
200
+ # Basic functionality test
201
+ python test_plugin.py
202
+
203
+ # Test with napari interface
204
+ python test_plugin.py --napari
205
+ ```
206
+
207
+ ## Contributing
208
+
209
+ We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.
210
+
211
+ ### Ways to Contribute
212
+ - 🐛 Report bugs
213
+ - 💡 Suggest new features
214
+ - 📝 Improve documentation
215
+ - 🔧 Submit pull requests
216
+
217
+ ## License
218
+
219
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
220
+
221
+ ## Citation
222
+
223
+ If you use this plugin in your research, please consider citing:
224
+
225
+ ```bibtex
226
+ @software{napari_nifti_viewer,
227
+ title={napari-nifti-viewer: Comprehensive NIfTI Analysis for napari},
228
+ author={Qiu Yuheng},
229
+ year={2024},
230
+ url={https://github.com/yohanchiu/napari-nifti-viewer}
231
+ }
232
+ ```
233
+
234
+ ## Acknowledgments
235
+
236
+ - Built with [napari](https://napari.org/) - a fast, interactive, multi-dimensional image viewer
237
+ - Uses [nibabel](https://nipy.org/nibabel/) for NIfTI file handling
238
+ - Inspired by the neuroimaging and medical imaging communities
239
+
240
+ ## Support
241
+
242
+ - 📖 [Documentation](https://github.com/yohanchiu/napari-nifti-viewer/wiki)
243
+ - 🐛 [Issue Tracker](https://github.com/yohanchiu/napari-nifti-viewer/issues)
244
+ - 💬 [Discussions](https://github.com/yohanchiu/napari-nifti-viewer/discussions)
245
+
246
+ ---
247
+
248
+ Made with ❤️ for the napari and neuroimaging communities
@@ -0,0 +1,196 @@
1
+ # napari-nifti-viewer
2
+
3
+ A powerful napari plugin for comprehensive NIfTI file analysis and visualization.
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![Python](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
7
+ [![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/napari-nifti-viewer)](https://napari-hub.org/plugins/napari-nifti-viewer)
8
+
9
+ ## Overview
10
+
11
+ napari-nifti-viewer is a comprehensive napari plugin specifically designed for reading, analyzing, and visualizing NIfTI (.nii/.nii.gz) files. It provides detailed metadata extraction, intelligent label detection, and seamless integration with napari's visualization capabilities.
12
+
13
+ ## Features
14
+
15
+ ### 🔍 **Complete NIfTI Support**
16
+ - Read .nii and .nii.gz format files
17
+ - Support for NIfTI-1 standard
18
+ - Compatible with both image and label data
19
+
20
+ ### 📊 **Comprehensive Metadata Analysis**
21
+ - Extract complete NIfTI header information (40+ fields)
22
+ - Display affine transformation matrices
23
+ - Show coordinate system information
24
+ - Analyze voxel spacing and orientation
25
+
26
+ ### 🏷️ **Intelligent Label Detection**
27
+ - Automatic label image detection
28
+ - Statistical analysis of label distributions
29
+ - Label value counting and percentage calculations
30
+
31
+ ### 📈 **Data Statistics**
32
+ - Complete data shape and type information
33
+ - Statistical measures (min, max, mean, std)
34
+ - Non-zero voxel counting
35
+ - Unique value analysis
36
+
37
+ ### 💾 **Export Capabilities**
38
+ - Export complete metadata as JSON
39
+ - Preserve all numerical precision
40
+ - Human-readable format
41
+
42
+ ### 🎨 **User-Friendly Interface**
43
+ - Clean, organized tabbed interface
44
+ - Real-time data loading
45
+ - Seamless napari integration
46
+
47
+ ## Interface
48
+
49
+ The plugin provides a clean, organized interface with three main tabs:
50
+
51
+ ### 📋 File Overview Tab
52
+ Displays basic file information and data statistics including file size, format, data shape, and statistical measures.
53
+
54
+ ### 📊 Detailed Information Tab
55
+ Shows complete NIfTI header fields and metadata in an organized table format, alongside full JSON metadata export.
56
+
57
+ ### 🏷️ Label Analysis Tab
58
+ Provides intelligent label detection and statistical analysis with automatic identification of label images and distribution analysis.
59
+
60
+ ## Installation
61
+
62
+ ### From PyPI (Recommended)
63
+ ```bash
64
+ pip install napari-nifti-viewer
65
+ ```
66
+
67
+ ### From Source
68
+ ```bash
69
+ git clone https://github.com/yohanchiu/napari-nifti-viewer.git
70
+ cd napari-nifti-viewer
71
+ pip install -e .
72
+ ```
73
+
74
+ ## Quick Start
75
+
76
+ 1. **Launch napari** with the plugin installed
77
+ 2. **Open the plugin** from the Plugins menu → napari-nifti-viewer
78
+ 3. **Load a file** by clicking "Browse..." and selecting a .nii/.nii.gz file
79
+ 4. **Explore the data** across three informative tabs:
80
+ - **File Overview**: Basic information and statistics
81
+ - **Detailed Info**: Complete NIfTI headers and metadata
82
+ - **Label Analysis**: Label detection and analysis
83
+ 5. **Visualize in napari** by clicking "Load to Napari"
84
+
85
+ ## Usage Examples
86
+
87
+ ### Loading a Medical Image
88
+ ```python
89
+ import napari
90
+ from napari_nifti_viewer import NiftiViewerWidget
91
+
92
+ # Create napari viewer
93
+ viewer = napari.Viewer()
94
+
95
+ # The plugin will be available in the Plugins menu
96
+ # Or you can add it programmatically:
97
+ widget = NiftiViewerWidget(viewer)
98
+ viewer.window.add_dock_widget(widget, name="NIfTI Viewer")
99
+ ```
100
+
101
+ ### Exporting Metadata
102
+ The plugin allows you to export complete metadata including:
103
+ - File information (size, format, version)
104
+ - NIfTI header fields (all 40+ standard fields)
105
+ - Data statistics (shape, type, value ranges)
106
+ - Coordinate system information
107
+ - Affine transformation matrices
108
+
109
+ ## Requirements
110
+
111
+ - **napari** >= 0.4.18
112
+ - **nibabel** >= 5.2.1
113
+ - **numpy** >= 1.21.0
114
+ - **qtpy** >= 2.0.0
115
+ - **magicgui** >= 0.7.0
116
+ - **Python** >= 3.8
117
+
118
+ ## Supported File Formats
119
+
120
+ - `.nii` - Uncompressed NIfTI files
121
+ - `.nii.gz` - Compressed NIfTI files
122
+ - Compatible with NIfTI-1 standard
123
+ - Support for both neuroimaging and medical imaging data
124
+
125
+ ## Development
126
+
127
+ ### Setting up Development Environment
128
+
129
+ ```bash
130
+ # Clone the repository
131
+ git clone https://github.com/yohanchiu/napari-nifti-viewer.git
132
+ cd napari-nifti-viewer
133
+
134
+ # Create virtual environment
135
+ python -m venv venv
136
+ source venv/bin/activate # On Windows: venv\Scripts\activate
137
+
138
+ # Install in development mode
139
+ pip install -e ".[dev]"
140
+
141
+ # Run tests
142
+ python -m pytest
143
+ ```
144
+
145
+ ### Running Tests
146
+
147
+ ```bash
148
+ # Basic functionality test
149
+ python test_plugin.py
150
+
151
+ # Test with napari interface
152
+ python test_plugin.py --napari
153
+ ```
154
+
155
+ ## Contributing
156
+
157
+ We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.
158
+
159
+ ### Ways to Contribute
160
+ - 🐛 Report bugs
161
+ - 💡 Suggest new features
162
+ - 📝 Improve documentation
163
+ - 🔧 Submit pull requests
164
+
165
+ ## License
166
+
167
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
168
+
169
+ ## Citation
170
+
171
+ If you use this plugin in your research, please consider citing:
172
+
173
+ ```bibtex
174
+ @software{napari_nifti_viewer,
175
+ title={napari-nifti-viewer: Comprehensive NIfTI Analysis for napari},
176
+ author={Qiu Yuheng},
177
+ year={2024},
178
+ url={https://github.com/yohanchiu/napari-nifti-viewer}
179
+ }
180
+ ```
181
+
182
+ ## Acknowledgments
183
+
184
+ - Built with [napari](https://napari.org/) - a fast, interactive, multi-dimensional image viewer
185
+ - Uses [nibabel](https://nipy.org/nibabel/) for NIfTI file handling
186
+ - Inspired by the neuroimaging and medical imaging communities
187
+
188
+ ## Support
189
+
190
+ - 📖 [Documentation](https://github.com/yohanchiu/napari-nifti-viewer/wiki)
191
+ - 🐛 [Issue Tracker](https://github.com/yohanchiu/napari-nifti-viewer/issues)
192
+ - 💬 [Discussions](https://github.com/yohanchiu/napari-nifti-viewer/discussions)
193
+
194
+ ---
195
+
196
+ Made with ❤️ for the napari and neuroimaging communities
@@ -0,0 +1,22 @@
1
+ import os
2
+ import sys
3
+ import logging
4
+ from pathlib import Path
5
+
6
+
7
+ if sys.platform == 'darwin':
8
+ os.environ['QT_MAC_WANTS_LAYER'] = '1'
9
+
10
+ class QtWarningFilter(logging.Filter):
11
+ def filter(self, record):
12
+ return not (record.getMessage().find("Layer-backing is always enabled") >= 0)
13
+
14
+ logging.getLogger().addFilter(QtWarningFilter())
15
+
16
+ import warnings
17
+ warnings.filterwarnings("ignore", message="Layer-backing is always enabled")
18
+
19
+ from napari_nifti_viewer._version import __version__
20
+ from napari_nifti_viewer._widget import NiftiViewerWidget
21
+
22
+ __all__ = ["NiftiViewerWidget", "__version__"]