Skip to content

Commit a43fe87

Browse files
authored
Add codespell support (config, workflow to detect/not fix) and make it fix few typos (#1159)
* Add github action to codespell master on push and PRs * Add rudimentary codespell config * Add pre-commit definition for codespell * Skips for codespell * [DATALAD RUNCMD] run codespell throughout fixing typos automagically (but ignoring overall fail due to ambigous ones) === Do not change lines below === { "chain": [], "cmd": "codespell -w || :", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ * [DATALAD RUNCMD] Do interactive fixing of some ambigous typos === Do not change lines below === { "chain": [], "cmd": "codespell -w -i 3 -C 2", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ * Remove duplicate pre-commit config for codespell, move config on ignored words into pyproject.toml * Boost codespell to 2.4.1 * Simplify regex since those words are generally skipped anyways in any casing
1 parent 16dacbd commit a43fe87

16 files changed

+90
-60
lines changed

.github/workflows/codespell.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Codespell configuration is within pyproject.toml
2+
---
3+
name: Codespell
4+
5+
on:
6+
push:
7+
branches: [master]
8+
pull_request:
9+
branches: [master]
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
codespell:
16+
name: Check for spelling errors
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
- name: Annotate locations with typos
23+
uses: codespell-project/codespell-problem-matcher@v1
24+
- name: Codespell
25+
uses: codespell-project/actions-codespell@v2

.pre-commit-config.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,11 @@ repos:
4545
files: README.rst
4646
name: rst-linter of README.rst
4747
- repo: https://github.com/codespell-project/codespell
48-
rev: v2.3.0
48+
rev: v2.4.1
4949
hooks:
5050
- id: codespell
51-
exclude: (?x)^(.*\.ipynb)$
52-
args:
53-
- --ignore-words-list
54-
- "hist,indext,pixelx,thex,subtile,nd,hsi,bult,vor"
51+
additional_dependencies:
52+
- tomli # for python_version < '3.11'
5553
- repo: https://github.com/syntaqx/git-hooks
5654
rev: v0.0.18
5755
hooks:

docs/examples/annotation_database_backup_and_sql_parser.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
" callback_kwargs : dict\n",
145145
" kwargs to pass along to callback. DO NOT pass any of the parameters\n",
146146
" item, annotations, local, monitorPrefix, or dbcon as these will be\n",
147-
" internally passed. Just include any specific paremeters for the\n",
147+
" internally passed. Just include any specific parameters for the\n",
148148
" callback. See parse_annotations_to_local_tables() above for\n",
149149
" an example of a callback and the unir test of this function.\n",
150150
"\n",

docs/examples/annotations_to_object_segmentation_masks.ipynb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,13 @@
141141
"\n",
142142
"- ```group```: group name of annotation (string), eg. \"mostly_tumor\"\n",
143143
"- ```overlay_order```: int, how early to place the annotation in the\n",
144-
" mask. Larger values means this annotation group is overlayed\n",
144+
" mask. Larger values means this annotation group is overlaid\n",
145145
" last and overwrites whatever overlaps it.\n",
146146
"- ```GT_code```: int, desired ground truth code (in the labeled mask)\n",
147147
" Pixels of this value belong to corresponding group (class)\n",
148148
"- ```is_roi```: Flag for whether this group marks 'special' annotations that encode the ROI boundary\n",
149149
"- ```is_background_class```: Flag, whether this group is the default\n",
150-
" fill value inside the ROI. For example, you may descide that\n",
150+
" fill value inside the ROI. For example, you may decide that\n",
151151
" any pixel inside the ROI is considered stroma.\n",
152152
" \n",
153153
"**NOTE:** \n",
@@ -210,7 +210,7 @@
210210
"source": [
211211
"## Generate contours for user-defined region\n",
212212
"\n",
213-
"Algorithms like Mask-RCNN consume coordinate data describing the boundaries of objects. The function ``annotations_to_contours_no_mask`` generates this countour data for user-specified region. These coordinate data in these contours is relative to the region frame instead of the whole-slide image frame."
213+
"Algorithms like Mask-RCNN consume coordinate data describing the boundaries of objects. The function ``annotations_to_contours_no_mask`` generates this contour data for user-specified region. These coordinate data in these contours is relative to the region frame instead of the whole-slide image frame."
214214
]
215215
},
216216
{
@@ -280,7 +280,7 @@
280280
" get rgb image?\n",
281281
"\n",
282282
" get_visualization : bool\n",
283-
" get overlayed annotation bounds over RGB for visualization\n",
283+
" get overlaid annotation bounds over RGB for visualization\n",
284284
"\n",
285285
" text : bool\n",
286286
" add text labels to visualization?\n",
@@ -610,7 +610,7 @@
610610
"**NOTE:**\n",
611611
"\n",
612612
"This does not rely on tiles and processes the image at whatever magnification you want. \n",
613-
"You can supress the RGB or visualization outputs and to just fetch the contours or object segmentation mask (see below), providing a bigger magnification range before encountering memory problems."
613+
"You can suppress the RGB or visualization outputs and to just fetch the contours or object segmentation mask (see below), providing a bigger magnification range before encountering memory problems."
614614
]
615615
},
616616
{
@@ -755,13 +755,13 @@
755755
" each entry is in turn a dict with the following keys:\n",
756756
" - group: group name of annotation (string), eg. mostly_tumor\n",
757757
" - overlay_order: int, how early to place the annotation in the\n",
758-
" mask. Larger values means this annotation group is overlayed\n",
758+
" mask. Larger values means this annotation group is overlaid\n",
759759
" last and overwrites whatever overlaps it.\n",
760760
" - GT_code: int, desired ground truth code (in the mask)\n",
761761
" Pixels of this value belong to corresponding group (class)\n",
762762
" - is_roi: Flag for whether this group encodes an ROI\n",
763763
" - is_background_class: Flag, whether this group is the default\n",
764-
" fill value inside the ROI. For example, you may descide that\n",
764+
" fill value inside the ROI. For example, you may decide that\n",
765765
" any pixel inside the ROI is considered stroma.\n",
766766
"\n",
767767
" save_directories : dict\n",
@@ -770,7 +770,7 @@
770770
" - ROI: path to save masks (labeled images)\n",
771771
" - rgb: path to save rgb images\n",
772772
" - contours: path to save annotation contours\n",
773-
" - visualization: path to save rgb visualzation overlays\n",
773+
" - visualization: path to save rgb visualization overlays\n",
774774
"\n",
775775
" mode : str\n",
776776
" run mode for getting masks. Must me in\n",
@@ -819,7 +819,7 @@
819819
" mask - path to saved mask\n",
820820
" rgb - path to saved rgb image\n",
821821
" contours - path to saved annotation contours\n",
822-
" visualization - path to saved rgb visualzation overlay\n",
822+
" visualization - path to saved rgb visualization overlay\n",
823823
"\n",
824824
" \n"
825825
]
@@ -854,12 +854,12 @@
854854
" All coordinates are relative to the mask that you want to output.\n",
855855
" The following columns are expected.\n",
856856
" - group: str, annotation group (ground truth label).\n",
857-
" - ymin: int, minimun y coordinate\n",
857+
" - ymin: int, minimum y coordinate\n",
858858
" - ymax: int, maximum y coordinate\n",
859859
" - xmin: int, minimum x coordinate\n",
860860
" - xmax: int, maximum x coordinate\n",
861-
" - coords_x: str, vertix x coordinates comma-separated values\n",
862-
" - coords_y: str, vertix y coordinated comma-separated values\n",
861+
" - coords_x: str, vertex x coordinates comma-separated values\n",
862+
" - coords_y: str, vertex y coordinated comma-separated values\n",
863863
"\n",
864864
" gtcodes : DataFrame\n",
865865
" the ground truth codes and information dataframe.\n",
@@ -883,7 +883,7 @@
883883
" print to screen?\n",
884884
"\n",
885885
" monitorprefix : str\n",
886-
" prefix to add to printed statemens\n",
886+
" prefix to add to printed statements\n",
887887
"\n",
888888
" Returns\n",
889889
" -------\n",

docs/examples/annotations_to_semantic_segmentation_masks.ipynb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"\n",
5050
"* **manual_bounds**: use given xy coordinate bounds provided by the 'bounds' param\n",
5151
"\n",
52-
"* **polygonal_bounds**: use manually-drawn polygonal (or rectanglar) ROI boundaries\n",
52+
"* **polygonal_bounds**: use manually-drawn polygonal (or rectangular) ROI boundaries\n",
5353
"\n",
5454
"**Here is a sample result:**\n",
5555
"\n",
@@ -156,13 +156,13 @@
156156
"\n",
157157
"- ```group```: group name of annotation (string), eg. \"mostly_tumor\"\n",
158158
"- ```overlay_order```: int, how early to place the annotation in the\n",
159-
" mask. Larger values means this annotation group is overlayed\n",
159+
" mask. Larger values means this annotation group is overlaid\n",
160160
" last and overwrites whatever overlaps it.\n",
161161
"- ```GT_code```: int, desired ground truth code (in the semantic segmentation mask)\n",
162162
" Pixels of this value belong to corresponding group (class)\n",
163163
"- ```is_roi```: Flag for whether this group marks 'special' annotations that encode the ROI boundary\n",
164164
"- ```is_background_class```: Flag, whether this group is the default\n",
165-
" fill value inside the ROI. For example, you may descide that\n",
165+
" fill value inside the ROI. For example, you may decide that\n",
166166
" any pixel inside the ROI is considered stroma.\n",
167167
" \n",
168168
"**NOTE:** \n",
@@ -213,7 +213,7 @@
213213
"parameters. The method output includes the RGB image of the defined region, \n",
214214
"the corresponding semantic segmentation mask, xy coordinates of annotations relative \n",
215215
"to the mask, and a visualization overlay of the annotations on the RGB image that\n",
216-
"mimicks the HistomicsUI visualization of the region.\n",
216+
"mimics the HistomicsUI visualization of the region.\n",
217217
"\n",
218218
"The function ``get_image_and_mask_from_slide()`` implements mask generation."
219219
]
@@ -248,13 +248,13 @@
248248
" each entry is in turn a dict with the following keys:\n",
249249
" - group: group name of annotation (string), eg. mostly_tumor\n",
250250
" - overlay_order: int, how early to place the annotation in the\n",
251-
" mask. Larger values means this annotation group is overlayed\n",
251+
" mask. Larger values means this annotation group is overlaid\n",
252252
" last and overwrites whatever overlaps it.\n",
253253
" - GT_code: int, desired ground truth code (in the mask)\n",
254254
" Pixels of this value belong to corresponding group (class)\n",
255255
" - is_roi: Flag for whether this group encodes an ROI\n",
256256
" - is_background_class: Flag, whether this group is the default\n",
257-
" fill value inside the ROI. For example, you may descide that\n",
257+
" fill value inside the ROI. For example, you may decide that\n",
258258
" any pixel inside the ROI is considered stroma.\n",
259259
"\n",
260260
" MPP : float or None\n",
@@ -312,7 +312,7 @@
312312
" get annotation contours? (relative to final mask)\n",
313313
"\n",
314314
" get_visualization : bool\n",
315-
" get overlayed annotation bounds over RGB for visualization\n",
315+
" get overlaid annotation bounds over RGB for visualization\n",
316316
"\n",
317317
" tau : int\n",
318318
" maximum difference (in pixels) between fetched image and mask allowed.\n",
@@ -807,13 +807,13 @@
807807
" each entry is in turn a dict with the following keys:\n",
808808
" - group: group name of annotation (string), eg. mostly_tumor\n",
809809
" - overlay_order: int, how early to place the annotation in the\n",
810-
" mask. Larger values means this annotation group is overlayed\n",
810+
" mask. Larger values means this annotation group is overlaid\n",
811811
" last and overwrites whatever overlaps it.\n",
812812
" - GT_code: int, desired ground truth code (in the mask)\n",
813813
" Pixels of this value belong to corresponding group (class)\n",
814814
" - is_roi: Flag for whether this group encodes an ROI\n",
815815
" - is_background_class: Flag, whether this group is the default\n",
816-
" fill value inside the ROI. For example, you may descide that\n",
816+
" fill value inside the ROI. For example, you may decide that\n",
817817
" any pixel inside the ROI is considered stroma.\n",
818818
"\n",
819819
" save_directories : dict\n",
@@ -822,7 +822,7 @@
822822
" - ROI: path to save masks (labeled images)\n",
823823
" - rgb: path to save rgb images\n",
824824
" - contours: path to save annotation contours\n",
825-
" - visualization: path to save rgb visualzation overlays\n",
825+
" - visualization: path to save rgb visualization overlays\n",
826826
"\n",
827827
" get_image_and_mask_from_slide_kwargs : dict\n",
828828
" kwargs to pass to get_image_and_mask_from_slide()\n",
@@ -852,7 +852,7 @@
852852
" - ROI: path to saved mask (labeled image)\n",
853853
" - rgb: path to saved rgb image\n",
854854
" - contours: path to saved annotation contours\n",
855-
" - visualization: path to saved rgb visualzation overlay\n",
855+
" - visualization: path to saved rgb visualization overlay\n",
856856
"\n",
857857
" \n"
858858
]

