From bfe4fc10c63dc76db759f2bf135b3a7093d2a101 Mon Sep 17 00:00:00 2001 From: Tom Birdsong Date: Fri, 10 Nov 2023 15:31:45 -0500 Subject: [PATCH] WIP: docstrings --- .gitignore | 1 + src/itk_dreg/block/convert.py | 1 + src/itk_dreg/block/image.py | 2 +- .../reduce_dfield/transform_collection.py | 24 +++++++++++++++++-- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index eb4f55a..8a79e4e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ examples/output examples/mydask.png data/ +_build/ diff --git a/src/itk_dreg/block/convert.py b/src/itk_dreg/block/convert.py index da3be7e..60dac4a 100644 --- a/src/itk_dreg/block/convert.py +++ b/src/itk_dreg/block/convert.py @@ -55,6 +55,7 @@ def arr_to_continuous_index(index: Union[List, npt.ArrayLike]) -> itk.Continuous _itkContinuousIndexPython.itkContinuousIndexD3_swiginit(self, _itkContinuousIndexPython.new_itkContinuousIndexD3(*args)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: Expecting a sequence of int (or long) + ``` :param arr: The list or array representing a continuous index. diff --git a/src/itk_dreg/block/image.py b/src/itk_dreg/block/image.py index b7829a2..36169aa 100644 --- a/src/itk_dreg/block/image.py +++ b/src/itk_dreg/block/image.py @@ -121,7 +121,7 @@ def physical_region_to_itk_image( 4. Compute the origin at the centerpoint of the 0th voxel; 5. Compute the output voxel size according to the equation: - size = ((D * S) ^ -1) * (upper_bound - lower_bound) + size = ((D * S) ^ -1) * (upper_bound - lower_bound) The resulting image is a metadata representation of the relationship between spaces and has no pixel buffer allocation. diff --git a/src/itk_dreg/reduce_dfield/transform_collection.py b/src/itk_dreg/reduce_dfield/transform_collection.py index 165d6f3..e58f608 100644 --- a/src/itk_dreg/reduce_dfield/transform_collection.py +++ b/src/itk_dreg/reduce_dfield/transform_collection.py @@ -2,7 +2,7 @@ import logging from dataclasses import dataclass -from typing import List, Type, Optional, Tuple, Callable +from typing import List, Optional, Tuple, Callable import itk import numpy as np @@ -15,8 +15,28 @@ @dataclass class TransformEntry: - transform: Type[itk.Transform] + """ + Wraps a single transform for inclusion in a `TransformCollection` with or without a transform domain. + """ + + transform: itk.Transform + """ + Transform representing some spatial relationship. + """ domain: Optional[itk.Image] + """ + The domain over which the transform is valid. + + If a value is provided then the is considered to be bounded, meaning it is only valid to + transform a point in real space by this transform if the transform falls within the + physical bounds of the transform domain. + As a convenience, a transform domain is constrained such that it must be representable + with an oriented bounding box in physical space. + An unbuffered `itk.Image` may be used to describe the oriented bounding box. The voxel grid + subdivision of the `itk.Image` is ignored in `TransformCollection` processing. + If `None` then the transform is considered to be unbounded, meaning it is valid to transform + any point in real space by this transform to obtain another point in R^3. + """ class TransformCollection: