clabtoolkit 0.4.4__tar.gz → 0.4.5__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.
Files changed (96) hide show
  1. clabtoolkit-0.4.5/DOCUMENTATION.md +498 -0
  2. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/HISTORY.rst +23 -0
  3. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/MANIFEST.in +17 -2
  4. clabtoolkit-0.4.5/Makefile +87 -0
  5. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/PKG-INFO +3 -4
  6. clabtoolkit-0.4.5/architecture_diagram.md +363 -0
  7. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/__init__.py +1 -1
  8. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/bidstools.py +231 -159
  9. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/build_visualization_layout.py +34 -30
  10. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/colorstools.py +223 -203
  11. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/connectivitytools.py +52 -47
  12. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/dicomtools.py +69 -74
  13. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/dwitools.py +19 -20
  14. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/dwitools_utils.py +6 -6
  15. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/freesurfertools.py +314 -335
  16. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/imagetools.py +103 -61
  17. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/imagetools_utils.py +4 -6
  18. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/misctools.py +268 -209
  19. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/misctools_utils.py +34 -36
  20. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/morphometrytools.py +99 -84
  21. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/networktools.py +8 -8
  22. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/parcellationtools.py +308 -135
  23. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/pipelinetools.py +40 -69
  24. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/plottools.py +5 -5
  25. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/pointstools.py +66 -36
  26. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/qcqatools.py +97 -94
  27. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/segmentationtools.py +15 -13
  28. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/surfacetools.py +229 -50
  29. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/tracttools.py +150 -60
  30. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/visualization_utils.py +88 -74
  31. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/visualizationtools.py +540 -656
  32. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit.egg-info/PKG-INFO +3 -4
  33. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit.egg-info/SOURCES.txt +10 -2
  34. clabtoolkit-0.4.5/docs/source/_static/clabtoolkit_favicon.ico +0 -0
  35. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/modules/pointstools.rst +2 -2
  36. clabtoolkit-0.4.5/environment-mac.yaml +237 -0
  37. clabtoolkit-0.4.5/environment.yaml +299 -0
  38. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/pyproject.toml +33 -9
  39. clabtoolkit-0.4.5/requirements-docs.txt +15 -0
  40. clabtoolkit-0.4.5/requirements.txt +71 -0
  41. clabtoolkit-0.4.5/requirements_dev.txt +39 -0
  42. clabtoolkit-0.4.5/tox.ini +19 -0
  43. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/usage_examples/clabtoolkit_examples.ipynb +140 -2
  44. clabtoolkit-0.4.5/usage_examples/examples-bidstools-methods.ipynb +2745 -0
  45. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/usage_examples/examples-freesurfertools-methods.ipynb +11 -11
  46. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/usage_examples/examples-parcellationtools-methods.ipynb +129 -13
  47. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/usage_examples/examples-surfacetools-methods.ipynb +263 -51
  48. clabtoolkit-0.4.5/usage_examples/examples-visualizationtools-methods.ipynb +1885 -0
  49. clabtoolkit-0.4.4/usage_examples/VisClasses4Paper.ipynb +0 -1011
  50. clabtoolkit-0.4.4/usage_examples/clabtoolkit-OHBM2026-final.ipynb +0 -2069
  51. clabtoolkit-0.4.4/usage_examples/examples-bidstools-methods.ipynb +0 -1366
  52. clabtoolkit-0.4.4/usage_examples/examples-visualizationtools-methods.ipynb +0 -1749
  53. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/AUTHORS.rst +0 -0
  54. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/CONTRIBUTING.rst +0 -0
  55. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/LICENSE +0 -0
  56. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/README.rst +0 -0
  57. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/config/bids.json +0 -0
  58. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/config/config.json +0 -0
  59. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/config/lobes.json +0 -0
  60. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/config/stats_mapping.json +0 -0
  61. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/config/viz_views.json +0 -0
  62. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit/config/viz_views_test.json +0 -0
  63. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit.egg-info/dependency_links.txt +0 -0
  64. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit.egg-info/requires.txt +0 -0
  65. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/clabtoolkit.egg-info/top_level.txt +0 -0
  66. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/Makefile +0 -0
  67. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/clabtoolkit.rst +0 -0
  68. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/make.bat +0 -0
  69. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/modules.rst +0 -0
  70. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/_static/clabtoolkit_ecosystem.png +0 -0
  71. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/_static/clabtoolkit_favicon.png +0 -0
  72. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/_static/clabtoolkit_logo.png +0 -0
  73. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/_static/clabtoolkit_logo_notext.png +0 -0
  74. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/conf.py +0 -0
  75. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/index.rst +0 -0
  76. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/modules/bidstools.rst +0 -0
  77. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/modules/colorstools.rst +0 -0
  78. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/modules/connectivitytools.rst +0 -0
  79. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/modules/dicomtools.rst +0 -0
  80. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/modules/dwitools.rst +0 -0
  81. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/modules/freesurfertools.rst +0 -0
  82. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/modules/imagetools.rst +0 -0
  83. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/modules/misctools.rst +0 -0
  84. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/modules/morphometrytools.rst +0 -0
  85. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/modules/networktools.rst +0 -0
  86. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/modules/parcellationtools.rst +0 -0
  87. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/modules/pipelinetools.rst +0 -0
  88. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/modules/plottools.rst +0 -0
  89. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/modules/qcqatools.rst +0 -0
  90. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/modules/segmentationtools.rst +0 -0
  91. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/modules/surfacetools.rst +0 -0
  92. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/modules/tracttools.rst +0 -0
  93. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/docs/source/modules/visualizationtools.rst +0 -0
  94. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/setup.cfg +0 -0
  95. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/usage_examples/examples-colorstools-methods.ipynb +0 -0
  96. {clabtoolkit-0.4.4 → clabtoolkit-0.4.5}/usage_examples/examples-misctools-methods.ipynb +0 -0
@@ -0,0 +1,498 @@
1
+ # Connectomics Lab Toolkit (clabtoolkit)
2
+
3
+ ## Overview
4
+
5
+ **clabtoolkit** is a comprehensive Python toolkit designed for neuroimaging data processing and analysis, with specialized focus on brain connectivity data, BIDS datasets, and various neuroimaging formats. Developed by Yasser Alemán-Gómez, this toolkit provides an end-to-end solution for connectomics research and surface-based brain analysis.
6
+
7
+ **Version**: 0.4.0
8
+ **License**: Apache Software License 2.0
9
+ **Python Support**: 3.9+
10
+ **Documentation**: https://clabtoolkit.readthedocs.io
11
+ **Repository**: https://github.com/connectomicslab/clabtoolkit
12
+
13
+ ## Installation
14
+
15
+ ### From PyPI
16
+
17
+ ```bash
18
+ pip install clabtoolkit
19
+ ```
20
+
21
+ ### Development Installation with Conda
22
+
23
+ ```bash
24
+ git clone https://github.com/connectomicslab/clabtoolkit.git
25
+ cd clabtoolkit
26
+ conda env create -f environment.yaml
27
+ conda activate clabtoolkit
28
+ pip install -e .[dev]
29
+ ```
30
+
31
+ ## Quick Start
32
+
33
+ ```python
34
+ import clabtoolkit.bidstools as cltbids
35
+ import clabtoolkit.surfacetools as cltsurf
36
+
37
+ # Extract entities from BIDS filename
38
+ entities = cltbids.str2entity("sub-01_ses-M00_T1w.nii.gz")
39
+ print(entities) # {'sub': '01', 'ses': 'M00', 'suffix': 'T1w', 'extension': 'nii.gz'}
40
+
41
+ # Load and visualize a brain surface
42
+ surface = cltsurf.Surface("/path/to/surface.pial")
43
+ surface.plot()
44
+ ```
45
+
46
+ ## Package Architecture
47
+
48
+ The toolkit follows a modular, layered architecture designed for scalability and ease of use:
49
+
50
+ - **Foundation Layer**: Core utilities and plotting infrastructure
51
+ - **Data Layer**: BIDS compliance and image processing
52
+ - **Analysis Layer**: Specialized neuroimaging analysis tools
53
+ - **Workflow Layer**: Pipeline management and quality control
54
+
55
+ ## Module Reference
56
+
57
+ ### Core Data Management
58
+
59
+ #### bidstools - BIDS Dataset Management
60
+
61
+ **Purpose**: Comprehensive BIDS (Brain Imaging Data Structure) compliance and dataset management
62
+
63
+ **Key Features**:
64
+
65
+ - BIDS entity manipulation and validation
66
+ - Dataset organization and structure analysis
67
+ - Batch processing utilities
68
+ - Automated database table generation from BIDS datasets
69
+
70
+ **Key Functions**:
71
+
72
+ ```python
73
+ # Convert BIDS filename to entity dictionary
74
+ entities = cltbids.str2entity("sub-01_ses-M00_acq-3T_T1w.nii.gz")
75
+
76
+ # Manipulate BIDS entities
77
+ cltbids.replace_entity_value(filename, 'ses', 'new_session')
78
+ cltbids.insert_entity(filename, 'run', '01', prev_entity='acq')
79
+
80
+ # Generate and display BIDS dataset structure
81
+ tree = cltbids.generate_bids_tree("/path/to/bids/dataset")
82
+ print(tree)
83
+
84
+ # Get all subjects from a BIDS dataset
85
+ subjects = cltbids.get_subjects("/path/to/bids/dataset")
86
+
87
+ # Generate comprehensive dataset overview
88
+ database = cltbids.get_bids_database_table("/path/to/bids/dataset")
89
+ print(database.head())
90
+ ```
91
+
92
+ #### imagetools - Image Processing Engine
93
+
94
+ **Purpose**: Neuroimaging operations and morphological processing
95
+
96
+ **Key Classes**:
97
+
98
+ - `MorphologicalOperations`: Binary image morphology (erosion, dilation, opening, closing)
99
+
100
+ **Key Features**:
101
+
102
+ - 2D/3D morphological operations
103
+ - Volume filtering and hole filling
104
+ - Image resampling and transformation
105
+ - Quality control utilities
106
+
107
+ **Usage Example**:
108
+
109
+ ```python
110
+ from clabtoolkit.imagetools import MorphologicalOperations
111
+
112
+ morph = MorphologicalOperations()
113
+ # Perform morphological closing on binary image
114
+ filled = morph.closing(image_with_holes, iterations=1)
115
+ ```
116
+
117
+ ### FreeSurfer Integration
118
+
119
+ #### freesurfertools - FreeSurfer Ecosystem Interface
120
+
121
+ **Purpose**: Complete interface with FreeSurfer outputs and cortical surface analysis
122
+
123
+ **Key Classes**:
124
+
125
+ - `AnnotParcellation`: Advanced annotation file management
126
+ - Load/save annotation files (.annot, .gcs formats)
127
+ - Parcellation correction and validation
128
+ - Format conversion between annotation types
129
+
130
+ **Key Features**:
131
+
132
+ - FreeSurfer stats file parsing
133
+ - Surface-based morphometry computation
134
+ - Container technology integration
135
+ - Annotation file correction and processing
136
+
137
+ **Usage Example**:
138
+
139
+ ```python
140
+ import clabtoolkit.freesurfertools as cltfree
141
+ import os
142
+
143
+ # Get FreeSurfer environment variables
144
+ freesurfer_home = os.environ.get('FREESURFER_HOME')
145
+ fs_subject_dir = os.path.join(freesurfer_home, 'subjects')
146
+ fs_fullid = 'bert'
147
+
148
+ # Load the Subject object
149
+ subject = cltfree.FreeSurferSubject(fs_fullid, fs_subject_dir)
150
+
151
+ # Obtain dictionaries containing hemisphere-specific FreeSurfer file paths
152
+ surf, maps, parc, stats = subject.get_hemi_dicts(fs_subject_dir, 'lh')
153
+
154
+ # Get the processing status
155
+ print(f"Processing status for subject {fs_fullid}:")
156
+ subject.get_proc_status()
157
+ print(subject.pstatus)
158
+
159
+ # Load and process annotation file
160
+ annot = cltfree.AnnotParcellation("lh.aparc.a2009s.annot")
161
+ annot.correct_parcellation() # Fix unlabeled vertices
162
+ ```
163
+
164
+ ### Analysis and Processing
165
+
166
+ #### parcellationtools - Brain Parcellation Management
167
+
168
+ **Purpose**: Comprehensive brain parcellation handling and regional analysis
169
+
170
+ **Key Classes**:
171
+
172
+ - `Parcellation`: Complete parcellation ecosystem
173
+ - Load parcellations with lookup tables
174
+ - Regional filtering and grouping
175
+ - Volume calculations and statistics
176
+ - Multi-format export capabilities
177
+
178
+ **Key Features**:
179
+
180
+ - Flexible parcellation filtering and modification
181
+ - Regional statistics computation
182
+ - Atlas integration and validation
183
+ - BIDS-compliant output generation
184
+
185
+ **Usage Example**:
186
+
187
+ ```python
188
+ import clabtoolkit.parcellationtools as cltparc
189
+
190
+ # Load parcellation (automatically detects and loads lookup table if available)
191
+ vol_parc = cltparc.Parcellation("/path/to/parcellation/parcellation.nii.gz")
192
+ ```
193
+
194
+ If a lookup table with the same filename and extension (.lut or .tsv) exists, it will be loaded automatically. Otherwise, load it manually:
195
+
196
+ ```python
197
+ # Load the LUT file manually
198
+ vol_parc.load_colortable("/path/to/lookuptable/lookuptable.lut", lut_type="lut")
199
+ ```
200
+
201
+ Compute regional volumes for all structures in the parcellation:
202
+
203
+ ```python
204
+ # Compute regional volumes
205
+ volumes = vol_parc.compute_regional_volumes()
206
+ ```
207
+
208
+ Filter structures by name or code if only specific regions are of interest:
209
+
210
+ ```python
211
+ # Select structures to keep by their name
212
+ names_to_keep = ["thalamus", "cerebellum"]
213
+
214
+ # Keep only the specified structures
215
+ vol_parc.keep_by_name(names2keep=names_to_keep)
216
+
217
+ # Save the modified parcellation
218
+ out_parc_path = "/tmp/sub-test_desc-tha+cer_dseg.nii.gz"
219
+ vol_parc.save_parcellation(out_parc_path, save_lut=True)
220
+ ```
221
+
222
+ #### surfacetools - Surface Geometry Processing
223
+
224
+ **Purpose**: Brain surface mesh processing and advanced visualization
225
+
226
+ **Key Classes**:
227
+
228
+ - `Surface`: Comprehensive surface management
229
+ - FreeSurfer surface file support (.pial, .white, .inflated)
230
+ - Scalar data overlay and visualization
231
+ - Parcellation integration
232
+ - PyVista-powered 3D rendering
233
+
234
+ **Key Features**:
235
+
236
+ - Multi-format surface loading
237
+ - Scalar map management and visualization
238
+ - Interactive 3D plotting
239
+ - Surface-based analysis tools
240
+
241
+ **Usage Example**:
242
+
243
+ ```python
244
+ from clabtoolkit.surfacetools import Surface
245
+
246
+ # Load surface with scalar data
247
+ surface = Surface("/path/to/lh.pial")
248
+ surface.load_scalar_data("/path/to/thickness.mgh", maps_names="Thickness")
249
+ surface.plot(overlay_name="Thickness", cmap='viridis', views=["lateral", "medial"])
250
+
251
+ # Load annotations
252
+ surface.load_annotation("/path/to/lh.aparc.annot", 'aparc')
253
+ surface.plot(overlay_name="Thickness", cmap='viridis', views="8_views")
254
+ ```
255
+
256
+ #### morphometrytools - Morphometric Analysis
257
+
258
+ **Purpose**: Surface-based morphometric computations and statistics
259
+
260
+ **Key Features**:
261
+
262
+ - Regional value extraction from surface annotations
263
+ - Multi-hemisphere morphometric analysis
264
+ - Statistical summary generation
265
+ - Integration with parcellation workflows
266
+
267
+ **Usage Examples**:
268
+
269
+ Extract regional values by combining vertex-wise surface metrics with anatomical parcellation data:
270
+
271
+ ```python
272
+ import clabtoolkit.morphometrytools as morpho
273
+
274
+ metric_file = '/path/to/metric/lh.thickness'
275
+ parc_file = '/path/to/annotation/lh.atlas.annot'
276
+
277
+ df_region, metric_values, _ = morpho.compute_reg_val_fromannot(
278
+ metric_file, parc_file, hemi, metric=metric_name, include_global=False
279
+ )
280
+ ```
281
+
282
+ Compute regional statistics from a volumetric metric map and a parcellation:
283
+
284
+ ```python
285
+ import clabtoolkit.morphometrytools as morpho
286
+
287
+ metric_file = '/path/to/metric/fa.nii.gz'
288
+ parc_file = '/path/to/parcellation/parc.nii.gz'
289
+
290
+ # Compute regional statistics
291
+ df, metric_values, _ = morpho.compute_reg_val_fromparcellation(
292
+ metric_file, parc_file, metric='intensity'
293
+ )
294
+ ```
295
+
296
+ ### Specialized Analysis
297
+
298
+ #### dwitools - Diffusion MRI Analysis
299
+
300
+ **Purpose**: Diffusion-weighted imaging analysis and tractography processing
301
+
302
+ **Key Features**:
303
+
304
+ - DWI volume manipulation and quality control
305
+ - Tractography file processing (.trk, .tck formats)
306
+ - Bundle analysis and clustering
307
+
308
+ **Usage Example**:
309
+
310
+ ```python
311
+ from clabtoolkit.dwitools import delete_dwi_volumes
312
+
313
+ # Remove specific DWI volumes
314
+ delete_dwi_volumes(
315
+ dwi_file="dwi.nii.gz",
316
+ bval_file="dwi.bval",
317
+ bvec_file="dwi.bvec",
318
+ volumes_to_delete=[0, 5, 10] # Remove specific volumes
319
+ )
320
+ ```
321
+
322
+ #### networktools - Graph Analysis
323
+
324
+ **Purpose**: Network analysis and graph theory applications for brain connectivity
325
+
326
+ **Key Features**:
327
+
328
+ - Graph representation creation from brain meshes
329
+ - Sparse matrix operations for large-scale networks
330
+ - Connectivity analysis utilities
331
+
332
+ **Usage Example**:
333
+
334
+ ```python
335
+ from clabtoolkit.networktools import triangulated_mesh_to_csr
336
+
337
+ # Convert mesh to graph representation
338
+ graph = triangulated_mesh_to_csr(vertices, faces)
339
+ ```
340
+
341
+ #### segmentationtools - Image Segmentation
342
+
343
+ **Purpose**: Atlas-based and automated image segmentation
344
+
345
+ **Key Features**:
346
+
347
+ - Atlas-based parcellation using ANTs
348
+ - Template registration workflows
349
+ - Multi-atlas segmentation support
350
+
351
+ **Usage Example**:
352
+
353
+ ```python
354
+ from clabtoolkit.segmentationtools import abased_parcellation
355
+
356
+ # Perform atlas-based segmentation
357
+ abased_parcellation(
358
+ moving_image="T1w.nii.gz",
359
+ atlas_image="template.nii.gz",
360
+ atlas_labels="template_labels.nii.gz"
361
+ )
362
+ ```
363
+
364
+ ### Quality Control and Visualization
365
+
366
+ #### qcqatools - Quality Control Framework
367
+
368
+ **Purpose**: Comprehensive quality assessment for neuroimaging data
369
+
370
+ **Key Features**:
371
+
372
+ - Automated slice selection for quality control
373
+ - Multi-modal data validation
374
+ - Visual quality assessment tools
375
+ - Report generation capabilities
376
+
377
+ #### visualizationtools - Advanced Brain Visualization
378
+
379
+ **Purpose**: Publication-quality brain visualization system
380
+
381
+ **Key Classes**:
382
+
383
+ - `BrainPlotter`: Multi-view brain surface visualization
384
+ - Configurable view layouts
385
+ - Custom colormap support
386
+ - Publication-ready output
387
+ - Multi-hemisphere rendering
388
+
389
+ **Key Features**:
390
+
391
+ - JSON-based view configuration system
392
+ - Flexible layout management
393
+ - High-quality rendering for publications
394
+ - Interactive visualization capabilities
395
+
396
+ ### Utilities and Infrastructure
397
+
398
+ #### misctools - Core Utilities
399
+
400
+ **Purpose**: Foundation utility functions supporting all modules
401
+
402
+ **Key Features**:
403
+
404
+ - Enhanced command-line argument parsing
405
+ - File system operations
406
+ - Color processing utilities
407
+ - Documentation generation helpers
408
+
409
+ #### pipelinetools - Workflow Management
410
+
411
+ **Purpose**: Pipeline orchestration and batch processing
412
+
413
+ **Key Features**:
414
+
415
+ - Subject ID management for batch workflows
416
+ - Parallel processing utilities
417
+ - Progress tracking and monitoring
418
+
419
+ #### plottools - Plotting Infrastructure
420
+
421
+ **Purpose**: Low-level plotting support and layout calculations
422
+
423
+ **Key Features**:
424
+
425
+ - Dynamic subplot grid calculation
426
+ - Screen size detection
427
+ - Multi-monitor support
428
+
429
+ #### dicomtools - DICOM Processing
430
+
431
+ **Purpose**: DICOM file organization and BIDS conversion
432
+
433
+ **Key Features**:
434
+
435
+ - Multi-threaded DICOM organization
436
+ - BIDS conversion workflows
437
+ - Demographics integration
438
+ - Session management
439
+
440
+ ## Configuration System
441
+
442
+ clabtoolkit uses a sophisticated JSON-based configuration system located in `clabtoolkit/config/`:
443
+
444
+ - **bids.json**: BIDS entity definitions and validation rules
445
+ - **viz_views.json**: Visualization layout configurations
446
+ - **lobes.json**: Anatomical lobe definitions for parcellation
447
+ - **stats_mapping.json**: Statistical measure mappings and metadata
448
+
449
+ ## Dependencies
450
+
451
+ ### Core Dependencies
452
+
453
+ - **nibabel**: Neuroimaging file I/O
454
+ - **numpy**: Numerical computing
455
+ - **pandas**: Data manipulation
456
+ - **scipy**: Scientific computing
457
+ - **matplotlib**: Basic plotting
458
+
459
+ ### Specialized Dependencies
460
+
461
+ - **pyvista**: 3D visualization and mesh processing
462
+ - **rich**: Enhanced console output
463
+ - **dipy**: Diffusion MRI processing
464
+ - **h5py**: HDF5 file support
465
+
466
+ ### Environment
467
+
468
+ All dependencies are specified in the **environment.yaml** file for reproducible conda environments.
469
+
470
+ ## Contributing
471
+
472
+ 1. Fork the repository
473
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
474
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
475
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
476
+ 5. Open a Pull Request
477
+
478
+ ## Support and Documentation
479
+
480
+ - **GitHub Issues**: Report bugs and request features
481
+ - **Documentation**: Comprehensive API documentation with examples
482
+ - **Test Suite**: Extensive test coverage with example data
483
+ - **Jupyter Notebooks**: Interactive examples and tutorials
484
+
485
+ ## Research Applications
486
+
487
+ clabtoolkit is particularly well-suited for:
488
+
489
+ - **Connectomics Research**: Brain connectivity analysis and visualization
490
+ - **Surface-based Analysis**: Cortical thickness, area, and curvature studies
491
+ - **BIDS Data Management**: Large-scale neuroimaging dataset organization
492
+ - **Multi-modal Integration**: Combined structural and diffusion MRI analysis
493
+ - **Quality Control**: Automated quality assessment for neuroimaging data
494
+ - **Publication Visualization**: High-quality brain visualizations for research papers
495
+
496
+ ---
497
+
498
+ _This toolkit represents a comprehensive solution for modern neuroimaging research, combining robust data management with advanced analysis capabilities and publication-quality visualization tools._
@@ -2,6 +2,29 @@
2
2
  History
3
3
  =======
4
4
 
5
+ 0.4.5 (2026-08-28)
6
+ ------------------
7
+
8
+ * Added create_5tt to parcellationtools to generate MRtrix3 5TT images
9
+ * Added a method to merge the cortical gray matter with the white matter adjacent to the cortex, and used the merged image to build the 5TT image
10
+ * Added the apply_affine method to the Surface, PointCloud and Tractogram classes, with an inplace option
11
+ * Added connected components detection for binary images
12
+ * Added the option to interpolate on Parcellation objects
13
+ * Added a method to compare dictionaries
14
+ * Added the process_subject function to bidstools
15
+ * Added the brain_pos_col and cb_pos functions to build_visualization_layout
16
+ * Added the ventral DC to the list of subcortical regions
17
+ * Added examples for create_5tt, merge_ctx_wm, apply_cras and apply_affine
18
+ * Refactored the visualizationtools module and fixed several plotting errors
19
+ * Renamed the force parameter to overwrite in all the functions and methods writing files
20
+ * Renamed the transform method of the PointCloud class to apply_affine
21
+ * Fixed the apply_cras method of the Surface class
22
+ * Fixed a bug in the subject selection of bidstools
23
+ * Fixed the line spacing, the append handling and the header lines of export_to_lutctab in colorstools
24
+ * Fixed the anchors, the links and the FreeSurfer paths of the notebooks
25
+ * Silenced the tight_layout warning of create_carpet_plot
26
+ * Raised the minimum Python version to 3.11 and adopted the built-in generics and the union operator in the type hints
27
+
5
28
  0.4.4 (2026-07-17)
