utils¶
Image¶
-
class
airlab.utils.image.
Displacement
(*args, **kwargs)[source]¶ -
itk
()[source]¶ Returns a SimpleITK image
Note: the order of axis is flipped back to the convention of SimpleITK
-
static
read
(filename, dtype=torch.float32, device='cpu')[source]¶ Static method to directly read a displacement field through the Image class
filename (str): filename of the displacement field dtype: specific dtype for representing the tensor device: on which device the displacement field has to be allocated return (Displacement): an airlab displacement field
-
-
class
airlab.utils.image.
Image
(*args, **kwargs)[source]¶ Class representing an image in airlab
-
initializeForImages
(sitk_image, dtype=None, device='cpu')[source]¶ Constructor for SimpleITK image
Note: the order of axis are flipped in order to follow the convention of numpy and torch
sitk_image (sitk.SimpleITK.Image): SimpleITK image dtype: pixel type device (‘cpu’|’cuda’): on which device the image should be allocated return (Image): an airlab image object
-
initializeForTensors
(tensor_image, image_size, image_spacing, image_origin)[source]¶ Constructor for torch tensors and numpy ndarrays
Args: tensor_image (np.ndarray | th.Tensor): n-dimensional tensor, where the last dimensions are the image dimensions while the preceeding dimensions need to empty image_size (array | list | tuple): number of pixels in each space dimension image_spacing (array | list | tuple): pixel size for each space dimension image_origin (array | list | tuple): physical coordinate of the first pixel :return (Image): an airlab image object
-
itk
()[source]¶ Returns a SimpleITK image
Note: the order of axis is flipped back to the convention of SimpleITK
-
static
read
(filename, dtype=torch.float32, device='cpu')[source]¶ Static method to directly read an image through the Image class
filename (str): filename of the image dtype: specific dtype for representing the tensor device: on which device the image has to be allocated return (Image): an airlab image
-
-
airlab.utils.image.
create_tensor_image_from_itk_image
(itk_image, dtype=torch.float32, device='cpu')[source]¶
-
airlab.utils.image.
flip
(x, dim)[source]¶ Flip order of a specific dimension dim
x (Tensor): input tensor dim (int): axis which should be flipped return (Tensor): returns the tensor with the specified axis flipped
Kernel Function¶
-
airlab.utils.kernelFunction.
bspline_kernel
(sigma, order=2, dim=1, asTensor=False, dtype=torch.float32, device='cpu')[source]¶
-
airlab.utils.kernelFunction.
bspline_kernel_1d
(sigma, order=2, asTensor=False, dtype=torch.float32, device='cpu')[source]¶
-
airlab.utils.kernelFunction.
bspline_kernel_2d
(sigma=[1, 1], order=2, asTensor=False, dtype=torch.float32, device='cpu')[source]¶
-
airlab.utils.kernelFunction.
bspline_kernel_3d
(sigma=[1, 1, 1], order=2, asTensor=False, dtype=torch.float32, device='cpu')[source]¶
-
airlab.utils.kernelFunction.
gaussian_kernel
(sigma, dim=1, asTensor=False, dtype=torch.float32, device='cpu')[source]¶
-
airlab.utils.kernelFunction.
gaussian_kernel_1d
(sigma, asTensor=False, dtype=torch.float32, device='cpu')[source]¶
-
airlab.utils.kernelFunction.
gaussian_kernel_2d
(sigma, asTensor=False, dtype=torch.float32, device='cpu')[source]¶
-
airlab.utils.kernelFunction.
gaussian_kernel_3d
(sigma, asTensor=False, dtype=torch.float32, device='cpu')[source]¶
-
airlab.utils.kernelFunction.
wendland_kernel
(sigma, dim=1, type='C4', asTensor=False, dtype=torch.float32, device='cpu')[source]¶
-
airlab.utils.kernelFunction.
wendland_kernel_1d
(sigma, type='C4', asTensor=False, dtype=torch.float32, device='cpu')[source]¶