diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7f558cb..a744563 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,6 +25,12 @@ repos: rev: v4.0.0-alpha.8 hooks: - id: prettier + - repo: https://github.com/codespell-project/codespell + rev: v2.2.6 + hooks: + - id: codespell + args: [--write-changes] + exclude: src/hipct_reg/reg_inventory.csv - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 hooks: diff --git a/docs/guide.rst b/docs/guide.rst index 919f42c..3a4a9c9 100644 --- a/docs/guide.rst +++ b/docs/guide.rst @@ -21,7 +21,7 @@ This provides a starting point for the registration code. Initial rotational registration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The first step of the automated pipeline finds the approximate relative rotation about the z-axis betweeen the two datasets. +The first step of the automated pipeline finds the approximate relative rotation about the z-axis between the two datasets. It does this by fixing the centre of rotation at the common point identified in both datasets, and then: 1. Scanning through the whole 0 - 360 degree angle range at a resolution of 2 degrees, and identifying the best match. diff --git a/docs/new_datasets.rst b/docs/new_datasets.rst index f85f33e..692a062 100644 --- a/docs/new_datasets.rst +++ b/docs/new_datasets.rst @@ -37,7 +37,7 @@ will be shown in three panels, which show: 2. The registered ROI dataset (in the registered coordinates). 3. The original full-organ dataset. -Compare panels 2 and 3. If the reigstration looks good, hit the "Good" button +Compare panels 2 and 3. If the registration looks good, hit the "Good" button and the registration parameters will be save to the registration inventory. If the registration looks bad, type a reason in the notes text entry and hit the "Bad" button. This will save the notes in the registration inventory. diff --git a/docs/tutorial/tutorial.py b/docs/tutorial/tutorial.py index 5f4430f..cb148f2 100644 --- a/docs/tutorial/tutorial.py +++ b/docs/tutorial/tutorial.py @@ -56,7 +56,7 @@ transform, reg_metric = run_registration(reg_input) # %% -# This resturns two objects - the registered transform, and the registration metric. +# This returns two objects - the registered transform, and the registration metric. # The transform maps from the physical coordinates of the ROI image to the physical # coordinates of the full-organ image. For HiP-CT data these are just the voxel # coordinates multiplied by the image resolution. diff --git a/notebooks/plot_size_xy.py b/notebooks/plot_size_xy.py index f05317b..b0090fc 100644 --- a/notebooks/plot_size_xy.py +++ b/notebooks/plot_size_xy.py @@ -125,7 +125,7 @@ def get_rot(df: pd.DataFrame) -> float: # %% [markdown] # ## Context -# The goal of this experiement is to verify the variation in registration parameters (rotation, translation, scale) as the size of the cuboids being registered increases. This should show at what point the registration converges (ie at what point adding more pixels isn't adding anything to the registration). +# The goal of this experiment is to verify the variation in registration parameters (rotation, translation, scale) as the size of the cuboids being registered increases. This should show at what point the registration converges (ie at what point adding more pixels isn't adding anything to the registration). # # ## Figure overview # Each registration parameter (y-axis) is plotted against the size of the full-organ cuboid in the x-y plane. All cuboids have a thickness along the z-axis of 32 pixels. The high-resolution ROI cuboids have a larger number of pixels so they are the same physical size as the full-organ cuboids. Each colour represents a different dataset, taken from three different organs. diff --git a/notebooks/sitk_transfroms.py b/notebooks/sitk_transfroms.py index 87a2d46..4435ecd 100644 --- a/notebooks/sitk_transfroms.py +++ b/notebooks/sitk_transfroms.py @@ -50,7 +50,7 @@ # - The pixel spacing in physical distance units. # - The physical coordinate of the (0, 0) pixel. # -# Here we put the raw data array into an `Image`, but for now leave the spacing and origin as default values. We also define a helper funciton to plot an `Image`, which we'll use throughout this notebook to understand what's going on. +# Here we put the raw data array into an `Image`, but for now leave the spacing and origin as default values. We also define a helper function to plot an `Image`, which we'll use throughout this notebook to understand what's going on. # %% @@ -79,7 +79,7 @@ def show_image(image: sitk.Image, ax: matplotlib.axes.Axes, **imshow_kwargs): ax.set_title("Full resolution image") # %% [markdown] -# To start with we'll just try registring a cut out of this image to the full image. This will illustrate how the translation element of transformations works. +# To start with we'll just try registering a cut out of this image to the full image. This will illustrate how the translation element of transformations works. # %% offset_cutout = (150, 100) @@ -159,7 +159,7 @@ def get_reg_method() -> sitk.ImageRegistrationMethod: # %% [markdown] -# Now we can get an instance of the registration method, and set the initial transform. In order to avoid changing the scaling or rotation angle during optimization we set the optimizer weights for these paramters to zero. +# Now we can get an instance of the registration method, and set the initial transform. In order to avoid changing the scaling or rotation angle during optimization we set the optimizer weights for these parameters to zero. # # Then we run the registration, and check the results... diff --git a/src/hipct_reg/data.py b/src/hipct_reg/data.py index 92a6c74..e636def 100644 --- a/src/hipct_reg/data.py +++ b/src/hipct_reg/data.py @@ -151,7 +151,7 @@ def get_reg_input( The size of the full-organ scan cube can be changed. - Data is cahed on disk to ~/hipct/reg_data so it doesn't need to be re-downloaded. + Data is cached on disk to ~/hipct/reg_data so it doesn't need to be re-downloaded. """ full_dataset = datasets[full_name] assert ( diff --git a/src/hipct_reg/helpers.py b/src/hipct_reg/helpers.py index 3ef6494..7eada0e 100644 --- a/src/hipct_reg/helpers.py +++ b/src/hipct_reg/helpers.py @@ -13,7 +13,7 @@ class PixelTransformDict(TypedDict): """ - Parameters for a pixel-to-pixel transfrom, mapping from a ROI to a full-organ + Parameters for a pixel-to-pixel transform, mapping from a ROI to a full-organ image. """ @@ -29,7 +29,7 @@ def get_pixel_transform_params( coord_transform: sitk.Similarity3DTransform, ) -> PixelTransformDict: """ - Convert the registered transform to a pixel-to-pixel transfrom mapping from a ROI + Convert the registered transform to a pixel-to-pixel transform mapping from a ROI to a full-organ image. """ translation = coord_transform.TransformPoint((0, 0, 0)) diff --git a/src/hipct_reg/registration.py b/src/hipct_reg/registration.py index 7b15e3f..cdf6418 100644 --- a/src/hipct_reg/registration.py +++ b/src/hipct_reg/registration.py @@ -145,7 +145,7 @@ def registration_rigid( """ Run a registration using a full rigid transform. - The returned transform maps from the ROI iamge to the full-organ image. + The returned transform maps from the ROI image to the full-organ image. Parameters ---------- @@ -155,7 +155,7 @@ def registration_rigid( Returns ------- transform : - Registered transform from ROI iamge to the full-organ image. + Registered transform from ROI image to the full-organ image. metric : Registration metric at the final step. The registration metric is @@ -276,7 +276,7 @@ def run_registration( Returns ------- transform : - Registered transform from ROI iamge to the full-organ image. + Registered transform from ROI image to the full-organ image. metric : Registration metric at the final step. The registration metric is