6
29
  ------------------
7
30
 
@@ -5,21 +5,36 @@ include LICENSE
5
5
  include README.rst
6
6
  include pyproject.toml
7
7
 
8
+ # Project metadata and reproducible environments
9
+ include DOCUMENTATION.md
10
+ include architecture_diagram.md
11
+ include Makefile
12
+ include tox.ini
13
+ include requirements.txt
14
+ include requirements_dev.txt
15
+ include requirements-docs.txt
16
+ include environment.yaml
17
+ include environment-mac.yaml
18
+
8
19
  # Include package source code
9
20
  recursive-include clabtoolkit *.py
10
21
  recursive-include clabtoolkit/config *.json
11
22
 
12
23
  # Include documentation
13
- recursive-include docs *.rst *.py *.bat *.png
24
+ recursive-include docs *.rst *.py *.bat *.png *.ico
14
25
  recursive-include docs Makefile
15
26
  include docs/make.bat
16
27
 
17
28
  # Include usage examples
18
29
  recursive-include usage_examples *.ipynb *.py *.md
19
30
 
20
- # EXCLUDE tests data completely
31
+ # EXCLUDE tests data completely
21
32
  prune tests
22
33
 
34
+ # Build output and tool caches must never reach the sdist
35
+ prune docs/build
36
+ prune usage_examples/nilearn_cache
37
+
23
38
  # Exclude unwanted files (only those that exist)