docs/examples/color_normalization_and_augmentation.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -715,10 +715,10 @@
715715
"text": [
716716
"Perturb stain concentrations in SDA space and return augmented image.\n",
717717
"\n",
718-
" This is an implementeation of the method described in Tellez et\n",
718+
" This is an implementation of the method described in Tellez et\n",
719719
" al, 2018 (see below). The SDA matrix is perturbed by multiplying each\n",
720-
" channel independently by a value choosen from a random uniform distribution\n",
721-
" in the range [1 - sigma1, 1 + sigma1], then add a value chosed from another\n",
720+
" channel independently by a value chosen from a random uniform distribution\n",
721+
" in the range [1 - sigma1, 1 + sigma1], then add a value chose from another\n",
722722
" random uniform distribution in the range [-sigma2, sigma2].\n",
723723
"\n",
724724
" Parameters\n",

docs/examples/create_classifier.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"cell_type": "markdown",
2727
"metadata": {},
2828
"source": [
29-
"Open the Nuclei Feature extraction panel in DSA and upload the image data into *Input Image* area shown below. Provide the location for both feature file and annotation files to be saved. Then press submit to start the process.The cli will generate the feature file requried for the classifier. Annotation file is not required for creating the classfier.\n",
29+
"Open the Nuclei Feature extraction panel in DSA and upload the image data into *Input Image* area shown below. Provide the location for both feature file and annotation files to be saved. Then press submit to start the process.The cli will generate the feature file required for the classifier. Annotation file is not required for creating the classifier.\n",
3030
"\n",
3131
"![DSA panel.png](https://data.kitware.com/api/v1/file/hashsum/sha512/10f88a5400e7fa46605e3f75530ae8703a429fbbf1185444a14fa40beec251434d19760de90bdaae25b5ece3557b502b59e40fab377b3df5978088b14c3a14e2/download)"
3232
]

docs/examples/creating_gallery_images_review.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,13 +345,13 @@
345345
" each entry is in turn a dict with the following keys:\n",
346346
" - group: group name of annotation (string), eg. mostly_tumor\n",
347347
" - overlay_order: int, how early to place the annotation in the\n",
348-
" mask. Larger values means this annotation group is overlayed\n",
348+
" mask. Larger values means this annotation group is overlaid\n",
349349
" last and overwrites whatever overlaps it.\n",
350350
" - GT_code: int, desired ground truth code (in the mask)\n",
351351
" Pixels of this value belong to corresponding group (class)\n",
352352
" - is_roi: Flag for whether this group encodes an ROI\n",
353353
" - is_background_class: Flag, whether this group is the default\n",
354-
" fill value inside the ROI. For example, you may descide that\n",
354+
" fill value inside the ROI. For example, you may decide that\n",
355355
" any pixel inside the ROI is considered stroma.\n",
356356
"\n",
357357
" save_directories : dict\n",
@@ -360,7 +360,7 @@
360360
" - ROI: path to save masks (labeled images)\n",
361361
" - rgb: path to save rgb images\n",
362362
" - contours: path to save annotation contours\n",
363-
" - visualization: path to save rgb visualzation overlays\n",
363+
" - visualization: path to save rgb visualization overlays\n",
364364
"\n",
365365
" mode : str\n",
366366
" run mode for getting masks. Must me in\n",
@@ -406,7 +406,7 @@
406406
" mask - path to saved mask\n",
407407
" rgb - path to saved rgb image\n",
408408
" contours - path to saved annotation contours\n",
409-
" visualization - path to saved rgb visualzation overlay\n",
409+
" visualization - path to saved rgb visualization overlay\n",
410410
"\n",
411411
" \n"
412412
]
@@ -461,7 +461,7 @@
461461
" MPP : float\n",
462462
" microns per pixel\n",
463463
" MAG : float\n",
464-
" magnification. superceded by MPP.\n",
464+
" magnification. superseded by MPP.\n",
465465
" combinedvis_savepath : str\n",
466466
" path to save the combined visualization\n",
467467
" zoomout : float\n",