24
39
  recursive-exclude * __pycache__
25
40
  recursive-exclude * *.py[co]
@@ -0,0 +1,87 @@
1
+ .PHONY: clean clean-build clean-pyc clean-test coverage dist docs help install lint lint/flake8
2
+ .DEFAULT_GOAL := help
3
+
4
+ define BROWSER_PYSCRIPT
5
+ import os, webbrowser, sys
6
+
7
+ from urllib.request import pathname2url
8
+
9
+ webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
10
+ endef
11
+ export BROWSER_PYSCRIPT
12
+
13
+ define PRINT_HELP_PYSCRIPT
14
+ import re, sys
15
+
16
+ for line in sys.stdin:
17
+ match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
18
+ if match:
19
+ target, help = match.groups()
20
+ print("%-20s %s" % (target, help))
21
+ endef
22
+ export PRINT_HELP_PYSCRIPT
23
+
24
+ BROWSER := python -c "$$BROWSER_PYSCRIPT"
25
+
26
+ help:
27
+ @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
28
+
29
+ clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
30
+
31
+ clean-build: ## remove build artifacts
32
+ rm -fr build/
33
+ rm -fr dist/
34
+ rm -fr .eggs/
35
+ find . -name '*.egg-info' -exec rm -fr {} +
36
+ find . -name '*.egg' -exec rm -f {} +
37
+
38
+ clean-pyc: ## remove Python file artifacts
39
+ find . -name '*.pyc' -exec rm -f {} +
40
+ find . -name '*.pyo' -exec rm -f {} +
41
+ find . -name '*~' -exec rm -f {} +
42
+ find . -name '__pycache__' -exec rm -fr {} +
43
+
44
+ clean-test: ## remove test and coverage artifacts
45
+ rm -fr .tox/
46
+ rm -f .coverage
47
+ rm -fr htmlcov/
48
+ rm -fr .pytest_cache
49
+
50
+ lint/flake8: ## check style with flake8
51
+ flake8 clabtoolkit tests
52
+
53
+ lint: lint/flake8 ## check style
54
+
55
+ test: ## run tests quickly with the default Python
56
+ python setup.py test
57
+
58
+ test-all: ## run tests on every Python version with tox
59
+ tox
60
+
61
+ coverage: ## check code coverage quickly with the default Python
62
+ coverage run --source clabtoolkit setup.py test
63
+ coverage report -m
64
+ coverage html
65
+ $(BROWSER) htmlcov/index.html
66
+
67
+ docs: ## generate Sphinx HTML documentation, including API docs
68
+ rm -f docs/clabtoolkit.rst
69
+ rm -f docs/modules.rst
70
+ sphinx-apidoc -o docs/ clabtoolkit
71
+ $(MAKE) -C docs clean
72
+ $(MAKE) -C docs html
73
+ $(BROWSER) docs/_build/html/index.html
74
+
75
+ servedocs: docs ## compile the docs watching for changes
76
+ watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .
77
+
78
+ release: dist ## package and upload a release
79
+ twine upload dist/*
80
+
81
+ dist: clean ## builds source and wheel package
82
+ python setup.py sdist
83
+ python setup.py bdist_wheel
84
+ ls -l dist
85
+
86
+ install: clean ## install the package to the active Python's site-packages
87
+ python setup.py install
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clabtoolkit
3
- Version: 0.4.4
3
+ Version: 0.4.5
4
4
  Summary: A comprehensive toolkit for neuroimaging data processing and analysis
5
5
  Author-email: Yasser Alemán-Gómez <yasseraleman@protonmail.com>
6
6
  Maintainer-email: Yasser Alemán-Gómez <yasseraleman@protonmail.com>
@@ -16,13 +16,12 @@ Classifier: Intended Audience :: Developers
16
16
  Classifier: Natural Language :: English
17
17
  Classifier: Operating System :: OS Independent
18
18
  Classifier: Programming Language :: Python :: 3
19
- Classifier: Programming Language :: Python :: 3.9
20
- Classifier: Programming Language :: Python :: 3.10
21
19
  Classifier: Programming Language :: Python :: 3.11
22
20
  Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
23
22
  Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
24
23
  Classifier: Topic :: Scientific/Engineering :: Image Processing
25
- Requires-Python: >=3.9
24
+ Requires-Python: >=3.11
26
25
  Description-Content-Type: text/x-rst
27
26
  License-File: LICENSE
28
27
  License-File: AUTHORS.rst