docs/examples/polygon_merger_using_rtree.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,17 @@
156156
" group : str\n",
157157
" annotation group (ground truth label).\n",
158158
" ymin : int\n",
159-
" minimun y coordinate\n",
159+
" minimum y coordinate\n",
160160
" ymax : int\n",
161161
" maximum y coordinate\n",
162162
" xmin : int\n",
163163
" minimum x coordinate\n",
164164
" xmax : int\n",
165165
" maximum x coordinate\n",
166166
" coords_x : str\n",
167-
" vertix x coordinates comma-separated values\n",
167+
" vertex x coordinates comma-separated values\n",
168168
" coords_y\n",
169-
" vertix y coordinated comma-separated values\n",
169+
" vertex y coordinated comma-separated values\n",
170170
" merge_thresh : int\n",
171171
" how close do the polygons need to be (in pixels) to be merged\n",
172172
" verbose : int\n",
@@ -203,17 +203,17 @@
203203
" group : str\n",
204204
" annotation group (ground truth label).\n",
205205
" ymin : int\n",
206-
" minimun y coordinate\n",
206+
" minimum y coordinate\n",
207207
" ymax : int\n",
208208
" maximum y coordinate\n",
209209
" xmin : int\n",
210210
" minimum x coordinate\n",
211211
" xmax : int\n",
212212
" maximum x coordinate\n",
213213
" coords_x : str\n",
214-
" vertix x coordinates comma-separated values\n",
214+
" vertex x coordinates comma-separated values\n",
215215
" coords_y\n",
216-
" vertix y coordinated comma-separated values\n",
216+
" vertex y coordinated comma-separated values\n",
217217
" merge_thresh : int\n",
218218
" how close do the polygons need to be (in pixels) to be merged\n",
219219
" verbose : int\n",

docs/examples/positive_pixel_count.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
"attributes of `ppc.Labels` &ndash; `.NEGATIVE`, `.WEAK`, `.PLAIN`, and `.STRONG` &ndash;\n",
196196
"is recommended.\n",
197197
"\n",
198-
"This does a reasonably good job aleady, but let's see what happens if we shift the hue center a bit.\n",
198+
"This does a reasonably good job already, but let's see what happens if we shift the hue center a bit.\n",
199199
"Since `Parameters` is a `collections.namedtuple`, we can use its `._replace` method to substitute a value."
200200
]
201201
},

0 commit comments

Comments
 (0)